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?
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.
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.
You Can Use RichTextBox. I Use it For My Custom MessageBox And it works Correctlly
Related
I am using Visual Studio 2019 in order to create a Windows Form Application. I need some titles in my application, which means these strings will not be modified by the user.
For now, I created textboxes for these titles and made these textboxes "read-only". However, this does not satisfy my aesthetical expectations.
Therefore, I wonder if there is a way to add a string without adding a textbox, to the form. Is there a way?
Thanks in advance :)
Consider using a Label control rather than a TextBox.
The only time I would use a TextBox as a label is if I want the user to be able to copy the info, and I make it borderless, readonly and have the same colour as the background of the form. It's not superb UX though as there isn't anything that screams "you can highlight and copy this text" other than an I beam cursor, which is pretty much "mystery meat navigation" - better off putting a copy button next to it if you expect the user to copy info often
Why not use Label for your titles?
Since label, by default, cannot be modified by the user, thats what you want. Textbox is used for the user input, not for the titles.
Use Label control that is the right control to use for your requirement
I want to draw a FormattedText with different rendering options. When we create for example a Label we can set its TextOptions.TextFormattingMode(Ideal/Display) and TextOptions.TextHintingMode(Auto/AntiAliasing/ClearType/Grey Scale).
I want to set hinting mode and formatting mode on my FormattedText. I think TextFormattingMode can be passed as a constructor argument but what about TextHintingMode? Is it possible to set it?
Both TextRenderingMode and TextHintingMode can only be set at the Visual level. So no, you won't be able to apply it to a specific FormattedText, only the entire control it's rendered in.
Both TextRenderingMode, TextHintingMode, TextFormatingMode (and many more) can be set in code, just like that:
TextOptions.SetTextHintingMode(myControl, TextHintingMode.Fixed);
I use it after creating the control, before adding it to the visual tree, works just fine. I don't know if setting this value for a control already in the visual tree is enough to invalidate the visual (and force a redraw).
Is there any way to replace one control with another?
I have a library from a vendor that uses a TextBox and I would like to change it to a RichTextBox.
Can I maybe set up a Style with a TargetType=TextBox and assign it to RichTextBox?
I do have access to the vendor code, but putting the replacement in the parents Resources would be much easier than updating their code each time they have a new release.
Is this even possible?
Thanks!
Without knowing more about the control(s) in question, I would recommend using the "Edit Template > Edit a copy" in VS or Blend and changing the TextBox to a RichTextBox. This should leave the rest of the template intact.
If that doesn't work, please post the ControlTemplate and/or Style code you used, and maybe a screenshot of the vendor control.
I need to create a list in c# with click-able and customizable child elements.
Check attached image (red square) to get a feeling of what I would like to end up with. I tested on a control called "list view". I can add an icon and a label, it is not enough, I need more customization.
So question: Which c# control should I use? Maybe share a link if you know something useful.
Note: I don't really know or enjoy C# (I am Java guy), as IDE I use Visual Studio C#, express edition and I would love to minimize the coding part as much as possible
First, create a user control (says ContactRow.cs)
Draw what ever UI that you need on it. (Image, text, etc)
Secondly, Create a container form (says ContactList.cs)
Add a TableLayoutPanel (Or FlowLayoutPanel Or equivalent) into container form.
Set AutoScroll property = true so that it scrolls.
In run time, you can new an instance of your ContactRow.cs and set all the values.
Then add it into the TableLayoutPanel using the TableLayoutPanel.Controls.Add(contactrow)
If I make a Statusbar, and PackEnd a Label to it, it looks something like this:
The Shadow disappears over the Label, but remains over the rest of the Statusbar. I want to remove the Shadow from the entire Statusbar. The PyGTK documentation mentions a property called shadow-type, but it's readonly, and nowhere to be found in GTK#. How do I get rid of this shadow?
You're not supposed to pack stuff into the statusbar, it's not meant as a general container.
To display text in a status bar, use its own API, i.e. gtk_statusbar_push() from C. The GTK# docs on go-mono.com seem to be offline, so I couldn't link to those right now.
shadow-type is a style property, which means it's actually supposed to be set by the user and/or desktop theme. You can set it by writing a custom style file for your application and reading it in using gtk.RcStyle.
If you have a need for two separate status messages in your application, you could also consider packing two status bars into an hbox.
The first child of a GtkStatusbar is a GtkFrame which gives the shadow border (edit: apparently not). You should be able to do this:
statusbar.get_children()[0].set_shadow_type(gtk.SHADOW_NONE)
Several apps (most notably Epiphany and, in the past, Galeon) actually replace the contents of that frame with an HBox so they can add stuff to the statusbar.