EDIT 2
Okay, based on the advice on the answers below I eliminated my thread approach and now my program looks like this:
program.cs
static void Main(){
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
FrmWWCShell FrmWWCShell = null;
var splash = new FrmSplash();
splash.SplashFormInitialized +...
I've got a DataGridView control in a Windows forms application. There are four columns with string data and three with DateTime data. I'm adding the rows programmatically using the Rows.Add() method. All of the columns have SortMode set to Automatic. Clicking the column headers to sort just works, except for the one DateTime column that ...
In the projects I work in, it seems the biggest problem with Merging changes is in the Windows Forms/GUI changes. We use Araxis Merge to compare the changes, but it can be hundreds of changes per file. And you have have to make notes and/or rename items to make sure you know what you are merging.
A big problem is if developers allow n...
I want to implement my own textbox (editor) with line numbers to the left of it. Well, so I am implementing the line numbers in another, narrow multiline textbox. However, I want to be able to adjust the font in the main editor and generally make it to be big size, whereas I don't want to have the line numbers to be of equally big size f...
Hello,
I am working on a datagridview in C# in windows application. I want to add textbox controls in DataGridView. So, when we run it then textbox should be shown in gridview and we can put value in it and My grid has 3 columns and I want to add new row in grid when I press tab on 3rd column of gridview.
How do I do this?
...
I'm developing my own WinForms designer. It must be able to load existing custom form types. One of the issues I hit is forms without a default ctor: My code currently instantiates the form before it can load it into the designer, which requires a default ctor.
OTOH, VS2008 is able to load such forms. I believe it doesn't actually insta...
I'm making a .NET 3.5 app with a form that draws a partially transparent black background. I'm overriding OnPaintBackground to accomplish this:
protected override void OnPaintBackground( PaintEventArgs e )
{
using ( Brush brush = new SolidBrush( Color.FromArgb( 155, Color.Black ) ) )
{
e.Graphics.FillRectangle( brush, e....
Hi,
I am drawing a string on a big bounding box and using StringFormat to align the string appropriately. However I need the actual (X, Y) location of the string once it's drawn (not just the size given by MeasureString).
I'm using the code below:
CharacterRange[] ranges = { new CharacterRange(0, this.Text.Length) };
format.SetMeasura...
Hello, I'm .net newbie starting one project for fun.
I'm using list box filled with some city names so user can pick one.
Every city class has name and UID. How do I know which city user clicked on?
Obviously, I can get text of selected item, run through city list and
find one by name but that seems stupid.
Is there equivalent to MFC S...
I have two forms, frmStudents and frmAddEditStudents.
frmStudents has a datagridview that is loaded with list of students. frmAddEditStudents can be loaded from frmStudents through buttons.
When using this code,
Dim oForm as New frmStudents
With oForm
.ShowDialog
End With
i cannot update the datagridview in this form from f...
Hey Everyone..
I have used NHibernate in web applications before. I must admit that I am still learning NHibernate and do not totally grasp the art of session management. So I would like to use NHibernate within a Win Forms application that I am writing. I hear that session management in a Forms application is a bit different. Sessions ...
I am trying to display a thumbnail inside a listbox in a Windows Form application. I've read around and seen all sorts of suggestions, but I'm looking for the simplest one. Here's the details of what I'm trying to do.
I am trying to display a thumbnail of an image AND display text next to it.
I've looked at ListViews and they don...
Hi all,
I have been working on winforms using C# in my company for quite a long time, and I have a fair experience implementing those. However, I need to change my job and work somewhere else. The market in here is mostly in need for web applications developer which I never worked with before. How difficult is it to move to using ASP.NE...
For our winforms application, we've been asked to colour invalid cells in a DataGridView in a red colour. We need to find a red colour that matches the current visual style but which is still distinctive if the user has chosen a palette with mostly reds. How do I create a colour that will match the current visual style? How do I make ...
hello,
how would i setup my controls for the following situation.
i have a parent-container for example a GroupBox.
inside this parent-container i have two similar controls like for example ListBoxes, next to each other. they both have the same size, so the border between the two of them is exactly in the middle of the groupBox.
now ...
Hello,
I'm trying to embed visual studio as a user control (to enable the user editing a generated source file). Basically most details can be found in a nice CodeProject entry Hosting EXE Applications in a WinForm project.
What bothers me is that after launching VS as a new process it takes some time before it settles down on the form....
Hello All!
Could someone please explain what the difference is between using the ISupportInitialize interface methods (BeginInit/EndInit) and using SuspendLayout/ResumeLayout?
Is ISupportInitialize ONLY used during construction/"initial" initialization... or can it be used later when you want to add new child controls to an existing pa...
I am investigating a GDI resource leak in a large application. In order to further my understanding of how these problems occur, I have created a very small application which I have deliberately made 'leaky'. Here is a simple user control which should result in the creation of 100 Pen objects:
public partial class TestControl : UserCon...
I'm using DashStyle.Dash while rendering my hierarchy of objects. My application uses Graphics.Transform extensively and I find that at some scale values (including a scale of 100%) and some angles of rotation, Graphics.DrawLine throws OutOfMemoryException when using a pen with DashStyle.Dash. Using Google I found that this is a well-kno...
From a C# application I want to activate (brint to front) a site that is already open in the users default browser. I want to do this in a browser agnostic way.
The difficult part (for me at least) is that I do not want the browser to open a new tab and the browser must not reload the page if it is already open.
I can open the URI in ...