I have a c# form and when I put CheckBox and set text to Text&Input. 'I' should be underlined but it is underlined only when I hold ALT. Any idea how to fix it?
Put an & character in front of the character that should be the shortcut. Like
chk.Label = "&Text";
As for the actual underlining, Windows has an option to hide underlining by default until you press the ALT key.
This link may be useful in turning it on, but then this is not a programming question but a UI question.
http://answers.microsoft.com/en-us/windows/forum/windows_7-desktop/where-is-hide-underlined-letters-for-keyboard/17e253e4-3802-46d1-99d1-6563574dabe8
Note that this also applies to Windows 8.1.
Related
I'm trying to learn C# and .NET by creating a calculator app. However, I'm seeing some weird behavior with WinForms label and punctuation. My app has a series of number buttons, a "period" button for decimals, and various operators. When you press a button, I add the value to the label that is displaying the value:
displayLbl.Text += selectedButton.Text;
or
displayLbl.Text += ".";
The label has RightToLeft set to "true" to mimic the display of a typical calculator.
However, when a period first appears in the label, it appears ahead of the rest of the numbers that were added before it. For example, it will look like ".456" even though the "456" was added earlier. As soon as you add another number, the period will then appear back in its right place like "456.7".
This also happens with the negative sign (-). If you add "-478" to the label, it will appear as "478-".
This seems really buggy. Is there any way to fix this?
I set RightToLeft to "No" and then did the following and it worked beautifully:
this.displayLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
I can't understand why intellisense does't want to replace line after dot with suggestion.
I pressed Ctrl + Space, selected suggestion and I expected the eoID to be replaced by fuID. But I got item.fuIDeoID = updItem.eoID;. To complete suggestion I tried to press Enter then Tab and result was same. Can someone explain how to get item.fuID = updItem.eoID; after complete selecting suggestion?
You need to highlight the part you want replaced. Currently your cursor is in insert mode (so to speak). You need to highlight the part you want replaced, bring up intellisense, and select the replacement value.
To replace press SHIFT+TAB or SHIFT+ENTER
I have a C# program that uses an Infragistics UltraWinGrid to display comments. A comment can be multiple lines. That is, it can contain carriage return/line feeds (CRLFs). (See the upper portion of the attached screenshot.) But when the user selects the text of the comment by clicking on the cell, it loses the CRLFs. (See lower portion.) This is a problem, because comments can be very long and the user may want to copy and paste a comment somewhere else without losing the formatting.
From what I understand, this problem results because the grid uses a Windows textbox as an editor when the user clicks on a cell. Is there some way that I can either make the textbox keep the CLRFs or replace the textbox with an editor that does? Thanks.
Turns out there are a few stars that need to align for this.
Of course CellMultiLine needs to be set for the column like wnvko pointed out.
But also, you must make sure your Column Style is NOT FormattedText or FormattedTextEdit. (If that's required for editing i think you are out of luck). Just use Default style.
And finally make sure you CRLFs are actually truly CRLFs. My best suggestion is to use Environment.NewLine. If you are pulling the data from the DB, make sure you use CHAR(13) + CHAR(10) in that specific order. See Differences Between vbLf, vbCrLf & vbCr Constants
Hope this helps 4 years later. :-) But wanted to share for others since i found no solution elsewhere.
My suggestion is to use Templates. Have a look at the official Infragistics UltraWebGrid help book that is explaining in depth how to configure features like Row and Column Templates.
Go to page 74 for more information regarding the templating.
You should set CellMultiLine of the column to True. Here is how it is working when I set it in my grid
I never found a real answer to this question, but I was able to do a workaround by capturing the click event and having it open a small dialog box containing the cell text. I had the dialog box open at the point the user clicked, so that it appeared over the cell. After a few minor adjustments to take care of border conditions, it worked surprisingly well, so I'm calling this one solved. Thanks, everyone, for your suggestions.
(I cannot believe this has never been asked; most likely I failed at searching.)
Having a single line WinForms TextBox control with content in it:
When the user uses Ctrl+→ or Ctrl+←, the caret moves to the very end respectively very beginning of the content of the text box.
My goal
I want to configure the text box so that navigating with the above keys (or in addition with Shift), the caret stops at word boundaries.
E.g. when the caret is at position 0 and the user presses Ctrl+Shift+→ it would look like this:
I.e. it selects the first "word" only.
The standard behaviour is:
I.e. it selects the whole text.
Interestingly enough, the native Windows controls like e.g. in the "Run" dialog behave as described:
The address bar of Edge or Internet Explorer or even Windows Explorer also stops at word boundaries.
My question
Is it possible (maybe through P/Invoke) to configure certain stop characters for the TextBox control?
Update 1
I could think of handling keyboard events and doing this manually.
To answer your question.. definitely, but I wouldn't know how.
But
There is a control that has the behavior you're looking for, namely the RichTextBox.
It has the behavior you are asking for and has a property for disabling the default multiline behavior.
Properties to make the RichTextbox look like a regular textbox
Multiline - false
DetectUrls - false
height - 20
Note:
The richTextBox does NOT have autocomplete out of the box, like the regular textbox does.
I have a combobox on a form whose 'RightToLeft' property is set to 'Yes' - this places the drop-down arrow on the lefthand side of the control and the text is on the right as shown below.
[X__________________________My Text]
But what I would like to have is this if it's possible? And if so how do I achieve it?
[XMy Text__________________________]
Thanks for your feedback on this.
You can create a custom control and use ComboBoxRenderer to draw the arrow where you want.
Hans Passant says:
Don't use RightToLeft, it is only appropriate for RTL languages like
Arabic and Hebrew. It causes rendering problems for English text, you
haven't seen any only by accident. Try "[My Text]" for example. Every
non middle-eastern user expects the arrow on the right.
Thanks for reading.