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

Line Box Trouble

Status
Not open for further replies.

domt

Programmer
Mar 13, 2001
115
US
I have a PictureBox on a form called Source.
The following should produce a box, right?

Private Sub Source_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
Source.DrawMode = 13
iX = X
iY = Y
End Sub

Private Sub Source_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
Source.Line (iX, iY)-(X, Y), , B
End Sub

It does, but the box is filled with a strange pattern of lines. What can be wrong?
Any help would be appreciated.
Dom
 
Hi,

Check the .FillStyle property of Source, you must have it set to diagonal lines or something! Set it to either Transparent(1) or Solid(0).

- Andy
_______________________________
&quot;On a clear disk you can seek forever&quot;
 
Hi,

Actually, thinking more, the code in MouseMove will continuously draw boxes each time you move the mouse. Maybe you should move the code into the MouseUp event so it only draws one box.

- Andy
_______________________________
&quot;On a clear disk you can seek forever&quot;
 
AndyGroom
Thanks for your response.

Actually the following does the job. You see, I want the box to be visible while it's being drawn.

Source.Autoredraw should be set to False.
DrawMode =13
Fillstyle = 1
Drawstyle = 0


Private Sub Source_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
Source.DrawMode = 13
iX = X
iY = Y
End Sub

Private Sub Source_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
Source Refresh
Source.Line (iX, iY)-(X, Y), , B
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top