Results 1 to 4 of 4

Thread: drawing at runtime

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Posts
    70

    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

  2. #2
    Fanatic Member
    Join Date
    Oct 2001
    Location
    didn't decide yet
    Posts
    566
    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:
    1. Sub Form_Click ()
    2.    Dim CX, CY, F, F1, F2, I   ' Declare variables
    3.    ScaleMode = 3   ' Set ScaleMode to pixels.
    4.    CX = ScaleWidth / 2   ' Get horizontal center.
    5.    CY = ScaleHeight / 2   ' Get vertical center.
    6.    DrawWidth = 8   ' Set DrawWidth.
    7.    For I = 50 To 0 Step -2
    8.       F = I / 50   ' Perform interim
    9.       F1 = 1 - F: F2 = 1 + F   ' calculations.
    10.       Forecolor = QBColor(I Mod 15)   ' Set foreground color.
    11.       Line (CX * F1, CY * F1)-(CX * F2, CY * F2), , BF
    12.    Next I
    13.    DoEvents   ' Yield for other processing.
    14.    If CY > CX Then   ' Set DrawWidth.
    15.       DrawWidth = ScaleWidth / 25
    16.    Else
    17.       DrawWidth = ScaleHeight / 25
    18.    End If
    19.    For I = 0 To 50 Step 2   ' Set up loop.
    20.       F = I / 50   ' Perform interim
    21.       F1 = 1 - F: F2 = 1 + F   ' calculations.
    22.       Line (CX * F1, CY)-(CX, CY * F1)   ' Draw upper-left.
    23.       Line -(CX * F2, CY)   ' Draw upper-right.
    24.       Line -(CX, CY * F2)   ' Draw lower-right.
    25.       Line -(CX * F1, CY)   ' Draw lower-left.
    26.       Forecolor = QBColor(I Mod 15)   ' Change color each time.
    27.    Next I
    28.    DoEvents   ' Yield for other processing.
    29. End Sub
    Come and get our ISDN CallerID http://www.3wm.biz

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Posts
    70
    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

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Posts
    70
    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
  •  



Click Here to Expand Forum to Full Width