解读ODB++文件--续集

首先祝大家新年快乐.
先上效果图.
在这里插入图片描述

这里主要是增加了,框选放大效果.这其中就用到了WIN32的API 实现的橡皮线功能.

部分代码如下:

Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
        MyBase.OnMouseDown(e)
        Dim g As Graphics = Me.CreateGraphics()
        Dim hdc As IntPtr = g.GetHdc()
        m_Step += 1
        SetROP2(hdc, 10)
        If m_Step = 1 Then
            m_StartX = e.X
            m_Start_Y = e.Y
            m_EndX = e.X
            m_EndY = e.Y
        ElseIf m_Step = 2 Then
            If Math.Abs(m_StartX - m_EndX) > Math.Abs(m_Start_Y - m_EndY) Then
                scale = Me.Width / Math.Abs(m_StartX - m_EndX)
            Else
                scale = Me.Height / Math.Abs(m_Start_Y - m_EndY)
            End If
            gMap = Me.CreateGraphics()
            gMap.Clear(Color.Black)
            gMap.ScaleTransform(scal * scale, scal * scale)
            scal = scal * scale
            Dim weiyi_x = m_StartX
            Dim weiyi_y = m_Start_Y
            gMap.TranslateTransform(distance - weiyi_x, distance_y - weiyi_y)
            distance = distance - m_StartX
            distance_y = distance_y - m_Start_Y
            Call Form1.draw_feature2()
            Call Form1.draw_profile()
            m_Step = 0
        End If
        g.ReleaseHdc(hdc)
    End Sub

    Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
        MyBase.OnMouseMove(e)
        Dim g As Graphics = Me.CreateGraphics()
        Dim prex, prey As Integer
        If m_Step = 1 Then
            Dim hdc As IntPtr = g.GetHdc()
            prex = m_EndX
            prey = m_EndY
            SetROP2(hdc, 10)
            Rectangle(hdc, m_StartX, m_Start_Y, prex, prey)
            Rectangle(hdc, m_StartX, m_Start_Y, e.X, e.Y)
            m_EndX = e.X
            m_EndY = e.Y
            g.ReleaseHdc(hdc)
        End If
    End Sub
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kevin_Lai_1987

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值