winforms

Formatting text in WinForm Label

Is it possible to format certain text in a WinForm Label instead of breaking the text into multiple labels? Please disregard the HTML tags within the label's text; it's only used to get my point out. For example: Dim myLabel As New Label myLabel.Text = "This is <b>bold</b> text. This is <i>italicized</i> text." Which would produce ...

Simple animation in WinForms

Imagine you want to animate some object on a WinForm. You setup a timer to update the state or model, and override the paint event of the Form. But from there, what's the best way to continually repaint the Form for the animation? Invalidate the Form as soon as you are done drawing? Setup a second timer and invalidate the form on a reg...

Override tab behavior in WinForms

I have a UserControl that consists of three TextBoxes. On a form I can have one or more or my UserControl. I want to implement my own tab behavior so if the user presses Tab in the second TextBox I should only move to the third TextBox if the the second TextBox has anything entered. If nothing is entered in the second TextBox the next co...

Disabling a ListView in c#, but still showing the current selection

I have a ListView control, and I'm trying to figure out the easiest/best way to disallow changing the selected row(s), without hiding the selected row(s). I know there's a HideSelection property, but that only works when the ListView is still enabled (but not focused). I need the selection to be viewable even when the ListView is disabl...

Multiple choice on WinForms

What's the best way of implementing a multiple choice option in Windows Forms? I want to enforce a single selection from a list, starting with a default value. It seems like a ComboBox would be a good choice, but is there a way to specify a non-blank default value? I could just set it in the code at some appropriate initialisation point...

How to Disable Alt + F4 closing form?

What is the best way to disable Alt + F4 in a c# win form to prevent the user from closing the form? I am using a form as a popup dialog to display a progress bar and I do not want the user to be able to close it. Thanks. ...

Cycle Button Background Images in C#

I have a form in C# that has a button that, when clicked, I want the background image to cycle through a set of images (which I have as resources to the project). The images are named '1', '2', etc. and each time I click the button I want its background image to increment to the next one and go back to "_1" when it gets to the highest. ...

Tool in Visual Studio 2008 for helping with Localization

Hi, Does anyone have any recommendations of tools that can be of assistance with moving literal values into resource files for localization? I've used a resharper plugin called RGreatX but was wondering if there is anything else out there. It's one heck of a long manual process for moving the strings across and think there must be a b...

.Net drawing clipping bug

gdi+ DrawLines function has a clipping bug that can be reproduced by running the following c# code. When running the code two line paths appear that should be identical, because both of them are inside the clipping region, but when the clipping region is set one of the line segment is not drawn. protected override void OnPaint(PaintEv...

C# Auto Clearing Winform Textbox

I have a user that want to be able to select a textbox and have the current text selected so that he doesn't have to highlight it all in order to change the contents. The contents need to be handle when enter is pushed. That part I think I have figured out but any suggestions would be welcome. The part I need help with is that once...

C# Include Derived Control in Toolbox

This is in reference to my other question Auto Clearing Textbox. If I choose to derive a new TextBox control from TextBox instead of implement a user control just containing my Textbox, how would I include that in the toolbox. ...

How to encrypt connection string in WinForms 1.1 app.config?

Just looking for the first step basic solution here that keeps the honest people out. Thanks, Mike ...

Any recommendations for lightweight .net Win Forms HTML renderer controls?

Trying to avoid the .net WebBrowser control (I don't need to navigate to a url, print rendered html or any of the other inbuilt goodies). Wrapping the IE dll seems a bit heavyweight. I simply require something that can display basic html marked up text - an html equivalent of RichTextBox in effect. Anyone have any experiences / recomm...

Prevent WebBrowser control from swallowing exceptions

I'm using the System.Windows.Forms.WebBrowser, to make a view a la Visual Studio Start Page. However, it seems the control is catching and handling all exceptions by silently sinking them! No need to tell this is a very unfortunate behaviour. void webBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) { // WebBrowser.N...

Path Display in Label

Are there any automatic methods for trimming a path string in .NET? For example: C:\Documents and Settings\nick\My Documents\Tests\demo data\demo data.emx becomes C:\Documents...\demo data.emx It would be particularly cool if this were built into the Label class, and I seem to recall it is--can't find it though! ...

What's the best way to create ClickOnce deployments

Our team develops distributed winform apps. We use ClickOnce for deployment and are very pleased with it. However, we've found the pain point with ClickOnce is in creating the deployments. We have the standard dev/test/production environments and need to be able to create deployments for each of these that install and update separate ...

How to move a item from one menu to another?

In the Visual Studio designer, how do you move a menu item from one menu to another? I would assume DnD would work, but it seems to only work within a menu for me. I usually resort to editing the .Designer.cs files by hand. ...

Determine Loaded Assemblies

How can I determine all of the assemblies that my .NET desktop application has loaded? I'd like to put them in the about box so I can query customers over the phone to determine what version of XYZ they have on their PC. It would be nice to see both managed and unmanaged assemblies. I realize the list will get long but I plan to slap ...

C#.NET Winforms: Is it possible to override Label.Autosize ?

Hello, I don't like the AutoSize property of the Label control. I have a custom Label that draws a fancy rounded border among other things. I'm placing a AutoSize = false in my constructor, however, when I place it in design mode, the property always is True. I have overridden other properties with success but this one is happily ignor...

Is there any way to automate windows forms testing?

I am familiar with nunit for unit testing of the business layer however I am looking now to automate the test of the win forms gui layer. I have seen watin and the watin recorder for automating tests on web application by accessing the controls and automating them. However I am struggling to find a watin equivalent for windows forms (...