I am using line function to draw line in the picturebox from the x1,y1 to x2,y2. I can draw it, but I also want to write a string on top of the line.

My application is drawing a cable across with corresponded voltage,
Something like

110
-------------------------------------------

but the line will not be straight for most of the time.
If I can, I would like to be able to write string to give the information about that line.

Also, can I modify my line into something like wave? since the cable need to be flexible... but.. if I can't, I can pass on that, as long as the text is written.

Thanks

Recommended Answers

All 10 Replies

You need to use the CurrentX and CurrentY to set the position of where you want the text to be drawn...

Me.CurrentX = 1000
Me.CurrentY = 1000
Me.Print "This is a test"

Good Luck

thanks, it works perfectly :)

Also, is it possible to make the line a bit thicker?
actually I want to make the line to look like wire.
I am currently a wire wmf picture, so I can put it in a picturebox.
But is it possible to use that picture to have similar function like the line?

I am only able to write slim line with the line function.. but it doesn't look professional at all... so somehow I need to update it, appearance-wise.

Is there anyway to solve this? thanks

Hi,

Try this :

Picture1.DrawWidth = 5
Picture1.Line (100, 100)-(1000, 1000)
Picture1.DrawWidth = 1

Regards
Veena

thanks I can have a thick line now. But, is it possible to change the drawstyle? since my drawwidth is more than 1, I can only have the solid line now... and that's not really what I want..
Can we actually use our own custom drawstyle?
thanks

Hi,

In VB6, DrawStyle has no effect if Drawwidth > 1..
may be you have to load images for custom style...

Regards
Veena

Or if you are lucky enough, you could use multiple lines and have their dashes line up. Just change the point of where it starts and ends at (one pixel).

Good Luck

Hi,

You can do using API's
Check This

Regards
Veena

Thanks for a good link veena :)
I have been thinking the same think with vb5prgmr.
I might just use the wmf picture, and put it on top of my pictureboard.
But, is there a way to the streching and twisting the picture in vb6, just like the ability that visio have?

Note: I need to twist the line, to make it flexible enough for the user to avoid collision.

Thanks.. I am so confuse... is vb6 able to do these things.. even from scratch?

StretchBlt API is one thought, as is using your friends (yahoo, google, ask, asnwers, bing) to search for vb6 rotate bitmap...

Good Luck

thanks :) I would try to use vb6 to stretch it. Thanks for the info:) it is very informative

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.