winforms

Looking for feedback from people that have gone from 100% web development to winforms.

I have been a web developer for my entire development career. Nearly 100% microsoft focused the entire time. I have been using .Net, both C# and VB.Net, since beta. I now find myself in a position to where I have the opportunity to start doing some WinForms development in C# using the 3.5 framework. As with anything new, I am excited abo...

Load fonts from file on a C# application

I wish to load and use a font to a desktop application in C#. It's that possible without installing the font on the system? It's a kind of question like this but not from a DLL. I want to load from font file. ...

Which .config element affects exception handling with UnhandledExceptionMode set to UnhandledExceptionMode.Automatic?

I have a Windows Forms application that has this code in the program's start up: Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic); In the MSDN Documentation for UnhandledExceptionMode.Automatic it states that: Automatic - Route all exceptions to the ThreadException handler, unless the application's confi...

UC(User component) concept in Win32/.NET Win forms.

Couple of year ago I when to work for company as web developer. It has my first Sirius web development job, (ASPx/C#) so it has very exciting and I learned a lot about that world, from the developer point of view. In that group we had a concept for the pages where loaded in the page UC’s (User controls), I don’t know if it’s the same in...

Remove selected rows from multi-column listView

I have a listview with two columns and I'm using a context menu to allow users to remove selected rows. To remove the selected rows, I've tried with the following code but it doesn't work: private void toolStripMenuItem1_Click(object sender, EventArgs e) { listView1.SelectedItems.Clear(); } I suspect this is because the listview h...

VB.NET 2005 - "Global" Event Handler?

Suppose that for every Form in a WinForms application, you want to change the cursor to the WaitCursor. The obvious way to do this would be to add the code to every place where a form is instantiated/shown: Try Me.Cursor = Cursors.WaitCursor Dim f As New frmMyForm f.Show() Catch ex As Exception Throw Finally Me.Cur...

Which windows message triggers a form's load event?

I posted this answer (more of an idea really) but haven't been able to find out for sure which message triggers a WinForms Form.Load event. From Spy++ and some reading I suggested it might be WM_SHOWWINDOW, but I'd like to be sure. Also, other than Spy++ is there a better way to see exactly which windows message triggered a .Net event?...

Display the menu for a ToolStripDropDownButton as a context menu

I have a tool strip which contains a ToolStripDropDownButton. As an alternative access method, I would also like to be able to display this button's dropdown menu as a context menu, when the user right-clicks in the area below the tool strip. I tried the following code, but it didn't work (it displayed the button's dropdown in the norma...

How transaction should be handled while using Unit of Work pattern in a WinForm application

How transaction should be handled while using Unit of Work pattern in a WinForm application Should new UOW session be created when form is initialized? Disposed when form is exited? call UOW.commit() in every save? Please advice Any articles on this topic?? ...

Data Binding - C#

Hi All, I want to bind TextBox's Text property to FolderBrowser's SelectedPath property. But it's not working, I don't know why. Please help me out why it's not working? ...

How to declare a variable/param of type "Control implementing interface ISomething"?

I wish to declare a variable in such a way as it can be assigned only values which derive from Control and also implement the ISomething interface. I intend to add the ISomething interface to derivatives of controls. I would like to derive SpecialTextBox and SpecialDatePicker From TextBox and DatePicker and implement the ISomething in...

VB.Net Winforms User Control Variable

Hi, I'm using VS 2005 in a VB.Net WinForms application. I have a custom User Control that requires a variable to render its data correctly. My question is, what's the best way to require the calling sub to populate the variable? I've thought of a couple of options: Have a WriteOnly property and check to see if it is "Nothing" when ...

I need a drag and drop control for C# winforms

I'm looking for a control for C# that can contain other controls, takes care of layout and allows drag and drop rearranging of the layout order. Simularly to the way the iphone/ipod allows you to rearrange apps. Thanks. ...

What's the name of the control that has buttons for auto-hidden windows like the one used in Visual Studio 2005/2008? (.Net)

In Visual Studio when you click the Auto-hide thumbtack looking icon the window will collapse into a band that has buttons for each hidden window for the docking area. I've seen this in other apps so I assume its a control that I haven't found or figured out how to use yet. ...

ToolStripButton with Popup Menu?

I'm doing the GUI for a paint-like program, where the user will be able to select a drawing tool from a ToolStrip. Some of these tools have variations, and I'd like the user to be able to select one via a popup menu. Anyone familiar with the Photoshop toolbar interface will know what I'm after: the user can either click the button and s...

Change Cursor HotSpot in WinForms / .NET

I'm creating a cursor at runtime from a image resource. The HotSpot of the new Cursor is always set to 16x16 (32x32 image). Is it possible to change the HotSpot at runtime or will I need to create .cur files? ...

Is there an analogue to Qt's QCanvas in Windows Forms?

I've written a Windows Forms application to solve Shikaku puzzles. At the moment, the puzzle grid is drawn on a Panel in the app's main window using a PaintEventHandler. The method called by the PaintEventHandler redraws the entire grid every time it is called. Whilst this approach works, it is flickery and inefficient, and I would li...

Broken Mono C# code using System.Windows.Forms

A couple of months back I started a relatively simple C# app which I was compiling with Mono. I try to resume work on this today, and despite having an executable proving it compiled fine before, it is now complaining about System.Windows.Forms C:\Program Files\Mono-2.0.1\bin>mcs ../projects/test_1/test.cs ../projects/test_1/tes...

How to show Selected treeview node's attribute & values in listbox & textbox respectively using C#?

Hi, I have to create a project in C# in which i have to create a XML Tree View, select a xml file from hard drive(System) it is displayed as Tree View on winform. When a user selects a particular node/element in the tree view,its attributes and values have to be displayed in list box and text box respectively. Till now i have done a pa...

Put custom control Strings into application resource

I have a custom winforms control (inherits from Component) that has some strings displayed to the user. How can I make these strings accessible so the user of the component can customize them, and - if he wants - easily put them into a resource for localization? I thought of exposing them as browsable properties so they can be customi...