none
如何利用VB.net 在桌面中标示十字线条 RRS feed

  • 问题

  • 小弟目前知道在picture控键中或是form对象中  划出十字线条的

    代码  可是如果要在桌面去表现出十字线条的话  要怎么做到呢?

     

    以下是实时在picture 控键  绘出十字线条的代码:

    Public  Class Form1
    
    Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
            PictureBox1.Invalidate()
            
        End Sub
    
    
       Private Sub PictureBox_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
            Dim point As Point = PointToClient(MousePosition)
            Dim x As Integer = point.X
            Dim y As Integer = point.Y
            With e.Graphics
                .DrawLine(Pens.Black, 0, 65, PictureBox1.Width, 65)
                .DrawLine(Pens.Black, x, 0, x, PictureBox1.Height)
    
    
            End With
        End Sub
    
    End Class
    

    我在猜基本的思路是要先将整个桌面当成一个对象  然后去触发这个对象产生

     

    绘出十字线条的事件吗? 小弟瞎猜  不晓得哪位大侠能否提供实际的做法

    2012年12月25日 15:05

全部回复