Results 1 to 7 of 7

Thread: paint grid dots on form?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091

    paint grid dots on form?

    Hi,

    I wanted to find out a quick way to paint grid dots in a PictureBox or directly on a form? What I'm talking about is the same grid dots that are on the form in design view in VB.

    Any help would be appreciated..

    Dan

    Visual Studio 2010

  2. #2
    NOMADMAN
    Guest
    This is the quickest way I know of:
    VB Code:
    1. For i = 0 To Me.Width Step 135
    2.         For j = 0 To Me.Height Step 135
    3.             Me.PSet (i, j), vbRed
    4.         Next j
    5.     Next i
    A little explination may be in order... My form was in the default of twips (this can also be done on a picture object) I found that there is 135 twips between each point in the VB grid (by making the smallest Shape object possible and looking at width/height). The vb red is a red dot, obviously, so change that if you need to. But its pretty straight forward.

    Hope this helped!

    NOMAD

  3. #3
    wehttam13
    Guest

    Cool

    use a loop
    set the scalemode of the form to pixels
    code:

    option explicit
    Dim A%
    dim B%


    private sub command1_click()
    for a% = 0 to form1.scalewidth step 50
    for b% = 0 to form1.scaleheight step 50
    form1.pset (a,b)
    next a%
    next b%
    end sub

    hope this works, i haven't had a chance to try it out.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Thanks! Now how would I be able to clear the dots off the form?

    Visual Studio 2010

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    There is a slight problem when painting the dots in a PictureBox.

    When I move a control around at run time when it is a child of the PictureBox and I have drawn the dots, the dots get wiped out as I move the control around.

    Is there a way to prevent the dots from being erased?

    Visual Studio 2010

  6. #6
    NOMADMAN
    Guest
    I've been struggling with that for weeks! I'm just tring to save the images though.

    I did some experimenting and found you can copy the image to a buffer picture object using bitblt. This buffer if set to autoredraw = TRUE and visible = FALSE will let you use bitblt on it like you would for any game with an invisible sprite picture object.

    Follow? Just ask and I'll ********!

    NOMAD

  7. #7
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by dbassettt74
    There is a slight problem when painting the dots in a PictureBox.

    When I move a control around at run time when it is a child of the PictureBox and I have drawn the dots, the dots get wiped out as I move the control around.

    Is there a way to prevent the dots from being erased?
    Put the code in the Picture_Paint and set AutoRedraw to True.
    My evil laugh has a squeak in it.

    kristopherwilson.com

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