winforms

Multiline tooltipText

I am trying to have a tooltip on multiple lines. how do i do this? ...

Do you put unit tests in same project or another project?

Do you put unit tests in the same project for convenience or do you put them in a separate assembly? If you put them in a separate assembly like we do, we end up with a number of extra projects in the solution. It's great for unit testing while coding but how do you release the application without all of these extra assemblies? ...

Custom controls in C# Windows Forms mouse event question

I have a mouseenter and mouseleave event for a Panel control that changes the backcolor when the mouse enters and goes back to white when it leaves. I have Label control within this panel as well but when the mouse enters the Label control, the mouseleave event for the panel fires. This makes sense but how do I keep the backcolor of th...

Why does the inner exception reach the ThreadException handler and not the actual thrown exception?

I'm seeing some wierd behaviour when throwing exceptions and catching them in the Application.ThreadException event handler. Basically whats happening in the sample below is that an exception is thrown in the DoWork event handler of a BackgroundWorker. The RunWorkerCompleted event handler rethrows a new exception with the original as th...

What's the way to implement Save / Load functionality?

I'm trying to implement a Load / Save function for a winforms applications. I've got following components : A Tree View Couple of List Views Couple of Textboxes Couple of objects (which holds a big dictionarylist) I want to implement a way to save all of this into a file, and resume/load it later on. What's the best way to do this?...

user control in a selectable list - best way to do it?

Hello everyone, Working in C# win forms, I'm trying to create a list of items where each item is compromised of an icon and 3 labels in a specific layout. Here's an illustration of it (http://hosting04.imagecross.com/image-hosting-13/3535help.jpg): The user should be able to select a single row, just like in a normal Listview. My fi...

How can I sort the column headers in a datagrid alphabetically? c#

I have a sorted list that contains the column headers, how do I rearrange my datagridview so it is in the same order as my sorted list? I've tried the code below but this doesn't always work, some columns are not sorted correctly. Thanks for any help with this. sortedColumnNames.Sort(); foreach (DataGridViewColumn col in dataGridV...

Make enter key behave like tab key on form

Is there an easy way to move around controls on a form exactly the same way as the tab key? This includes moving around cells on a datagridview etc. ...

Best practices for formatting a message for MessageBox.Show(...) in Winforms for Vista

In XP/2003 I had become accustomed to writing my MessageBox.Show(..) code like this : MessageBox.Show("Title", "Sorry an error has occured!\n" + "You may want to try one of the following:\n\n" + "1. Reboot your machine\n" + "2. Buy a new machine\n" + ...

Is there an easy way to recreate the WinForms layout experience at runtime for user positioning of controls.

When laying out a WinForm in Visual Studio you get the ability to resize and align your controls very easily with drag handles and border alignment hints. I'd like to do the same with a runtime control to enable the user to position an image on a page. For example, if the user has a photo and they want to place it as a background on th...

TabControl tab headings resize when changing font

I have an application that changes the font of every control to SegoeUI when it is run in Vista. It works fine, except for headings of tabpages (the buttons to click when switching from one tab to another). Tab page headings do not grow vertically to accommodate a larger font size, they always remain the same height. Is there a proper...

I need help with scrolling on my control - c#

Hi, I've written a simple control which basically displays a few words with an image next to it. I want the containing items to strech when the parent form is resized and as you can see from my commented out code, I don't want to use a loop as it flickers. Any idea on how to get the items to grow and shrink with the form in a nice way...

Looking for a better way to change parent form's size ...

I've got a simple application that shows pictures dragged onto it. I'd like the application to resize itself according to the picture it displays. The code below does just that: // Load the picture Bitmap picture = new Bitmap(s); // Calculate the size of the main form this.Size = new Size(picture.Width + (this...

How to make my program DEP-compatible?

I have a windows forms (.net 3.0) project that won't run on my customer's vista computer due to a DEP error. It runs on my vista machine, and in a clean version of vista sp1 in a virtual machine. I am having trouble tracking down ways to make my program DEP, Data Execution Prevention compatible. I really can't do anything to end user mac...

Any frameworks on Authentication & Authorization for Windows Form Application?

I'm a C# developer. I develop both Windows & Web Applications. I would like to build an Winforms application that has a role-based system. All users must in role/group(s). Then we assign permissions like "View, Add, Update,.." to role/group. The role/group is dynamic, so we let users to define it. Is there any frameworks and good sample...

Is there any good MVC/MVP frameworks or other application frameworks for .NET Winforms?

I'm not sure why finding any frameworks or good example projects for developing windows application is so difficult. I'm sure that for web application framework, we have Castle Project or ASP.NET MVC that are very great stuffs and have many examples that follow the best practices like IoC, Caching, and etc. Is there such things that ha...

Using jQuery in WinForms desktop app?

We have a WinForms desktop application that uses the .NET 2.0 framework WebBrowser control quite extensively for displaying HTML. The HTML may be simple, or quite complicated. It may reside on disk, or it may be written directly to the document property at runtime. I was wondering if anyone had any experience with using jQuery as a lib...

.NET Winforms: Can the runtime dispose a form's handle out from under me?

The current declaration of SendMessage over at PInvoke.net is: [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam); Note: The hWnd is no longer an IntPtr, and has been replaced with HandleRef. A very loose explanation fo...

How to create a C# Winforms Control that hovers

How can you create a C# Winforms control which goes out of the bounds of its region? Such as a drop down box. Kind of like if you had a DropDownBox in a Small Sized Panel. ...

.NET WinForms ComboBox, identical items, and the SelectedIndexChanged event

...