winforms

which events does BringToFront() method trigger?

故事扮演 提交于 2021-02-10 05:18:07
问题 I have two Forms, Form1 and Form2 and I want to do something in Form2 whenever I call Form2.BringToFront() in Form1. class Form1 : Form { button1_MouseClick() { Form2.BringToFront(); // trigger an event an do something in Form2 } } class Form2 : Form { UnknownEvent_EventHandler() { //do something } } But Documentation on BringToFrontMethod doesn't say which events does this method trigger. Notice I don't want to create a public method on Form2 and call it. 回答1: Well it doesn't fire one

which events does BringToFront() method trigger?

情到浓时终转凉″ 提交于 2021-02-10 05:17:12
问题 I have two Forms, Form1 and Form2 and I want to do something in Form2 whenever I call Form2.BringToFront() in Form1. class Form1 : Form { button1_MouseClick() { Form2.BringToFront(); // trigger an event an do something in Form2 } } class Form2 : Form { UnknownEvent_EventHandler() { //do something } } But Documentation on BringToFrontMethod doesn't say which events does this method trigger. Notice I don't want to create a public method on Form2 and call it. 回答1: Well it doesn't fire one

How to determine if Pressed key is Underscore Or Minus? C#

北城余情 提交于 2021-02-10 05:10:46
问题 The problem is that for both underscore and minus the keyvalue is 189, and the keycode is Keys.OemMinus. So I am unable to check whether pressed key is underscore or minus. Please Help. private void Some_KeyDown(object sender, KeyEventArgs e) { if(Pressed key is minus/dash) { MessageBox.Show("minus"); } if(pressed key is underscore) { MessageBox.Show("underscore"); } } 回答1: If this is a WinForms project, use the KeyPress event instead of the KeyDown event: private void textBox1_KeyPress

How to change the ComboBox dropdown button color

耗尽温柔 提交于 2021-02-10 04:14:08
问题 How could I change the slide button color? not border color and not slide item colors. I already change the slide item colors Is there any way to change the color? 回答1: Flat ComboBox - Change border color and Dropdown button color You need to handle WM_PAINT yourself and draw the border and the dropdown rectangle. This is the way that internal ComboBox.FlatComboAdapter class of .Net Framework works. In this post, I've created a FlatComboBox , which draws the border and the dropdown in a flat

How to change the ComboBox dropdown button color

二次信任 提交于 2021-02-10 04:14:03
问题 How could I change the slide button color? not border color and not slide item colors. I already change the slide item colors Is there any way to change the color? 回答1: Flat ComboBox - Change border color and Dropdown button color You need to handle WM_PAINT yourself and draw the border and the dropdown rectangle. This is the way that internal ComboBox.FlatComboAdapter class of .Net Framework works. In this post, I've created a FlatComboBox , which draws the border and the dropdown in a flat

How to change the ComboBox dropdown button color

瘦欲@ 提交于 2021-02-10 04:13:16
问题 How could I change the slide button color? not border color and not slide item colors. I already change the slide item colors Is there any way to change the color? 回答1: Flat ComboBox - Change border color and Dropdown button color You need to handle WM_PAINT yourself and draw the border and the dropdown rectangle. This is the way that internal ComboBox.FlatComboAdapter class of .Net Framework works. In this post, I've created a FlatComboBox , which draws the border and the dropdown in a flat

Checking the Tags of each TextBox in an array

吃可爱长大的小学妹 提交于 2021-02-09 08:17:48
问题 How do I check the Tag property of all the TextBox controls in an array? I want something like this: If textBox.Tag And textbox2.Tag And textbox21.Tag And textbox22.Tag And textbox23.Tag And textbox24.Tag = "2" Then This is my array of TextBoxes: Dim allTextboxes() As TextBox = {textBox, narNaslov, narPersona, narDani, narPersona2, kupIme, kupAdresa, kupKontakt, uvBroj, uvDatum, uvIznos, uvAvans, uvRok, uvNacin, datumTbox} 回答1: You can use the LINQ All()-Method If allTextBoxes.All(Function(t)

WinForms Dark title bar on Windows 10

醉酒当歌 提交于 2021-02-08 20:03:34
问题 I have a WinForms application which automatically adjusts to the dark/light theme on Windows 10. My problem is that the title bar of my window always stays white, regardless which theme the user selects. Top is current, bottom is how I want it (simulated with Photoshop) See explorer for example. That is not an UWP app, however it uses a dark title bar on Windows 1903 and newer (when a dark theme is selected). How can I achieve the same thing? I do not want to use any custom titlebar as I want

WinForms Dark title bar on Windows 10

删除回忆录丶 提交于 2021-02-08 20:01:08
问题 I have a WinForms application which automatically adjusts to the dark/light theme on Windows 10. My problem is that the title bar of my window always stays white, regardless which theme the user selects. Top is current, bottom is how I want it (simulated with Photoshop) See explorer for example. That is not an UWP app, however it uses a dark title bar on Windows 1903 and newer (when a dark theme is selected). How can I achieve the same thing? I do not want to use any custom titlebar as I want

Add and delete text to/from ListBox hosted in WinForm using C#

烂漫一生 提交于 2021-02-08 19:37:40
问题 I am working on a simple application that to add/delete string/s into an array and show that in ListBox. My code shows only the latest value that was typed into the textBox and private void Add_Click(object sender, EventArgs e) { string add = textBox1.Text; List<string> ls = new List<string>(); ls.Add(add); String[] terms = ls.ToArray(); List.Items.Clear(); foreach (var item in terms) { List.Items.Add(item); } } private void Delete_Click(object sender, EventArgs e) { } 回答1: This code makes no