简体   繁体   中英

Custom MessageBox in C#

I am making a custom MessageBox in my own language (Persian). I want to know which component may I use for the text?

Label is not multiline and TextBox is a little bit not appropriate. Which component does Visual Studio use itself?

Visual Studio 消息框

What is the component I specified in the picture?

You can use a label. It has a number of options for laying out the text... One way is to set it to "AutoSize = True".

I support the answer of RQDQ, labels could be enlarged to occupy more than one line. They have a property named TextAlign. When set to LeftCenter or MiddleCenter you could simulate the behavior of text in a message box. If the text doesn't fit in a single line, the label wraps it automatically on another line. However in this case I will let the property AutoSize to its false default value.

You Can Use RichTextBox. I Use it For My Custom MessageBox And it works Correctlly

It all depends on what kind of Visual Studio project you are doing. Wpf or Silverlight or Asp.net or even windows, everything will depend upon which kind of project it is.

That looks to me like the MFC style label with an image, or in a browser it would be done with javascript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM