How to prevent RichTextBox to change alignment automatically? - vb.net

I am programming a text editor and I use richtextboxes.
In one of the richtextboxes I need the text aligned to the right, so I use:
RTB.SelectAll()
RTB.SelectionAlignment = HorizontalAlignment.Right
RTB.DeselectAll()
And it's ok, the text is horizontally aligned to the right. The problem is when I do any change (for example, pasting some text or any other change) all the text in that RichTextBox gets automatically aligned to the left again (originally it was left aligned).
What should I modify to prevent the text to align again to the left after I have applied right alignment?
Thanks.

Related

VB forms: Is there a way of having a constant comma in the middle of a text box that can't be edited

I want to have a text box which allows you to enter the size of a grid, like the width and height. I want the text box to have a comma in the center so you can put the width on the left of it and the height on the right. (width,height)
How can I add this comma in and make it so it can't be changed by the user and acts as a divider between the values of the width and height.
You can use a MaskedTextBox rather than a TextBox, this will let you set an input mask for the required input, however you may need to fix the number of digits.

excel vba tabstrip is it possible to left align the tab captions?

I have a tabstrip, with a couple of tabs with
.style = fmTabStyleButtons
.TabOrientation = fmTabOrientationLeft
I can't seem find anything to change the alignment of the button captions. The captions are all justified within the button. With .font I can change the font, the weight and the size, but no alignment.
Is it possible at all? A solution without vba would also be ok.
Thx Kaz

Change Text Size to Fit Button

I have a bunch of buttons that are populated with multi-lines. Once they are populated I want to change the size of the text so that you can see all the text and none is cut off.
Because the amount of text changes I can't use a set Textsize
How can I tell if the button is showing all the text?

is it possible to anchor a control to another control?

Is it possible to anchor a control to another control?
Lets say i want my Button1 to keep its 4px distance from Textbox1 control without
using FlowLayoutTable control?
"Why would be this advantageous?" - one could ask
Well let's say you have a SplitContainer with a vertical splitter and you have Textboxes
in SplitContainer.Panel1 which are anchored to the left and right but their maximum size's
width is smaller than you allow to the SplitContainer.Panel1's width to have (maybe
because you want text to show up there or because additional padding or whatever,you name it)
Now let's say you also have a button next to Textbox1 and you dont want Textbox1 to be
overlapped by the Button1 because its extends to far.
If i want to have my textbox fill the SplitContainer.Panel1 in a fashion that it leaves space for
Button1 control while still both of them are anchored to the right how would i do it?
I extensively use TableLayoutPanels and FlowLayoutPanels to accomplish this. For you specific circumstance I would use a TableLayoutPanel with three columns and a row for each TextBox.
Column 1: Auto-width, contains Labels all with AutoSize = True.
Column 2: 100% width, contains TextBoxes all with Anchor = Left, Right.
Column 3: Auto-width, contains the Button in the appropriate row.
Next, I set all text boxes, except for the one next to the button, ColumnSpan = 2. Then just put the TableLayoutPanel in the SplitPanel and set Dock = Fill.
it will be a sequence in live which should be flow out from left and keep working lets the right side should be layout.
List item safty cares should be provided.
List item all things that use in this method should be provided and be check;

Checkboxes in Rdlc Report

I am creating rdlc report and i have issue that i got some bool type object fields and now i have to show checkboxes. but there is nothing i found for this solution to show checkboxes in table.
Is there anyone who know that how i can implement that thing?
Maybe you can put image there, depend on true or false, just display different pic. LOL
If checkbox is true I set Chr(254) else show unchecked checkbox using Chr(168).
Chr(254): This is decimal value for Wingdings character 254 its shows like checked check box image.
Chr(168): This is decimal value for Wingdings character 168 its shows like rectangle box like unchecked check box image.
I had a requirement that the checkboxes have a background color. I liked the simplicity of a text-based rather than image-based approach, so I used a variation of the popular Wingdings-font method: I used a small, square textbox with a thin border and the specified background color, set it to use a bold, sans-serif font, and used this expression for the text value:
=IIf(Fields!SomeBool.Value, "X", "")
If you still want a checkmark rather than an X, you can use Wingdings 2 font and this expression:
=IIf(Fields!SomeBool.Value, Chr(80), "")
In either case, you may have to adjust the font size and/or box size to keep the result square; my first take was taller than wide because it expanded vertically to accommodate the font.
Or you can set the textbox placeholder to render tags as html and then put this html in: Or you can set the Placeholder expression to support HTML and then set up the following html code:
<font face="Wingdings 2" color="green">#Html.Raw(((char)0x51).ToString())</font>
You should put in the character of the wingdings that you want.
This way, only part of the text can be wingdings.
Wingdings 2
Finally I got solution
here is the link download the project and run it.
http://uploading.com/files/2mmf34m8/Nestle%2BNew.rar/
i have developed class and then used list to set bool variable true/false. while on other hand i used image control in rdlc report To set image.
You just need to set image path which are already in image folder.
Cheers.