我看到最新版的QQ是用这个功能来截图的,按下截图的按扭后,MOUSE会变成彩色光标,这些MOUSE的单击事件被拦截,所以除了能画出距形外不会触发任何单击事件,这些我都应该能做到,现在唯一想不到的就是,怎么在非VB的窗体下拉出一个距形来呢?

解决方案 »

  1.   

    先获取被画窗体的句柄(Getwindow,Findwindow,Windowfrompoint都可以),然后GetDC获取DC,再调用GDI32库里的绘图函数即可,比如LineTo画线等等
      

  2.   

    鼠标的down和up事件确定点,然后就画
      

  3.   

    一个窗体, 一个Command1
    按下按钮前做好下雨准备,:)'////
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function PatBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long
    Private Const PATINVERT = &H5A0049
        
    Private Sub Command1_Click()
      Dim hDCDisp As Long
      Dim i As Long
      
      hDCDisp = GetDC(0)
      For i = 0 To 100
        PatBlt hDCDisp, Rnd * Screen.Width / Screen.TwipsPerPixelX, Rnd * Screen.Height / Screen.TwipsPerPixelY, 3 * Rnd, 100 * Rnd, PATINVERT
      Next i
    End Sub
      

  4.   

    或者调用XOR方式画矩形Private Declare Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As Long, lpRect As RECT) As Long
    收衣服了吗?:)
      

  5.   

    首先要获得桌面的DC
    API  CreateDC("DISPLAY",null,nulll,null);
      

  6.   

    mouse_event函数
    先down
    然后移动鼠标
    然后up
      

  7.   

    先在窗体上画四条线,分别取名为:L1,L2,L3,L4 : 全部.Visible=false : 全部.BorderStyle =3
    Option Explicit
    Dim bMove As BooleanPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
      L1.X1 = X
      L1.Y1 = Y
      bMove = True
    End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
      If bMove Then
        
        L1.X2 = X
        L1.Y2 = L1.Y1
        
        L2.X1 = X
        L2.X2 = X
        L2.Y1 = L1.Y1
        L2.Y2 = Y
        
        L3.X1 = L1.X1
        L3.X2 = X
        L3.Y1 = Y
        L3.Y2 = Y
        
        L4.X1 = L1.X1
        L4.X2 = L1.X1
        L4.Y1 = L1.Y1
        L4.Y2 = Y
        
        L3.Visible = True
        L4.Visible = True
        L2.Visible = True
        L1.Visible = True
      End If
    End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
      bMove = False
      L1.Visible = False
      L2.Visible = False
      L3.Visible = False
      L4.Visible = False
    End Sub