Home > Net >  How to get the position of the button text in WinForm?
How to get the position of the button text in WinForm?

Time:09-17

How to get the position of the button text in WinForm? That is at the upper left of the button text coordinates

CodePudding user response:

It seems only himself

 Graphics g=this. For. CreateGraphics (); 
SizeF SizeF=g. easureString (this) for the) Text, enclosing for. The Font).

CodePudding user response:

This. Button. Left//Left
This. The button on the Top//

CodePudding user response:

1st floor method can take to the size, no coordinates

CodePudding user response:

According to TextAlign count themselves

CodePudding user response:

MiddleCenter that can also calculate, but MiddleLeft TopLeft how to get the coordinates of this?

CodePudding user response:

refer to 6th floor fighter_ace response:
MiddleCenter that can also calculate, but MiddleLeft TopLeft how to get the coordinates of this?

Should is X is 0, or a fixed value

CodePudding user response:

The building Lord: why do you want to get the position of the font? What is your requirements and purpose? Button. The Left and enclosing the button. The Top can meet our requirements
  •  Tags:  
  • C#
  • Related