winforms

Restore WindowState from Minimized

Is there an easy method to restore a minimized form to its previous state, either Normal or Maximized? I'm expecting the same functionality as clicking the taskbar (or right-clicking and choosing restore). So far, I have this, but if the form was previously maximized, it still comes back as a normal window. if (docView.WindowState == ...

Dependency Injection while dynamic assembly loading

i have a winforms applicatoin that has a lot of implementations of IOrderDataLoader. Other teams are starting to build their own new implementations of IOrderDataLoader. So we switched our app to look in a directories of Dlls and load all classes that implement IOrderDataLoader using reflection. This way other groups can deploy their ...

Embedding a DOS console in a windows form

Is it possible to embed a DOS console in a Windows Form or User Control in C# 2.0? We have a legacy DOS product that my Windows app has to interact with, and it's been requested that an instance of the legacy product should run within the Windows application. At the moment, I'm using the user32.dll to locate the window that the DOS pro...

Best way to hide a window from the Alt-Tab program switcher?

I've been a .NET developer for several years now and this is still one of those things I don't know how to do properly. It's easy to hide a window from the taskbar via a property in both Windows Forms and WPF, but as far as I can tell, this doesn't guarantee (or necessarily even affect) it being hidden from the Alt-Tab dialog. I've seen ...

Book Recommendation for Winforms Design & Programming

I'm looking for a book or a good resource about the following subjects : Best Practices on Windows Forms design (such best way to design GUIs -using anchors-, using default fonts, avoiding changing colours etc.) Advice about common GUI pitfalls (usability, accessibility, compatibility) Basically I've got a WinForms application and I...

Managing shared binary dependencies for multiple solutions

Ok we have a number of solutions all with a lot of shared binaries: what we do is the following. In a shared drive we have this following layout where there is a directory for every binary dependency and a sub directory for every version BinaryDep1 -----------Volatile -----------1.0 -----------1.1 -----------1.2 BinaryDep3 --------...

Stop arrow keys from scrolling through tabs on TabControl C# Winform

Basically the Title says it all, I need to keep the arrow keys from being able to scroll through my various tabs. Anyone know of a way to do this? ...

Delete in Edit menu

In a simple dialog app, using designer, I've set up the usual shortcut keys for cut, copy, paste and delete in the edit menu. My problem is that I only want to handle delete events when a certain tree control is in focus. Otherwise, in my datagrid control for example, I want delete to work as usual. What's the best way to do this? Curr...

How do I "blur" a selected ComboBox in .net windows forms?

When a ComboBox is clicked this causes it to be selected in the window. Is there a way to perform the equivalent of a javascript blur() ...

.NET WinForms: How to use an API call that requires a window handle?

Short version How do i use an API call when i cannot guarantee that the window handle will remain valid? i can guarantee that i'm holding a reference to my form (so the form is not being disposed). That doesn't guarantee that the form's handle will stay valid all that time. How can a form's window handle become invalid even though ...

Resize combobox arrow

I'm writing a touch screen .net winforms application and need a combobox with a larger dropdown arrow. Is there any way to resize the arrow, or am I looking at writing a custom control? ...

C# - cannot set form.height

I've got this code in a pair of button click event handlers on a C# form: class frmLogin { private const int SHORT_HEIGHT = 120; private const int LONG_HEIGHT = 220; private EventHandler ExpandHandler; private EventHandler ShrinkHandler; public frmLogin() { InitializeComponent(); ExpandHandler =...

How to assign a click event handler to part of a drawn rectangle?

Hi, Imagine I use the .NET graphic classes to draw a rectangle. How could I then assign an event so that if the user clicks a certain point, or a certain point range, something happens (a click event handler)? I was reading CLR via C# and the event section, and I thought of this scenario from what I had read. A code example of this w...

Best crash reporting framework for .NET desktop applications?

I've got a couple simple Windows Forms apps that I'd like to add crash reporting to. Something that will give me info on what crashes are happening on user's machines (wrt my app, of course), including stack traces, logs, and screenshots, and a UI component for asking the user whether they want to upload it, etc. My apps are free, so I'd...

FontFamily question

Why the FontFamily param of the Font object is a string and not an enum? ...

DataGridView, BindingList<T>, DataGridViewComboBoxColumn

Hello So, I have a DataGridView using as datasource a BindingList DataGridView.DataSource = new BindingList<Car>{...} Where public class Car { public ColorName Color { get; set;} } with public class ColorName { public int Id {get; set;} public string Name{get; set;} } and I use a Combobox column: DataGridViewCom...

Circular Reference

I'm looking for a good pattern to resolve the following circular reference in a Windows Form application: Assembly 1 contains a Windows Form with an Infragistics menu item ".Show"ing a Form in Assembly 2 Assembly 2 contains a Windows Form with an Infragistics menu item ".Show"ing a Form in Assembly 1 The menu has generally the same i...

Access to the path 'c:\ApplicationFolder' is denied.

I am getting a strange error on a remote windows clients (WinForm application using C# 2.0) Error Message: Access to the path 'c:\ApplicationFolder' is denied. Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 right...

Loading lots of upfront data. . sync or async . .

so i have a winforms apps that downloads a set of data syncronously on startup. This obviously takes a while but then when any of the services or GUI classes load, they all have this data. I could change this to put on a background thread but then every component that needs access to this data would continuously have to get notified wh...

Dynamic Context Menu on Treeview Nodes

Duplicate Of : http://stackoverflow.com/questions/2527/c-treeview-context-menus I've got a context menu on a Treeview, when the user right clicks it supposed to change based on the currently right clicked node's tag object. Currently I'm updating the context menu in after_select event, however this doesn't work when user right clicks t...