Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15042

VS 2019 How to center a line of text from a textbox to a label

$
0
0
Hi, I am a complete VB newbie, and have been trying to figure out how to center a line of text to a label.
The text is coming from a textbox on the form..so far I have been using something like this:

e.Graphics.DrawString(txtheading.Text, New Font("Tahoma", 6, FontStyle.Bold), Brushes.Black, 20, 10)

but what I require is for the text to be centered regardless of the number of characters that make it up.
The label is 7.5mm x 3mm, I read that I would need to set a Rectangle, with the exact dimensions, but not sure how to do this, any help would be greatly appreciated.

thanks

jedip

Viewing all articles
Browse latest Browse all 15042

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>