winforms

Google Suggestish text box (autocomplete)

What would be the best way to develop a text box that remembers the last x number of entries that were put into it. This is a standalone app written with C#. ...

When is Control.DestroyHandle called?

When is this called? More specifically, I have a control I'm creating - how can I release handles when the window is closed. In normal win32 I'd do it during wm_close - is DestroyHandle the .net equivalent? ...

Embedding flv (flash) player in windows forms

I'm trying to the the flv Flash player from here in a windows forms application. I currently have it playing 1 .flv file with no problems but I really need to be able to play multiple files. Has anyone had experienace of using the playlists that this control offers or is there a better way to do this? ...

C# Dynamic Form Controls

Using C# 2.0 what is the best way to implement dynamic form controls? I need to provide a set of controls per data object, so should i just do it manually and lay them out while increment the top value or is there a better way? ...

DefaultValue for System.Drawing.SystemColors

I have a line color property in my custom grid control. I want it to default to Drawing.SystemColors.InactiveBorder. I tried: [DefaultValue(typeof(System.Drawing.SystemColors), "InactiveBorder")] public Color LineColor { get; set; } But it doesn't seem to work. How do I do that with the default value attribute? ...

How do I hide the input caret in a System.Windows.Forms.TextBox?

I need to display a variable-length message and allow the text to be selectable. I have made the TextBox ReadOnly which does not allow the text to be edited, but the input caret is still shown. The blinking input caret is confusing. How do I hide it? ...

Windows Forms Application Performance

My app has many controls on its surface, and more are added dynamically at runtime. Although i am using tabs to limit the number of controls shown, and double-buffering too, it still flickers and stutters when it has to redraw (resize, maximize, etc). What are your tips and tricks to improve WinForms app performance? ...

I need help with a MenuStrip Error

My users are having an intermittent error when using a Windows Forms application built in VB.NET 3.5. Apparently when they click on the form and the form re-paints, a red 'X' will be painted over the MenuStrip control and the app will crash with the following error. Has anyone seen this before? Can someone point me in the right direction...

Choosing a folder with .NET 3.5

In a C# .NET 3.5 app (a mix of WinForms and WPF) I want to let the user select a folder to import a load of data from. At the moment, it's using System.Windows.Forms.FolderBrowserDialog but that's a bit lame. Mainly because you can't type the path into it (so you need to map a network drive, instead of typing a UNC path). I'd like somet...

C# Force Form Focus

So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the screen. Eventually it will be asynchronous and expose a lot of customization in the dll. For now I just want it to display properly. The problem that I am having is tha...

Showing a hint for a C# winforms edit control

I'm working on a C# winforms application (VS.NET 2008, .NET 3.5 sp 1). I have a search field on a form, and rather than have a label next to the search field I'd like to show some grey text in the background of the search field itself ('Search terms', for example). When the user starts entering text in the search field the text should di...

What's the proper way to minimize to tray a C# WinForms app?

What is the proper way to minimize a WinForms app to the system tray? I've seen hackish solutions like, "minimize, set ShowInTaskbar = false, then show your NotifyIcon." Solutions like that are hackish because the app doesn't appear to minimize to the tray like other apps, the code has to detect when to set ShowInTaskbar = true, among ...

Is there an event that triggers if the number of ListViewItems in a ListView changes? (Windows Forms)

I'd like to enable/disable some other controls based on how many items are in my ListView control. I can't find any event that would do this, either on the ListView itself or on the ListViewItemCollection. Maybe there's a way to generically watch any collection in C# for changes? I'd be happy with other events too, even ones that someti...

How to print css applied background images with the winforms webbrowser control

I am using the webbrowser control in winforms and discovered now that background images which I apply with css are not included in the printouts. Is there a way to make the webbrowser print the background of the displayed document too? Edit: Since I wanted to do this programatically, I opted for this solution: using Microsoft.Win32; ...

Change user for running windows forms program

I wrote a simple Windows Forms program in C#. I want to be able to input a windows user name and password and when I click a login button to run code run as the user I've entered as input. ...

Winforms c# - Set focus to first child control of tab page.

Say I have a Textbox nested within a TabControl. When the form loads I would like to focus on that textbox (by default the focus is set to the tabControl). Simply calling textbox1.focus() in the Load event of the form does not appear to work. I have been able to focus it by doing the following: private void frmMainLoad(object se...

Multi-Threaded splash screen in c#?

I know this question is all over the net, but I can't quite find what I am looking for and quite frankly this community seems more sophisticated than most I have seen. I want a splash screen to show while the application is loading. I have a form with a system tray control tied to it. I want the splash screen to display while this for...

Reading default application settings in C#

I have a number of application settings (in user scope) for my custom grid control. Most of them are color settings. I have a form where the user can customize these colors with a button for reverting to default color settings. By default value I mean what I set in Settings.settings at design time. Is there a way to read the default sett...

What's the state of play with "Visual Inheritance"

Hi, We have an application that has to be flexible in how it displays it's main form to the user - depending on the user, the form should be slightly different, maybe an extra button here or there, or some other nuance. In order to stop writing code to explicitly remove or add controls etc, I turned to visual inheritance to solve the p...

HTML layout for winforms

Instead of arranging controls on a winform form by specifying pixel locations, I'd like to lay it out similar to the way you'd layout a form in html. This would make it scale better (for larger fonts etc). Does anyone know of a layout library that allows you to define the form in xml and lay it out similar to html? ...