|
-
Jan 6th, 2003, 10:02 AM
#1
Thread Starter
Lively Member
drawing at runtime
how do i draw
1) shapes at runtime
2) lines at runtime
i tried drawing shapes using this code, but still not so nice.
cmd1_click()
load shape1(num)
shape1(num) properties set here
end
but this is not satisfactory
and until now i still dono how 2 draw a line at runtime
can help plz? thx
help much appreciated
-
Jan 6th, 2003, 10:49 AM
#2
Fanatic Member
This example uses the Line method to draw concentric boxes on a form. To try this example, paste the code into the General section of a form. Then press F5 and click the form.
VB Code:
Sub Form_Click ()
Dim CX, CY, F, F1, F2, I ' Declare variables
ScaleMode = 3 ' Set ScaleMode to pixels.
CX = ScaleWidth / 2 ' Get horizontal center.
CY = ScaleHeight / 2 ' Get vertical center.
DrawWidth = 8 ' Set DrawWidth.
For I = 50 To 0 Step -2
F = I / 50 ' Perform interim
F1 = 1 - F: F2 = 1 + F ' calculations.
Forecolor = QBColor(I Mod 15) ' Set foreground color.
Line (CX * F1, CY * F1)-(CX * F2, CY * F2), , BF
Next I
DoEvents ' Yield for other processing.
If CY > CX Then ' Set DrawWidth.
DrawWidth = ScaleWidth / 25
Else
DrawWidth = ScaleHeight / 25
End If
For I = 0 To 50 Step 2 ' Set up loop.
F = I / 50 ' Perform interim
F1 = 1 - F: F2 = 1 + F ' calculations.
Line (CX * F1, CY)-(CX, CY * F1) ' Draw upper-left.
Line -(CX * F2, CY) ' Draw upper-right.
Line -(CX, CY * F2) ' Draw lower-right.
Line -(CX * F1, CY) ' Draw lower-left.
Forecolor = QBColor(I Mod 15) ' Change color each time.
Next I
DoEvents ' Yield for other processing.
End Sub
-
Jan 6th, 2003, 10:49 AM
#3
Thread Starter
Lively Member
plz don't leave me hanging teach me plz. i m a new programmer and i try all i know alerady
i have searched online, they only teach me how 2 do it when designing, not during runtime
-
Jan 6th, 2003, 10:52 AM
#4
Thread Starter
Lively Member
oh thanx, i'll try that, but what about drawing shapes?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|