winforms

Winforms: Write app.settings during Setup

Hi there, I've battled with modifying Configuration settings in the App.config file in the past, and gave up any hope of making it work. Now again, I find myself in the same shoes, but this time determined to sort it out! The application Im creating is a WindowsForms .NET 3.5 (SP1) app. It is to be used in a closed, networked environm...

How to get AutoSizing for forms with dynamic controls?

Hello SO-Followers, I have a Form with a TabControl on it. Onto the TabControl TabPages are dynamically added (FYI: It's about configuration settings for different dynamical loaded modules). Now I would like to have a way to get the Form - and/or the TabControl on the Form - to adjust its size according to the size of the added TabPag...

email validation in a c# winforms application

Hi how can i validate email in c# winforms ? ...

How do I make a TreeNode not visible? (C#)

Hi, There is probably a really straightforward answer to this but I'm having difficulty finding it. Simple, I have a TreeNode and I would like to make its visibility false. (or another way of not allowing it to be shown until required). Edit - Another Question? I'm confused as to how there isn't a Visible attribute but then there is ...

Sub-classing TreeView in WinForms for mouse over tool tips

Ok, this is a weird one. The expected behaviour for a TreeView control is that, if ShowNodeToolTips is set to false, then, when a label for a tree node exceeds the width of the control (or, more accurately, it's right hand edge is past the right hand edge of the client area), then a tooltip is shown above the node showing the full item'...

Windows Forms GUI Freezing while Using Socket

Currently my GUI is Freezing when I try to display data I read from my socket. It's not freezing when i display one, or two messages, only when I receive many messages(2-3 per sec). I am using async socket(non blocking). I guess it's related to how I display the data to the gui. Code: public class Globals { public static MainDial...

How to execute a method after usercontrol is fully visible

I have a usercontrol containing a textbox which i load dynamically onto a form. At the form's start up i initiate the usercontrol and set it's visibility tag to 'false'. I want to trigger a method automatically when the usercontrol becomes visible, since this method writes some output to the textbox this method should only start executin...

Invoke Google Maps API V3 Javascript API from Windows Forms app?

Google has this fine new Google Maps API v3 which is a "Javascript API". Is there any possibility to invoke this API from a Windows Forms application written in Visual C# .net 3.5? EDIT: The goal is to convert addresses to lat/long format using the Google Maps Geocoder. EDIT 2: I'd like to use v3 of the API as it doesn't require an AP...

How to enumerate hard drives and ...

I am writing a .net winforms application. I want to be able to do the following... Enumerate all of the hard drives on a system. Furthermore I would love to be able to determine which of the drives is Fixed and Which is removable. Finally, of the removable drives, I would love to be able to determine which of them is a flash (SS...

How do I make the form partially transparent when moving?

How can I set the opacity of the winform to something like 50% while moving the form by draging the title bar and reset its opacity to 100% once left mouse button is up. ...

Question on Graphics Disposal

Do I need to call Dispose() on a Graphics object obtained through PaintEventArgs in an OnPaint event? ...

WinForms: Why does my tooltip never come back?

I'm having a problem getting the tooltip on my form. Once it disappears it never seems to come back! Excerpt from the InitializeComponent method: // // toolTip // this.toolTip.AutoPopDelay = 60000; this.toolTip.InitialDelay = 500; this.toolTip.ReshowDelay = 100; After the InitializeComponent method has been called: toolTip.SetTool...

Speed up loading an image from disk in a windows forms (c#.net) app

Hi, I'm currently working on an app that allows the user to play (automatically scroll) through a series of local images. Usually there will be five or six on screen at once. The major bottleneck at the moment seems to be the actual loading of the image data from disk. A timer thread calls for the images to be updated every 1/6 of a se...

ListView Row Height Question

Good Day, I am working with a WinForms application and I need to programatically determine the height of a ListView row. I am able to determine the height of the text using Graphics.MeasureString, but there's some padding above and below the text. I am not customizing each row, I just need the height. How would I go about doing tha...

Why is OnClosing obsolete and should I migrate to OnFormClosing

I was reading the MSDN documentation for the System.Windows.Forms.Form.OnClosing() method and noticed: CAUTION: The OnClosing method is obsolete in the .NET Framework version 2.0; use the OnFormClosing method instead. I can find no reference as to why it had been marked as obsolete. I figured I would ask here: Before I wasted h...

Outlook: How to SetParent(_form.Handle, Outlook.Handle) without Paint issues?

I would like to set the top level window handle of Outlook to be the parent of a Settings form in my add-in (so it appears on top, stays in Outlook, etc). Using SetParent in other Office apps works fine, but in Outlook I get rendering errors. The form doesn't repaint correctly when Outlook is the parent (so if I drag it around or click...

Is there Delphi's ActionManager alternative in Visual Studio

I am relatively new to VS and C# but have years of experience in Delphi. One of the my favorite components when designing GUI in Delphi is ActionManager - centralized way to assign event handlers for actions as well as enabling/disabling them. Surprisingly, I can't find anything like this in Visual Studio 2008 Professional. I am sure t...

Drag and Drop between Instances of the same Windows Forms Application

I have created a small Windows Forms test application to try out some drag/drop code. The form consists of three PictureBoxes. My intention was to grab a picture from one PictureBox, display it as a custom cursor during the drag operation, then drop it on another PictureBox target. This works fine from one PictureBox to another as long ...

How do I remove a control if not a specific type?

I have a control that I need to restrict the types of child controls that it can contain during design time (dragging a new control onto an existing control on the form designer). I tried to do this by overriding the OnControlAdded event: Protected Overrides Sub OnControlAdded(ByVal e As System.Windows.Forms.ControlEventArgs) MyBase...

Decrypt (only) connection string section in Winforms app.config

Ok, I know this has been asked a thousand times before, but no conclusive solution has been derived...so here is another really silly question! I have a Winforms 3.5 app and using LINQ to SQL, hence the Connection string is ALWAYS stored in "app.config" by default (and VS2008 will not accept any other way of storing this - Ive even trie...