天道酬勤,学无止境

winforms

Transparent Form with Visible Clickable Controls in it

I'm trying to make a mouse transparent form in win8 and winforms, that contains controls that are clickable. I'm able to make the form mouse transparent, using this code int initialStyle = GetWindowLong(this.Handle, -20); SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20); (on win8 the WndProc approach does not work) But when I make the form mouse transparent, the controls that are contained in this form are also mouse transparent What can I do?

2022-01-19 02:27:31    分类:问答    c#   winforms   windows-8   windows-8.1   setwindowlong

Two columns in Winforms RichTextBox

In C#, I need to be able to at least give the impression of 2 columns in a single RichTextBox. For my purposes, it could look like this: 1+1 2 70*8+5 565 1000000-300000 700000 76-10 66 For each 'question' in the left column, there will be a corresponding answer. The 'obvious' solution is to use tabs like this: SelectionTabs = new int[] { 0, 500 }; (or simply set \deftab to about 3000 in the raw Rtf). This is all well and good, until the left column input ITSELF contains tabs. When this is the case, everything goes pear-shaped. I don't mind inserting multiple tab-stops, but this won't work well

2022-01-19 01:53:44    分类:问答    c#   winforms   printing   richtextbox   wysiwyg

GetCharIndexFromPosition() for the last char

I want to get the sub-string under cursor in a RichTextBox. private void richTextBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Clicks == 1 && e.Button == MouseButtons.Left) { string wholeText = richTextBox1.Text; // Obtain the character index where the user clicks on the control. int positionBegin = richTextBox1.GetCharIndexFromPosition(new Point(e.X, e.Y)); SelectedText = wholeText.Substring(positionBegin); } For example, if I type the string World then place the cursor between l and d, the sub-string should be d. Till now my code is working, however if I place the cursor at the end

2022-01-19 01:53:23    分类:问答    c#   .net   winforms

Are there multiple ways to group radio buttons in Windows Forms?

I have a few radio buttons in my form that should all be connected, but I want one of them in a separate container to group it specifically with some other related inputs. Here is the general look: Is there a way to group the fourth radio button with the other 3 even though it is in its own group box?

2022-01-19 01:53:18    分类:问答    c#   winforms   radio-button

Stop ampersand from being turned into a mnemonic/accelerators for Windows Forms binding [duplicate]

This question already has answers here: Closed 9 years ago. Possible Duplicate: Enter “&” symbol into a text Label in Windows Forms? On a screen with label controls bound to user-filled properties, I'm getting underlined characters (mnemonics) on the label because the underlying data contains ampersands. For example, if the bound property contains "A&B Trucking", then the label shows as "AB Trucking" with the B underlined. Alt-B on the keyboard would focus that label. How do you prevent this from happening with bound controls?

2022-01-19 01:44:38    分类:问答    c#   winforms   binding

Show tooltip in LineSeries WinForms Chart?

I am working on a Dashboard System where i am using Line Chart in WinForms. I need to show the tooptip on each line. I have tried this var series = new Series { Name = chartPoint.SetName, Color = chartPoint.ChartColor, ChartType = SeriesChartType.Line, BorderDashStyle = chartPoint.ChartDashStyle, BorderWidth = chartPoint.BorderWidth, IsVisibleInLegend = !chartPoint.HideLegend, ToolTip = "Hello World" }; but its not working for me

2022-01-19 01:29:28    分类:问答    c#   winforms   mschart

Any way to clear all fields in a form at once?

i just started learning C# and i was wondering if it's possible to clear the content of all the textboxes for example in my form. I know how to clear one by one but it's not practical for me. thanks! edit: I found my answer thank you all very much

2022-01-19 01:13:20    分类:问答    c#   winforms

close windows form when users click outside

anybody have an idea how to write a code if the user clicks outside windows form, the form will automatically close? I.e., I had two forms, when i show form2 and then i click outside of it, form 2 will closed.

2022-01-19 00:59:46    分类:问答    vb.net   winforms

Simple Mdi Parent and MdiChild Winforms?

I have three forms 1 is Mdiparent and the other two is simple form (Form1 and Form2). Parent: var frmForm1 = new Form1{ MdiParent = this}; frmForm1.Show(); Form1 : var MParent = new Parent(); var frmForm2 = new Form2{ MdiParent = MParent}; frmForm2.Show(); My Problem is if i Show Form2 from Form1 it goes outside the MdiParent.

2022-01-18 22:06:59    分类:问答    c#   winforms

Multiselect DataGridView without CTRL key with no flicker?

I have a DataGridView control on a form (Form1.vb) and need to allow a user to multiselect rows without using the CTRL key (no keyboard is available - they are using a touch screen). I have enabled the mutliselect property and have the following code in my Form class. My DataGridView is called dgvOEE and I've created a List of selected rows which I add to and remove rows as they are clicked via the "CellClick" event. I then select the row via the PerformSelection routine. Private selectedRows As New List(Of DataGridViewRow) Private Sub dgvOEE_CellClick(sender As Object, e As System.Windows

2022-01-18 21:27:14    分类:问答    .net   vb.net   winforms   datagridview