How can I convert a string length to a pixel unit?

前端 未结 5 522
时光取名叫无心
时光取名叫无心 2020-11-30 04:17

I have a string like this:

string s = \"This is my string\";

I am creating a Telerik report and I need to define a textbox tha

5条回答
  •  感动是毒
    2020-11-30 04:47

    In this case, I usually use a dirty, but simple way:

    • I add an invisible Label that its AutoSize property is true -dirty work-.
    • When I want to have the Width for a specific string, I set it to the Label.Text.
    • The Width of the Label will give me the correct value.

提交回复
热议问题