winforms

How to avoid Winforms radio button container auto grouping

The background In .Net windows forms (2.0) radio buttons are automatically grouped by their container control, whether it is a Form, Panel or GroupBox. That means that when you select one radio button, every other radio button in the same container is automatically changed to unchecked state. Now, consider the following form layout: ...

topmost window form steal focus

Hi everyone, I develop a window form application that shows message like msn alert at the right corner of desktop. I set form's topmost property to true but it steals other application's focus while I work on them. I don't want application steal the focus that is annoying. How can I solve this problem . Any suggestion? Best regards. ...

How deep does the Control.Contains method search?

I need to check whether a control is a descendant of another control. Will Control.Contains do the job, or does that only search for first-level child controls? ...

XNA - Embed DirectX control in a form?

I want to render DirectX (well, XNA) stuff to a system.windows.forms control rather than the whole window (so I can pair it with buttons and stuff). Is this possible? Which control would I use? How would I do it? I've searched the documentation but I don't know which terms I'm meant to use! ...

How to get the "friendly" OS Version Name?

Hi! I am looking for an elegant way to get the OS version like: "Windows XP Professional Service Pack 1" or "Windows Server 2008 Standard Edition" etc. Is there an elegant way of doing that? I am also interested in the processor architecture (like x86 or x64). cheers ...

Dynamically Created User Controls In C#

I am working in a C# winforms project and I have a user control which gets loaded upon its selection from a tool-strip menu. I have a dictionary lookup set to occur upon form load of the user control for other functionality. Also, when I close the user control I am just using the ".Hide();" method. I noticed that when I load the user con...

Graphically template a .NET winforms application

I created a pretty fancy winforms app for my company. We had a graphic designer create the GUI, which was a pain to implement, all graphical buttons, lots of layered backgrounds and logos, animations, etc. But now my company wants to resell it under different brands. But since I mostly coded it well, I told my higher ups I could have ...

Loading/Using Resource Dictionaries from a WinForms hosted WPF control

I have a Windows Forms application that needs to host a WPF control at runtime. I have the basic hosting and interaction complete (using an ElementHost control) and everything works fine until I try to do something that requires the WPF control to make use of some custom resource dictionaries that are defined. (The WPF control and all of...

How can I show a systray tooltip longer than 63 chars?

How can I show a systray tooltip longer than 63 chars? NotifyIcon.Text has a 63 chars limit, but I've seen that VNC Server has a longer tooltip. How can I do what VNC Server does? ...

Windows Forms listbox is overflowing when there are too many items to scroll.

Hi, I am building an indexer application based on a suffix tree, that enables me to index whole documents and search strings, substrings, etc, extremely fast. What I'm doing is entering a string in a textbox, pressing a button, and running a function that queries the suffixtree and adds the positions of all occurences of the string to a...

C# Light up button as it mouse is hovering?

When I hover my mouse over a button in my program (Vista) the button turns blue (glows), I need to improve the way I guide my users through the program so I'm considering highlighting the appropriate button indicating the next step. Does this sound the wrong way to go or acceptable? I'm presuming I can code the button to glow. Thanks ...

How does Vista generate the icon for documents associated to my application?

Can I affect the process? I have an application built in .NET 3.5 / VS2008. I have embedded multiple icons into the app with a win32 .res file. This is done in the Properties box for the Project in VS2008 - instead of specifying an .ico file, tick the box to specify a .res file. In the .res file you can have multiple icons. See here ...

Showing tab with lots of ComboBox controls is slow with WinForms

I have set up a dialog with several tabs. One of these contains twenty combo boxes, each with over 100 items, added like this : foreach (var x in collection) { string text = FormatItem (x); combo.Items.Add (text); } so there is nothing fancy at all with the items. They are plain strings and the combo boxes get filled when the ...

What is the easiest way to do Cross-Thread Winforms stuff?

To able to do proper cross-thread access I'm using a piece of code something like this : Private Delegate Sub DelSetButton(ByVal button As Button, ByVal label As String, ByVal enabled As Boolean) Private Sub SetButton(ByVal button As Button, ByVal label As String, ByVal enabled As Boolean) If InvokeRequired Then Invoke(New ...

mouse drag & drop

how to implement mouse drag&drop process example SetCursorPos(32, 32); mouse_event((uint)MouseEventFlags.RIGHTDOWN,0,0 ,0,0); mouse_event((uint)MouseEventFlags.RIGHTUP,0,0 ,0,0); SetCursorPos(38, 38); mouse_event((uint)MouseEventFlags.LEFTDOWN,0,0 ,0,0); mouse_event((uint)MouseEventFlags.LEFTUP,0,0 ,0,0); this is code for open ...

C# Winforms: Multiple top level windows and ShowDialog()

I have a Winforms application that uses show multiple top-level windows: Form1 form1 = new Form1(); form1.Show(); Form2 form2 = new Form2(); form2.Show(); Application.Run(); Inside one of the event-handlers in Form1, I would like to be able to show a modal dialog: Dialog dialog = new Dialog(); dialog.ShowDialog(form1); without susp...

Multiple slider trackbar for windows forms

Does anyone have any idea on how to create a trackbar with multiple sliders in WinForms? I would like to mark a range. Also, is it possible to offset the sliders vertically a little bit? My goal would be to have two sliders above the trackbar, and two below it. v-----------------v ________________________________________ ...

Using BackgroundWorker or Threading for high performance

Hi all, How can use BackgroundWorker or Threading for my code. I update TreeView (Winforms) and I call WCF service. Any suggestions please. Kind regards. Thanks in advance AdministradorUILogging.TrazarDebug("PanelArbolFicheros. tslGuardarArbol_Click") Dim listaFichero As New List(Of Fichero) Windows.Forms.Cursor.Current = Cursors.Wa...

How do I get a System.Windows.Form instance from its Win32 handle?

The following code implements a simple singleton that ensures only 1 instance of my application can be run. However, if another instance is started, I need to be able to grab that instance's command-line arguments, pass them to the initial instance, then terminate the second instance. The issue comes in when I'm attempting to get hold o...

Should Form.ShowDialog(IWin32Window) work with any window handle?

When using System.Windows.Forms.ShowDialog(IWin32Window) should I be able to pass in an IWin32Window representing any window handle and have it be modal with respect to that window? As part of an IE7 extension I'm trying to open a window modal with respect to an IE tab. It's not the currently selected tab, but I can get the hwnd of the ...