⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 waverender.vb

📁 这是一个用vb.net编写的扫描条形码程序
💻 VB
📖 第 1 页 / 共 3 页
字号:
            RaiseEvent BorderStyleChange()
        End Set
    End Property
    Public Sub ResetBoarderStyle()
        mainpanel.BorderStyle = BorderStyle.Fixed3D
    End Sub

    <Category("Appearance"), Description("Sets the backgorund colour when no wave is rendered")> _
    Public Property NoWaveBackColor() As System.Drawing.Color
        Get
            NoWaveBackColor = m_oNoWaveBackColor
        End Get
        Set(ByVal Value As System.Drawing.Color)
            m_oNoWaveBackColor = Value
            renderWave()
            RaiseEvent NoWaveBackColorChange()
        End Set
    End Property
    Public Sub ResetNoWaveBackColor()
        m_oNoWaveBackColor = System.Drawing.SystemColors.ControlDark
        renderWave()
    End Sub

    <Category("Appearance"), Description("Sets the colour of the wave render")> _
    Public Property WaveForeColor() As System.Drawing.Color
        Get
            WaveForeColor = m_oWaveForeColor
        End Get
        Set(ByVal Value As System.Drawing.Color)
            m_oWaveForeColor = Value
            renderWave()
            RaiseEvent WaveForeColorChange()
        End Set
    End Property
    Public Sub ResetWaveForeColor()
        m_oWaveForeColor = System.Drawing.ColorTranslator.FromOle(&H600000)
        renderWave()
    End Sub

    'Stereo Divider Options
    <Category("Appearance"), Description("Sets the colour of the line between the two chanels")> _
    Public Property StereoDividerColor() As System.Drawing.Color
        Get
            StereoDividerColor = m_oColorStereoDivider
        End Get
        Set(ByVal Value As System.Drawing.Color)
            m_oColorStereoDivider = Value
            renderWave()
            RaiseEvent StereoDividerColorChange()
        End Set
    End Property
    Public Sub ResetStereoDividerColor()
        m_oColorStereoDivider = System.Drawing.ColorTranslator.FromOle(&H0S)
        renderWave()
    End Sub
    <Category("Appearance"), Description("Sets the thickness of the line between the two chanels")> _
    Public Property StereoDividerLineThickness() As Short
        Get
            StereoDividerLineThickness = m_oStereoDividerLineThickNess
        End Get
        Set(ByVal Value As Short)
            m_oStereoDividerLineThickNess = Value
            renderWave()
            RaiseEvent StereoDividerWidthChange()
        End Set
    End Property
    Public Sub ResetStereoDividerLineThickness()
        m_oStereoDividerLineThickNess = 1
        renderWave()
    End Sub
    <Category("Appearance"), Description("Sets the style of the line between the two chanels")> _
    Public Property StereoDividerLineStyle() As Drawing2D.DashStyle
        Get
            StereoDividerLineStyle = m_oStereoDividerLineStyle
        End Get
        Set(ByVal Value As Drawing2D.DashStyle)
            m_oStereoDividerLineStyle = Value
            renderWave()
            RaiseEvent StereoDividerStyleChange()
        End Set
    End Property
    Public Sub ResetStereoDividerLinestyle()
        m_oStereoDividerLineStyle = Drawing2D.DashStyle.Solid
        renderWave()
    End Sub

    'Mid Divider Options
    <Category("Appearance"), Description("Sets the colour of the center line")> _
    Public Property MidDividerColor() As System.Drawing.Color
        Get
            MidDividerColor = m_oColorMidDivider
        End Get
        Set(ByVal Value As System.Drawing.Color)
            m_oColorMidDivider = Value
            renderWave()
            RaiseEvent MidDividerColorChange()
        End Set
    End Property
    Public Sub ResetMidDividerColor()
        m_oColorMidDivider = System.Drawing.SystemColors.Control
        renderWave()
    End Sub
    <Category("Appearance"), Description("Sets the thickness of the line between the two chanels")> _
    Public Property MidDividerLineThickness() As Short
        Get
            MidDividerLineThickness = m_oMidDividerLineThickNess
        End Get
        Set(ByVal Value As Short)
            m_oMidDividerLineThickNess = Value
            renderWave()
            RaiseEvent MidDividerWidthchange()
        End Set
    End Property
    Public Sub ResetMidDividerLineThickness()
        m_oMidDividerLineThickNess = 1
        renderWave()
    End Sub
    <Category("Appearance"), Description("Sets the style of the line between the two chanels")> _
    Public Property MidDividerLineStyle() As Drawing2D.DashStyle
        Get
            MidDividerLineStyle = m_oMidDividerLineStyle
        End Get
        Set(ByVal Value As Drawing2D.DashStyle)
            m_oMidDividerLineStyle = Value
            renderWave()
            RaiseEvent MidDividerStylechange()
        End Set
    End Property
    Public Sub ResetMidDividerLinestyle()
        m_oMidDividerLineStyle = Drawing2D.DashStyle.Solid
        renderWave()
    End Sub

    'Half Amplitude Options
    <Category("Appearance"), Description("Sets the colour of the half amplitude line ")> _
        Public Property HalfAmplitudeDividerColor() As System.Drawing.Color
        Get
            HalfAmplitudeDividerColor = m_oColorHalfAmplitudeDivider
        End Get
        Set(ByVal Value As System.Drawing.Color)
            m_oColorHalfAmplitudeDivider = Value
            renderWave()
            RaiseEvent HalfAmplitudeDividerColorChange()
        End Set
    End Property
    Public Sub ResetHalfAmplitudeDividerColor()
        m_oColorHalfAmplitudeDivider = System.Drawing.ColorTranslator.FromOle(&HFF0000)
        renderWave()
    End Sub
    <Category("Appearance"), Description("Sets the thickness of the line between the two chanels")> _
    Public Property HalfAmplitudeDividerLineThickness() As Short
        Get
            HalfAmplitudeDividerLineThickness = m_oHalfAmplitudeDividerLineThickNess
        End Get
        Set(ByVal Value As Short)
            m_oHalfAmplitudeDividerLineThickNess = Value
            RaiseEvent HalfAmplitudeDividerWidthChange()
            renderWave()
        End Set
    End Property
    Public Sub ResetHalfAmplitudeDividerLineThickness()
        m_oHalfAmplitudeDividerLineThickNess = 1
        renderWave()
    End Sub
    <Category("Appearance"), Description("Sets the style of the line between the two chanels")> _
    Public Property HalfAmplitudeDividerLineStyle() As Drawing2D.DashStyle
        Get
            HalfAmplitudeDividerLineStyle = m_oHalfAmplitudeDividerLineStyle
        End Get
        Set(ByVal Value As Drawing2D.DashStyle)
            m_oHalfAmplitudeDividerLineStyle = Value
            renderWave()
            RaiseEvent HalfAmplitudeDividerStyleChange()
        End Set
    End Property
    Public Sub ResetHalfAmplitudeDividerLinestyle()
        m_oHalfAmplitudeDividerLineStyle = Drawing2D.DashStyle.Solid
        renderWave()
    End Sub

    'Zoom control
    <Category("Control Options"), Description("Sets the zoom ratio at start up")> _
        Public Property Zoom() As EWaveViewerZoom
        Get
            Zoom = m_lZoom
        End Get
        Set(ByVal Value As EWaveViewerZoom)
            If Not (m_lZoom = Value) Then
                m_lZoom = Value
                SetScroll()
                renderWave()
            End If
        End Set
    End Property
    Public Sub ResetZoom()
        m_lZoom = EWaveViewerZoom.e1to1
        SetScroll()
        renderWave()
    End Sub

    Private Sub UserControl_Initialize()
        m_cWAVRead = New WaveFile

        m_GraphicInfoReady = False
        m_FileOpen = False

        PaintData.init()

        m_lZoom = EWaveViewerZoom.e1to1
        m_oWaveBackColor = System.Drawing.SystemColors.Window
        m_oNoWaveBackColor = System.Drawing.SystemColors.ControlDark
        m_oWaveForeColor = System.Drawing.ColorTranslator.FromOle(&H600000)
        m_oColorStereoDivider = System.Drawing.ColorTranslator.FromOle(&H0S)
        m_oStereoDividerLineThickNess = 1
        m_oStereoDividerLineStyle = Drawing2D.DashStyle.Solid
        m_oColorMidDivider = System.Drawing.SystemColors.HotTrack
        m_oMidDividerLineThickNess = 1
        m_oMidDividerLineStyle = Drawing2D.DashStyle.Solid
        m_oColorHalfAmplitudeDivider = System.Drawing.ColorTranslator.FromOle(&HFF0000)
        m_oHalfAmplitudeDividerLineThickNess = 1
        m_oHalfAmplitudeDividerLineStyle = Drawing2D.DashStyle.Solid

        m_ThreadDone = True
        m_bUseThread = True
        renderWave()


    End Sub

    'End Functions
    Private Sub UserControl_Terminate()
        'm_cScroll = Nothing
        m_cWAVRead = Nothing
    End Sub

    'Main Functions
    'Set Scroll
    Private Sub SetScroll()
        Dim lMax As Integer
        m_bSetting = True
        If m_FileOpen Then
            If m_lZoom <= 1 Then
                m_lSampleStep = 1
                m_lPixelStep = System.Math.Abs(m_lZoom)
                m_lSamplePerPixelStep = 1
                lMax = m_cWAVRead.AudioLength
            Else
                m_lSamplePerPixelStep = m_lZoom
                m_lSampleStep = m_lSamplePerPixelStep \ 32
                If (m_lSampleStep < 1) Then
                    m_lSampleStep = 1
                End If
                m_lPixelStep = 1

                lMax = (m_cWAVRead.AudioLength \ m_lSamplePerPixelStep) - MyBase.ClientRectangle.Width
            End If

            If lMax < 0 Then
                hozScroll.Value = 0
                hozScroll.Visible = False
                '            m_cScroll.ValueA(cScrollBars.EFSScrollBarConstants.efsHorizontal) = 0
                '            m_cScroll.Visible(cScrollBars.EFSScrollBarConstants.efsHorizontal) = False
            Else
                hozScroll.SmallChange = MyBase.ClientRectangle.Width \ 32
                hozScroll.LargeChange = MyBase.ClientRectangle.Width
                hozScroll.Maximum = lMax
                hozScroll.Visible = True
                '            m_cScroll.SmallChange(cScrollBars.EFSScrollBarConstants.efsHorizontal) = MyBase.ClientRectangle.Width \ 32
                '            m_cScroll.LargeChange(cScrollBars.EFSScrollBarConstants.efsHorizontal) = MyBase.ClientRectangle.Width
                '            m_cScroll.Max(cScrollBars.EFSScrollBarConstants.efsHorizontal) = lMax
                '            m_cScroll.Visible(cScrollBars.EFSScrollBarConstants.efsHorizontal) = True
            End If

        End If
        m_bSetting = False
    End Sub
    'Determin if there is a scroll change
    Private Sub hozscroll_change(ByVal sender As Object, ByVal e As EventArgs) Handles hozScroll.ValueChanged
        If m_FileOpen And (m_cWAVRead.AudioLength > 0) Then
            renderWave()
        End If
    End Sub
    'Determin if the scroll value changes
    Private Sub hozScroll_scroll(ByVal sender As Object, ByVal e As ScrollEventArgs) Handles hozScroll.Scroll
        If m_FileOpen And (m_cWAVRead.AudioLength > 0) Then
            renderWave()
        End If
    End Sub

    'Handle for mousewheel data... has to be passed to it from the host application
    Public Sub cont_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles hozScroll.MouseWheel
        Dim numberToMove As Integer = e.Delta * SystemInformation.MouseWheelScrollLines / 120

        Dim iTemp As Integer = hozScroll.Value + numberToMove
        If iTemp < 0 Then
            iTemp = 0
        End If
        If iTemp > hozScroll.Maximum Then
            iTemp = hozScroll.Maximum
        End If
        hozScroll.Value = iTemp
    End Sub

    'Private Sub mainpanel_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mainpanel.MouseDown
    '    m_cScroll.ValueA(cScrollBars.EFSScrollBarConstants.efsHorizontal) = m_cScroll.ValueA(cScrollBars.EFSScrollBarConstants.efsHorizontal) - e.Delta * SystemInformation.MouseWheelScrollLines / 120
    'End Sub


    'Size

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -