Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to draw points onto a frame control? 1

Status
Not open for further replies.

ultra2

Programmer
Jun 26, 2005
46
HU
i need to draw hundreds of points onto a frame control. It should look like the points on a form in the form designer of VB6.

I tried to create a shape control array, but that is too slow to swich on/off the visible property of hundreds of shape controls.

how to draw directly onto the frame control?
 
... on a frame control. But why onto a frame and not just onto the form???
 
ok, thx, then I will use a picturebox control

how to draw points onto that? directly what is the fastest way?
 
Code:
Private Sub Command1_Click()
  For i = 1 To 8
    For j = 1 To 8
      Picture1.PSet (i, j)
    Next
  Next
End Sub


Add a picturebox (name=picture1)
add a command button (name=command1)
set for example the scaleheight and scalewidth of the picturebox to 8

See what happens...

(to adjust the diameter of the dots in the picture1 change its property drawwidth)
 
..Also you may need to change the ScaleMode (default value "1 - Twip")


-
 
VBakias said:
..Also you may need to change the ScaleMode (default value "1 - Twip")

...Change the Value to 3 - Pixel

Or use ScaleX and ScaleY...
Code:
Private Sub Command1_Click()
  For i = 1 To 8
    For j = 1 To 8
      Picture1.PSet (ScaleX(i, vbPixels, vbTwips), ScaleY(j, vbPixels, vbTwips))
    Next
  Next
End Sub

*Note: ScaleX & ScaleY are actually methods of the Form, so they will not be accessible from a module unless you reference a form.

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top