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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for a control

Status
Not open for further replies.

24912

Programmer
Mar 1, 2000
1
US
Dear good hearted person;<br>
<br>
Do you know if there is a control that's a has dots (like a grid or graph), that the user can draw on it lines?<br>
Any help you can give me will be gratly appreciated<br>
<br>
Thanks in advance<br>
Mendy
 
Mendy,<br>
<br>
Sorry to let you down on your first posting but - no I don't to be honest. It's quite possible to write one yourself but that could be quite time consuming.<br>
<br>
Anyone else?<br>
<br>
Mike <p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Here's an easy way. Create a form, any size or background color. Then add the following:<br>
<br>
Private Sub Form_Load()<br>
NumXlines = 100 'draw 100 line horizontal & vertical<br>
NumYlines = 100<br>
Xinc = Width / NumXlines 'get the line spacing<br>
Yinc = Height / NumYlines<br>
For Xrep = 1 To NumXlines 'draw the vertical lines<br>
Line (X, 0)-(X, Height), 0 'substitute any color for 0<br>
X = X + Xinc<br>
Next<br>
For Yrep = 1 To NumYlines 'draw the horizontal lines<br>
Line (0, Y)-(Width, Y), 0 <br>
Y = Y + Yinc<br>
Next<br>
End Sub<br>
<br>
The MouseUp event draws your graph lines.<br>
Private Static Sub Form_MouseUp(Button As Integer, Shift As_<br>
Integer, X As Single, Y As Single)<br>
If OldX = 0 Then<br>
OldX = X<br>
OldY = Y<br>
Else<br>
Line (OldX, OldY)-(X, Y), 0 'substitute any color for 0<br>
OldX = X<br>
OldY = Y<br>
End If<br>
End Sub<br>
<br>
You may want to keep the X and Y values in an array so you can save the graph to a file.<br>

 
Hehe better yet take that code he has above, and turn it into an ActiveX control and include it into any app you need. (i can think of many things i'd like to use that into an activeX for) <p>Karl<br><a href=mailto:kb244@bellsouth.net>kb244@bellsouth.net</a><br><a href= </a><br>
 
&lt;grin&gt; typical - I say &quot;no - too hard&quot;, and Alt does about 90% of it in about 20 lines..... <p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top