Measure String inside RichTextBox Control

后端 未结 6 1019
刺人心
刺人心 2020-12-19 02:44

Can somebody please explain how I would go about measuring the string inside a richtextbox control so that the I can automatically resize the richtextbox control according t

6条回答
  •  孤城傲影
    2020-12-19 03:03

    Try calling GetPreferredSize(Size.Empty). It is defined in the Control class, and if overriden property by the RichTextBoxControl, ought to give you what you are looking for.

    If you pass something other than Size.Empty into the method, then it will use that value as a maximum constraint. Using Size.Empty means that the potential size is unbounded.

提交回复
热议问题