http://www.csdn.net/expert/topic/879/879364.xml?temp=.8279993
解决方案 »
- 有个语句问题,请指教 在线等
- 帮我看看程序哪里出错了.谢谢了.我急着要答案!
- vsflexgrid怎么实现这样的功能
- 送给大家一个源码,帮我找找里面的找图函数是怎么定义的
- 各位仁兄,从网页用HTTP协议向WINSOCK控件提交数据,格式怎么转换?
- 求救!自定义的类不能用?
- 一个关于MSComm的dll问题,在线急等,万谢!!
- 为什么我写的dll在vb中不能调用???
- SmartMenuXP控件(www.vbsmart.com下载,一个XP菜单控件)的中文支持问题
- 返回一个字符串中的某个字符的位置用那个函数?
- 关于ComboBox控件的问题:如何在ComboBox的每行内显示一个数据库的表的多列的数据?
- “俩问题,每题100分”之“文件的相对路经”
Line(),circle()
用循环控制,配合数学公式
'- two timers, interval=100
'- a button'in general section
Private Type POINTAPI
x As Long
y As Long
End TypePrivate Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd 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 LongPrivate Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
Timer2.Interval = 100
Timer2.Enabled = True
Command1.Caption = "Draw Text"
End Sub
'This will draw an Ellipse on the active window
Sub Timer1_Timer()
Dim Position As POINTAPI
'Get the cursor position
GetCursorPos Position
'Draw the Ellipse on the Screen's DC
Ellipse GetWindowDC(0), Position.x - 5, Position.y - 5, Position.x + 5, Position.y + 5
End Sub
Sub Command1_Click()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected] Dim intCount As Integer, strString As String
strString = "Cool, text on screen !"
For intCount = 0 To 30
'Draw the text on the screen
TextOut GetWindowDC(0), intCount * 20, intCount * 20, strString, Len(strString)
Next intCount
End Sub
Private Sub Timer2_Timer()
'Draw the text to the active window
TextOut GetWindowDC(GetActiveWindow), 50, 50, "This is a form", 14
End Sub
Dim orgx As Single, orgy As Single, cx As Single, cy As Single, r As SinglePrivate Sub Form_DblClick()
Cls
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
isdrag = True
orgx = X
orgy = Y
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static c As Integer
If isdrag Then
c = c Mod 16
Select Case Button
Case 1
r = max(Abs(orgx - X), Abs(orgy - Y))
Circle (orgx, orgy), r, QBColor(c)
Case 2
r = max(Abs(orgx - X), Abs(orgy - Y)) / 2
Circle (X, Y), r, QBColor(c)
End Select
c = c + 1
End If
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
isdrag = False
End SubFunction max(a, b)
If a < b Then max = b Else max = a
End Function
但知道用VB绘图并不是很好的选择
在VB中画简单的图形还算可以,但要是要画复杂一些的就比较麻烦了但VB中的绘图语句比较好学.就那么几个:Pset,Line,Circle