|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Draw line on picture; change widthwant to change the width of the line (thicker), how can i do that?? ############################################### '************************************************************************************* ' Writes the starting position to x1 and y1. Begins drawing method (line) '************************************************************************************* Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) 'writes mouse coordinates to x2 and y2 x1 = z.x y1 = z.y lbl1 = "X1: " & z.x * scalefactor lbl2 = "Y1: " & z.y * scalefactor If Button = vbLeftButton Then Picture2.DrawMode = 10 xstart = x ystart = y xp = x yp = y End If End Sub '************************************************************************************* ' Follows the mouse coordinates and draws a line '************************************************************************************* Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = vbLeftButton Then Picture2.Line (xstart, ystart)-(xp, yp), vbBlue xp = x yp = y Picture2.Line (xstart, ystart)-(x, y), vbBlue End If End Sub '************************************************************************************* ' Writes the end position to x2 and y2. Ends the drawing method (ends line) ' Adds scalefactor to program ' Adds description to every line and writes it to excel '************************************************************************************* Private Sub Picture2_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) 'writes mouse coordinates to x2 and y2 x2 = z.x y2 = z.y Picture2.DrawMode = 13 End Sub ############################################## Can someone help me with this? Thx in advance Dennis "Dennis" <Den***@discussions.microsoft.com> wrote Change the DrawWidth property?> Hello, im using the following code the to draw a line on a picture. But i > want to change the width of the line (thicker), how can i do that?? Show quoteHide quote :FS I tried that, but the width stays the same...
Show quoteHide quote "Larry Serflaten" wrote: > > "Dennis" <Den***@discussions.microsoft.com> wrote > > Hello, im using the following code the to draw a line on a picture. But i > > want to change the width of the line (thicker), how can i do that?? > > Change the DrawWidth property? > > :FS > "Dennis" <Den***@discussions.microsoft.com> wrote Try it again? Are you sure to set it for Picture2?> I tried that, but the width stays the same... LFS Show quoteHide quote > > > Hello, im using the following code the to draw a line on a picture. But i > > > want to change the width of the line (thicker), how can i do that?? > > > > Change the DrawWidth property? On Mon, 30 May 2005 05:32:27 -0500, "Larry Serflaten"
<serfla***@usinternet.com> wrote: > Also set your ScaleMode to vbPixels>"Dennis" <Den***@discussions.microsoft.com> wrote >> I tried that, but the width stays the same... > >Try it again? Are you sure to set it for Picture2? Differences in TWIPs are invisible on even a sophisticated screen TWIPs are the visual version of Unicode Thx guys that helped.
But now i've got another problem, is it possible to draw with one stand line colour. Because now the line depends on the background. Thx in advance Dennis Show quoteHide quote "J French" wrote: > On Mon, 30 May 2005 05:32:27 -0500, "Larry Serflaten" > <serfla***@usinternet.com> wrote: > > > > >"Dennis" <Den***@discussions.microsoft.com> wrote > >> I tried that, but the width stays the same... > > > >Try it again? Are you sure to set it for Picture2? > > Also set your ScaleMode to vbPixels > > Differences in TWIPs are invisible on even a sophisticated screen > > TWIPs are the visual version of Unicode > > But now i've got another problem, is it possible to draw with one stand line The Line()() function takes a colour parameter, have you read the help?.. You may also find the Basic introduction to graphics> colour. Because now the line depends on the background. programming in VB article on my site useful which goes through all this. Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/ I thought i declared a colour parameter: "Picture2.Line (xstart, ystart)-(xp,
yp), vbBlue" Or do i have to do something else (Pset?)? Thx Dennis Show quoteHide quote "Mike D Sutton" wrote: > > But now i've got another problem, is it possible to draw with one stand line > > colour. Because now the line depends on the background. > > The Line()() function takes a colour parameter, have you read the help?.. You may also find the Basic introduction to graphics > programming in VB article on my site useful which goes through all this. > Hope this helps, > > Mike > > > - Microsoft Visual Basic MVP - > E-Mail: ED***@mvps.org > WWW: Http://EDais.mvps.org/ > > > >I thought i declared a colour parameter: "Picture2.Line (xstart, Read either the help or the article, I think you're confusing yourself.>ystart)-(xp, yp), vbBlue" > Or do i have to do something else (Pset?)? Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/ "Dennis" <Den***@discussions.microsoft.com> wrote Yes, you have to set the DrawMode properly.> I thought i declared a colour parameter: "Picture2.Line (xstart, ystart)-(xp, > yp), vbBlue" > Or do i have to do something else (Pset?)? LFS Allright, i changed the Drawmode from the picture (and line) to VBCppyPen;
"13-Copy Pen" but i see no changes. I also tried the other drawmodes but i still see no changes... Dennis Show quoteHide quote "Larry Serflaten" wrote: > > "Dennis" <Den***@discussions.microsoft.com> wrote > > I thought i declared a colour parameter: "Picture2.Line (xstart, ystart)-(xp, > > yp), vbBlue" > > Or do i have to do something else (Pset?)? > > Yes, you have to set the DrawMode properly. > > LFS > > Allright, i changed the Drawmode from the picture (and line) to VBCppyPen; Start a new project, drop a picture box on the form paste this code in (don't touch anything else!) and run:> "13-Copy Pen" but i see no changes. I also tried the other drawmodes but i > still see no changes... '*** Private Sub Picture1_Paint() Picture1.DrawWidth = 10 Picture1.Line (0, 0)-(Picture1.ScaleWidth, Picture1.ScaleHeight), vbBlue End Sub '*** I still _strongly_ recommend you read up on the literature I've directed you to previously, these issues would be very easily fixed with a basic understanding of how graphics development works.. Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/ |
|||||||||||||||||||||||