winforms

How does the PropertyGrid control display two levels of nested dynamic JSON objects?

安稳与你 提交于 2021-02-11 15:02:33
问题 I have a requirement that several of my colleagues' configuration files should be displayed uniformly with the PropertyGrid control, which I have implemented with reference to the following post:https://www.codeproject.com/Articles/193462/Using-PropertyGrid-to-Display-and-Edit-Dynamic-Obj. My way is: define a ConfigObject object first, then deserialized json configuration file into ConfigObject object using JsonConvert.Convert(Newtonsoft.Json), and then assigned to the PropertyGrid

MSCHART with a transparent background

久未见 提交于 2021-02-11 15:01:18
问题 Any whay to make the background transparent of the MSCHART? thank's 回答1: You need to set the Chart background colour AND the ChartArea colour. Chart c = new Chart(); c.BackColor = Color.Transparent; c.ChartAreas.Add(new ChartArea("ChartArea1")); c.ChartAreas[0].BackColor = Color.Transparent; 回答2: maybe this help you in your .aspx file where your chart code is, look for the asp:ChartArea tag. then add BackColor = "Transparent". <asp:ChartArea Name="ChartArea1" BackColor="Transparent" </asp

A network-related or instance-specific error occurred while establishing a connection to SQL Server when starting the program on another computer

一个人想着一个人 提交于 2021-02-11 12:55:49
问题 I need help solving this problem. I created the application installer using MS Visual Studio Installer Projects and ran it on another device. There were no versions of LocalDB that installed on my computer (2016 and 2017) in the prerequisites, so I had to download the SQL Server 2017 LocalDB on another computer manually. After that, when I started the program I received the following error. Database files were automatically placed during installation in the folder Documents I changed the

How to have different opacity for multiple controls?

蓝咒 提交于 2021-02-11 12:14:45
问题 I have a problem with the opacity of some controls. So I set the form opacity to 0.3, when the form is loaded, and the problem is that it makes the other controls as tranparent as the form. Here is the code. private void Form1_Load(object sender, EventArgs e) { this.Opacity = 0.3; } By doing this, all my controls are as transparent as the form. Is there any way to have different opacity for the controls inside the form ? I don't want the other to be transparent at all. 回答1: My first

Dynamically added rows to a TableLayoutPanel are displayed on a different row position

橙三吉。 提交于 2021-02-11 08:58:22
问题 I am trying to dynamically add a TextBox to a TableLayoutPanel with the click of a Button. A Row is selected by click the mouse. Following a Row selection, a button click inserts a TextBox on the selected Row number. Problem is that after correctly displaying a TextBox 3 or 4 times on differently selected rows, further button clicks start displaying the TextBox on random rows, even if, debugging, the correct row number is shown. I need help please, here is the full code: public partial class

Use a virtual Keyboard on focused Textboxes and DataGridView Cells

最后都变了- 提交于 2021-02-11 07:38:21
问题 In my Form I have various Textboxes that I write into with an in Form keyboard I created using Buttons. I have this code in Form.Load, which uses an event handler to determine which Textbox has the Focus: For Each control As Control In Me.Controls If control.GetType.Equals(GetType(TextBox)) Then Dim textBox As TextBox = control AddHandler textBox.Enter, Sub() FocussedTextbox = textBox End If Next Then I use this on each button to write a specific character: Private Sub btnQ_Click(sender As

Use a virtual Keyboard on focused Textboxes and DataGridView Cells

扶醉桌前 提交于 2021-02-11 07:37:51
问题 In my Form I have various Textboxes that I write into with an in Form keyboard I created using Buttons. I have this code in Form.Load, which uses an event handler to determine which Textbox has the Focus: For Each control As Control In Me.Controls If control.GetType.Equals(GetType(TextBox)) Then Dim textBox As TextBox = control AddHandler textBox.Enter, Sub() FocussedTextbox = textBox End If Next Then I use this on each button to write a specific character: Private Sub btnQ_Click(sender As

Customizing Border and Button of the DateTimePicker

白昼怎懂夜的黑 提交于 2021-02-11 06:52:08
问题 Goal is to create DateTimePicker similar to the screen shot of this question. First attempt overriding OnPaint: public class MyDateTimePicker : DateTimePicker { private Image _image; public MyDateTimePicker() : base() { SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); } [Browsable(true)] public override Color BackColor { get { return base.BackColor; } set { base.BackColor = value; } } [Category("Appearance"

C# Visual - Datagridview search if textbox = cell string

≯℡__Kan透↙ 提交于 2021-02-11 06:19:29
问题 I am trying to make it so that when you enter data into DataGridView it first checks if the ID textbox contains a string that exists in the DataGridView ID column and throws an error if it finds a match. If it does not match then the system can add the data. I tried all kind of codes that people posted nothing worked. here is my latest. private void btnadd_Click(object sender, EventArgs e) { Label label25 = new Label(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0]

C# Visual - Datagridview search if textbox = cell string

瘦欲@ 提交于 2021-02-11 06:19:15
问题 I am trying to make it so that when you enter data into DataGridView it first checks if the ID textbox contains a string that exists in the DataGridView ID column and throws an error if it finds a match. If it does not match then the system can add the data. I tried all kind of codes that people posted nothing worked. here is my latest. private void btnadd_Click(object sender, EventArgs e) { Label label25 = new Label(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0]