All Questions
1,309 questions
1
vote
2
answers
78
views
How to disable text selection on a TreeView (WinForms .NET)
I am creating a custom treeview control for my winform application. In doing this, I noticed that there is a really annoying feature of the treeview I am having trouble removing.
Upon selecting a node ...
0
votes
1
answer
66
views
Add label in run-time using Controls.Add() in a 'for' loop
So I am trying to add labels to count things in order on a C# Winform.
The code is like this:
private void button2_Click(object sender, EventArgs e)
{
Label[] labels = new Label[n];
string[] ...
0
votes
0
answers
60
views
Drawing over a RichTextBox from a UserControl
I have a UserControl containing a RichTextLabel/RichTextBox. I'm using the Paint event from the UserControl to provide Debug/Design time information. This works well for normal Label instances as they ...
0
votes
1
answer
39
views
c# Winforms: Control inheritance and usage in designer
I've "created" a RichTextLabel, basically a RichTextBox with some properties for the color table and other rtf stuff. Some properties of the RichTextBox are initialized with non-default ...
0
votes
0
answers
82
views
Avoid resource leaks in WinForms controls having event handlers for the static SystemEvents.UserPreferenceChanged event
I have a WinForms control inherited from the System.Windows.Forms.Control class. This control subscribes to the SystemEvents.UserPreferenceChanged event in the control's instance constructor. Un-...
0
votes
1
answer
88
views
When the width of the column in the DataGrid is not enough, how to set it to hide the characters at the beginning of the text?
I am using DataGridView in C#/.NET 6.0/WinForms. Is there a way to change the direction of hiding the text when the column width is not enough? I want to hide the text from the beginning (left) when ...
1
vote
1
answer
60
views
Creating a sketch where part of it could be moved at runtime using the arrow keys
I have a very old software for which the source code is not available and I am not even sure what language was used to develop it. I am trying to replicate it using windows forms (C#).
I have stumbled ...
1
vote
0
answers
44
views
How can I access controls of form in another form
I'm working in a windows form application. I have two forms; in form A I have two picture box and in form B, I have a button. I want form B to show a message when I click on picturebox2 in form A and ...
0
votes
0
answers
60
views
C# Winform Change the type of row for data grid view
There is a DataGridView component in C# Winform. It's easy to change the column type to checkbox or text. I wonder that how to change the row type like that?
I tried to find on the internet but there ...
0
votes
1
answer
120
views
Logging to a dynamically created WinForms control using the configuration file with log4net
The case is as follows: I have created a custom control that represents a camera connection and its properties in which there is a ListBox. I instantiate this custom control dynamically at runtime. ...
0
votes
1
answer
142
views
'AutoSize=true' panel height not adjusting when labels become multiline
I'm currently facing an issue with a panel in my C# WinForms application. The panel is docked at the top of the form with AutoSize set to True. Within this panel, I have a TableLayoutPanel also with ...
1
vote
1
answer
96
views
How to change back color on focus tools by dynamically in c#.net desktop application
In my desktop form there are many control. I want to change back color of that active control on Focus & back to its Original color once it lost focus.
Here is my code,
public BillingMetal(Billing ...
3
votes
2
answers
4k
views
How to use Windows 10/11's Dark Theme in C# WinForm controls?
I'm trying to make a C# WinForm App with Dark Mode ability.
Windows already have 'dark themed controls' like this:
(NOTE: This is made with AutoHotkey)
And I also want to use this.
I've searched some ...
0
votes
1
answer
60
views
trying to find and use control using event without ASP
What I am trying to do is create a library of DataGridView functions that I can copy and paste AS IS into a program. For brevity all functions will reference that DataGridView as dgv.
As things stand ...
1
vote
1
answer
127
views
How do I color specific text in a RichTextBox?
So I was making a textbox and I thought that it would be cool if when the user types certain words, they'd get highlighted.
I made a function using a RichTextBox, but it colors, half the text it is ...