home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Click and drag to draw the selected shape"
- ClientHeight = 3090
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5220
- LinkTopic = "Form1"
- ScaleHeight = 3090
- ScaleWidth = 5220
- StartUpPosition = 3 'Windows Default
- Begin VB.OptionButton Option3
- Caption = "Ellipse"
- Height = 615
- Left = 0
- TabIndex = 7
- Top = 1560
- Width = 975
- End
- Begin VB.OptionButton Option2
- Caption = "line"
- Height = 615
- Left = 0
- TabIndex = 6
- Top = 960
- Width = 975
- End
- Begin VB.OptionButton Option1
- Caption = "rectangle"
- Height = 555
- Left = 0
- TabIndex = 5
- Top = 480
- Width = 975
- End
- Begin VB.PictureBox Picture1
- BackColor = &H80000009&
- Height = 2895
- Left = 960
- ScaleHeight = 2835
- ScaleWidth = 4035
- TabIndex = 0
- Top = 120
- Width = 4095
- End
- Begin VB.Label Label4
- Caption = "Label4"
- Height = 495
- Left = 2280
- TabIndex = 4
- Top = 3240
- Width = 1215
- End
- Begin VB.Label Label3
- Caption = "Label3"
- Height = 495
- Left = 1560
- TabIndex = 3
- Top = 3480
- Width = 1215
- End
- Begin VB.Label Label2
- Caption = "Label2"
- Height = 495
- Left = 960
- TabIndex = 2
- Top = 3120
- Width = 1215
- End
- Begin VB.Label Label1
- Caption = "Label1"
- Height = 495
- Left = 360
- TabIndex = 1
- Top = 3120
- Width = 1215
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- 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 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
- Dim pressed As Boolean
- Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- pressed = True 'sets the value of label1 and 2's captions to x and y for later use
- Label1.Caption = X
- Label2.Caption = Y
- End Sub
- Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- If pressed Then
- Label3.Caption = X
- Label4.Caption = Y
- If Option1 Then
- a = Label1.Caption / 60 * 3.14 'this is so the rect is off of the cursur
- b = Label2.Caption / 60 * 3.14 'take the math out and you'll see what i mean
- c = Label3.Caption / 60 * 3.14
- d = Label4.Caption / 60 * 3.14
- Picture1.BackColor = &HFFFFFF
- Call Rectangle(Picture1.hdc, a, b, c, d)
- End If
- If Option2 Then
- a = Label1.Caption
- b = Label2.Caption
- c = Label3.Caption
- d = Label4.Caption
- Picture1.BackColor = &HFFFFFF
- Picture1.Line (a, b)-(c, d) 'this is what draws the line
- End If
- If Option3 Then
- X1 = Label1.Caption / 60 * 3.14
- Y1 = Label2.Caption / 60 * 3.14
- X2 = Label3.Caption / 60 * 3.14
- Y2 = Label4.Caption / 60 * 3.14
- Picture1.BackColor = &H80000009
- Call Ellipse(Picture1.hdc, X1, Y1, X2, Y2) 'this is what draws the ellipse
- End If
- End If
- End Sub
- Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- pressed = False 'stops drawing whatever it was you were drawing
- End Sub
-