不太明白你的要求,是不是这样的?
Option Explicit
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim flag As Boolean
Dim pos() As POINTAPI
Dim i As Integer
Private Sub Form_Load()
flag = False
Me.ScaleMode = 3
Me.AutoRedraw = False
i = 0
End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
flag = True
ReDim Preserve pos(i)
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim j As Integer
If (flag) Then
ReDim Preserve pos(i)
pos(i).X = X
pos(i).Y = Y
Me.Cls
Polygon Me.hdc, pos(0), i
For j = 0 To i
Ellipse Me.hdc, pos(j).X, pos(j).Y, pos(j).X + 5, pos(j).Y + 5
Next j
End If
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (flag) Then
pos(i).X = X
pos(i).Y = Y
If (i >= 3) Then
Polygon Me.hdc, pos(0), i
Ellipse Me.hdc, X, Y, X + 5, Y + 5
i = i + 1
End If
If (i < 3) Then
Polygon Me.hdc, pos(0), i
i = i + 1
Ellipse Me.hdc, X, Y, X + 5, Y + 5
flag = False
End If
End If
End Sub
--------------------------------------------------------------------
Made by Thirdapple's Studio(http://3rdapple.51.net/)
Option Explicit
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim flag As Boolean
Dim pos() As POINTAPI
Dim i As Integer
Private Sub Form_Load()
flag = False
Me.ScaleMode = 3
Me.AutoRedraw = False
i = 0
End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
flag = True
ReDim Preserve pos(i)
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim j As Integer
If (flag) Then
ReDim Preserve pos(i)
pos(i).X = X
pos(i).Y = Y
Me.Cls
Polygon Me.hdc, pos(0), i
For j = 0 To i
Ellipse Me.hdc, pos(j).X, pos(j).Y, pos(j).X + 5, pos(j).Y + 5
Next j
End If
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (flag) Then
pos(i).X = X
pos(i).Y = Y
If (i >= 3) Then
Polygon Me.hdc, pos(0), i
Ellipse Me.hdc, X, Y, X + 5, Y + 5
i = i + 1
End If
If (i < 3) Then
Polygon Me.hdc, pos(0), i
i = i + 1
Ellipse Me.hdc, X, Y, X + 5, Y + 5
flag = False
End If
End If
End Sub
--------------------------------------------------------------------
Made by Thirdapple's Studio(http://3rdapple.51.net/)
解决方案 »
- 求VsFileGrid的属性和方法
- VB6开发的程序制作安装盘,现在选择InstallShield那个版本为好?
- 请问能不能在后一个窗体出现后,前一个cs2隐藏或者卸载
- 请问各位高手,当记录清空时,怎样保留mshflexgrid的列标题?
- 我的SQL数据库怎么连不上
- vb中的数据库问题
- 由于将在索引、主关键字、或关系中创建重复的值,请求对表的改变没有成功。改变该字段中的或包含重复数据的字段中的数据,删除索引或重新定义索引以允许重复的值并再试一次
- VB自动提交表单(表单中为图片按钮时失效)
- 一个小问题,但我还没找到答案:(
- 关于DataGrid控件的动态更新问题!!!
- Excel 中怎么能让生成的表格上代线,就是打印时出现的是表!请帮修改?
- 请教VB高手:如何为一系列同样的控件赋初值或检查它们的值?
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim flag As Boolean
Dim hdc1 As Long
Dim pos As RECT
Dim handle As Long
Dim X1 As Long
Dim x2 As Long
Dim y2 As Long
Dim Y1 As LongPrivate Sub Form_Load()
DrawWidth = 10
flag = False
Me.ScaleMode = 3
Me.AutoRedraw = FalseEnd SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
flag = True
pos.Left = X
pos.Top = Y
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (flag) Then
pos.Right = X
pos.Bottom = Y
End If
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (flag) Then
pos.Right = X
pos.Bottom = Y
Rectangle Me.hdc, pos.Left, pos.Bottom, pos.Right, pos.Top
flag = False
End If
End Sub
是不是那个软件的“背景过滤”模块中“手绘”的效果?
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim flag As Boolean
Dim hdc1 As Long
Dim pos(0 To 10) As POINTAPI
Dim i As Integer
Dim nil As POINTAPI
Private Sub Form_Load()
flag = False
Me.ScaleMode = 3
Me.AutoRedraw = False
i = 0
End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
flag = True
pos(i).X = X
pos(i).Y = Y
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (flag) Then
pos(i).X = X
pos(i).Y = Y
Ellipse Me.hdc, X, Y, X + 5, Y + 5
If (i >= 4) Then
Polygon Me.hdc, pos(0), 5
i = 0
End If
If (i < 4) Then
i = i + 1
flag = False
End If
End If
End Sub
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim flag As Boolean
Dim hdc1 As Long
Dim pos As RECT
Dim handle As Long
Dim X1 As Long
Dim x2 As Long
Dim y2 As Long
Dim Y1 As LongPrivate Sub Form_Load()
DrawWidth = 10
flag = False
Me.ScaleMode = 3
Me.AutoRedraw = FalseEnd SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
flag = True
pos.Left = X
pos.Top = Y
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (flag) Then
pos.Right = X
pos.Bottom = Y
End If
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (flag) Then
pos.Right = X
pos.Bottom = Y
Rectangle Me.hdc, pos.Left, pos.Bottom, pos.Right, pos.Top
flag = False
End If
End Sub