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 sizbut 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 Dots on a form 1

Status
Not open for further replies.

granni

Programmer
Nov 8, 2000
36
SG
can anyone help me on drawing dots on a form
these dots will be used to form a grid

Thanks
 
[tt]
For i = 1 to MyForm.scalewidth Step 10
[tab]For j = 1 to MyForm.scaleheight Step 10
[tab][tab]MyForm.CurrentX = i
[tab][tab]MyForm.CurrentY = j
[tab][tab]MyForm.PSet
[tab]Next j
Next i
[/tt]

You will also need to do things like set the correct color, change the step distance, etc.

BTW: This is not the fastest way to do this. You might look at creating a bitmap with the pattern you want and setting the background of the form to it.

Chip H.
 
you most First set the Form AutoRedraw To True and then

For i = 0 To ScaleWidth Step 45
For j = 0 To ScaleHeight Step 45
Me.PSet (i, j)
Next
Next Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Most of all thanks for the reply, now i have a grided form
but how do i speed up the drawing process, coz i may have dots that are spaced 30 twips apart.

Again thanks :)
 
granni,

I do not know how you did the 'dotting', or what ver of Ms. Access you are using, so this may be completely irrevelant, but ...

PSet does not apply to FORMS in Ms. Access 2K, so if you are using that method and a previous ver of Ms. Accees, you need to be careful about the (enventual/inevitable) upgrade to ver 2K (or later)


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
but how do i speed up the drawing process, coz i may have dots that are spaced 30 twips apart.

Look at creating a bitmap like I suggested. Drawing a bitmap as a background is a single BitBlt operation, versus several thousand for doing it inside nested loops. Be sure to create it large enough for people using 1600x1280 resolution.

Chip H.
 
Use the Line method and set the Forms DrawStyle property to vbDot.

Me.DrawStyle = vbDot
Me.Line (X1,Y1) - (X2,Y2)

To Draw a Solid Grid contour line, use
Me.DrawStyle = vbSolid
Me.Line (X1,Y1) - (X2,Y2),,B

Some restrictions may apply: if you set DrawWidth to a value different from 1, it will be ignored. _________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Re: Help in ver 2K, DrawStyle and Linr apply to REPORTS, NOT forms.


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Michael, it seems I'm not the only one who forgets when I've moved from an Access forum to a VB forum! (-: Rick Sprague
 
OOPs! Sorry. I think I also sometimes 'forget' when I'm programming. Get some "Strange looks on occassion.

(or at least I did before started doing this for free on a full time basis)


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Correction: Read the last paragraph as follows:

Some restrictions may apply: if you set DrawWidth to a value different from 1, DrawStyle will be ignored (a solid line will be produced). _________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top