|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Drawstring question...I need to print out a string of text and obviously i'm using the
DrawString command. But the string must be placed AFTER some "programmatically generated text" (also printed using DrawString). That text would range from a single line, to maybe up to 10 lines. So i cannot hard code the position for the Drawstring command... it must come AFTER the generated text, where ever that might be. Is there any way to determine the position (x,y) of the end of the auto generated text? I could then take that value and then add a little bit to it. I'm totally stumped with this and would appreciate some help or direction. Thanks, John
Show quote
Hide quote
"johnb41" <jsbuchm***@gmail.com> wrote in message Use the MeasureString method of the Graphics object to obtain the rectangle news:1155144202.591285.306250@i3g2000cwc.googlegroups.com... >I need to print out a string of text and obviously i'm using the > DrawString command. > > But the string must be placed AFTER some "programmatically generated > text" (also printed using DrawString). That text would range from a > single line, to maybe up to 10 lines. So i cannot hard code the > position for the Drawstring command... it must come AFTER the generated > text, where ever that might be. > > Is there any way to determine the position (x,y) of the end of the auto > generated text? I could then take that value and then add a little bit > to it. > > I'm totally stumped with this and would appreciate some help or > direction. > > Thanks, > John > that contains the size of the text. Add this to the x and y positions you passed to the DrawString of the original text and voila, the ending x and y positions you want :) HTH, Mythran Thanks! I got it to work. The MeasureString method actually returns a
PointF, not a rectangle. But from that i can get the "height" which is what i need. :) John Show quoteHide quote > Use the MeasureString method of the Graphics object to obtain the rectangle > that contains the size of the text. Add this to the x and y positions you > passed to the DrawString of the original text and voila, the ending x and y > positions you want :) > > HTH, > Mythran
Show quote
Hide quote
"johnb41" <jsbuchm***@gmail.com> wrote in message Hmm, .Net 2005 ... MeasureString returns a PointF? PointF contains Height? news:1155152387.349414.136530@75g2000cwc.googlegroups.com... > Thanks! I got it to work. The MeasureString method actually returns a > PointF, not a rectangle. But from that i can get the "height" which is > what i need. :) > > John > > >> Use the MeasureString method of the Graphics object to obtain the >> rectangle >> that contains the size of the text. Add this to the x and y positions >> you >> passed to the DrawString of the original text and voila, the ending x and >> y >> positions you want :) >> >> HTH, >> Mythran > Hmm, I thought a PointF was a floating point version of a Point structure which contains 2 members, X and Y (hence, Point...since a single point in space has no physical dimensions, just a location [x and y]). Mythran Oops, my bad! It returns a SizeF, which from that you can get the
width and height properties. Not PointF, sorry! John Show quoteHide quote > Hmm, .Net 2005 ... MeasureString returns a PointF? PointF contains Height? > Hmm, I thought a PointF was a floating point version of a Point structure > which contains 2 members, X and Y (hence, Point...since a single point in > space has no physical dimensions, just a location [x and y]). > > Mythran
Show quote
Hide quote
"johnb41" <jsbuchm***@gmail.com> wrote in message Aye, makes sense :) I could have checked it out myself and would probably news:1155218380.162897.48490@p79g2000cwp.googlegroups.com... > Oops, my bad! It returns a SizeF, which from that you can get the > width and height properties. Not PointF, sorry! > > John > > >> Hmm, .Net 2005 ... MeasureString returns a PointF? PointF contains >> Height? >> Hmm, I thought a PointF was a floating point version of a Point structure >> which contains 2 members, X and Y (hence, Point...since a single point in >> space has no physical dimensions, just a location [x and y]). >> >> Mythran > wouldn't have needed this discussion. The funny thing is, I was using MeasureString extensively the other day, and it slipped my mind lol Glad it works for ya :) Mythran
Referencing Controls created at run time.
MS VB Newbie Tutorial Check to see if a server is running End all running code of .dll Dataset Class item not accessible because it's private... but it's not? Description of Function How do I send null values to an integer type variable? Writing to a file opened in another class Multi-level TreeNode storing? |
|||||||||||||||||||||||