winforms

Very strange Application.ThreadException behaviour.

I'm using the Application.ThreadException event to handle and log unexpected exceptions in my winforms application. Now, somewhere in my application, I've got the following code (or rather something equivalent, but this dummy code is enough to reproduce my issue) : try { throw new NullReferenceEx...

Possible to set monthCalendar to show current month and previous 2 months?

In a WinForms (3.5) application there is form with a monthCalendar control. The calendar control has a calendarDimension of 3 columns by 1 row. This means that it currently shows June, July, August of 2010. Is it possible to have the calendar to show April, May, June of 2010 instead? My dataset doesn't have any future dates so the da...

Embedding/deploying custom font in .NET app

Is there an official way to distribute (deploy) a specific font with a .NET application? We have a (public domain) "LED font" that prints numbers with the retro LED instrumentface look. This is a standard True Type or Open Type font like any other except it looks funky. Obviously for that to work, this font needs to be on the user's ma...

How to check user input for correct formatting

This is what i've come up with so far private void CheckFormatting() { StringReader objReaderf = new StringReader(txtInput.Text); List<String> formatTextList = new List<String>(); do { formatTextList.Add(objReaderf.ReadLine()); } while (objReaderf.Peek() != -1); objReaderf.Close(); for ...

Is WPF windows rendering a slower process comparing to winforms?

I am new to wpf and from what i've seen it uses reflection a lot. My question may seem silly..Are win forms drawn faster than how wpf windows are rendered(especially when working with lots of data)? ...

Cross-thread problems with .NET data binding

I have a number of Windows Forms controls which are used to interact with my program objects. Currently they subscribe to an "Updated" event on the object and manually update values when needed. I would like to replace all (or as much as possible) of this boilerplate code using data binding. The problem I'm running into is that the obje...

Debug formatting code

I'm trying to debug my code here: private void CheckFormatting() { StringReader objReaderf = new StringReader(txtInput.Text); List<String> formatTextList = new List<String>(); do { formatTextList.Add(objReaderf.ReadLine()); } ...

How do i set this window to topmost?

How do i set my window above all other? I need a bad but noticeable msg box that closes on its own. Msg is a dummy form which is empty. All i want is its title. The problems with the code is the window isnt created 0,0 (its just whereever windows feels like putting it). The width is correct but i notice if i click firefox or another app ...

Read text file into listbox collections

Hi, i'm new to C#. I need my program to show different parts of the data contained in a txt file into different listboxs (which are on different tabs of a form) so that the user can see the particular block of data they are interested in. the data contained in the txt file looks like this: G30:39:03:31 JG06 G32:56:36:10 JG04 G31:54:69...

Adding a search box to a windows forms web browser control that highlights text

I have a windows forms (using c#) application. It displays a webpage and has a textbox/botton combination which can be used to search for text displayed to the user. Currently I search the inner text of all elements for the text in the textbox. And then I weed out the elements that are redundant (for example a word could be in a 'p' and ...

C# - Launch Invisible Process (CreateNoWindow & WindowStyle not working?)

I have 2 programs (.exe) which I've created in .NET. We'll call them the Master and the Worker. The Master starts 1 or more Workers. The Worker will not be interacted with by the user, but it is a WinForms app that receives commands and runs WinForms components based on the commands it receives from the Master. I want the Worker app t...

c# winforms - scrollable panel with rectangles

Hi, I'm new to winforms and have tried to track down an answer to the following with no luck ... I have a panel in winforms and add to it a Rectangle that is wider than the panel itself. I've set the panel AutoScroll property to true however the panels horizontal scrollbar never appears. Why is this? And how do I get the scrollbar to sc...

Unable to trim the string in PrintDocument

I have some string to print on PrintDocument using its graphic object using following code, and I'm expecting if rectangle area in small to fit whole string it show trim it with ellipses but the trimming is not applied to the drawn string, is there any thing wrong in the code? (If draw string on windows form it works) PrintDocum...

Custom listbox sorting

I need to sort the data contained within a number of listboxes. The user will be able to select between two different types of sorting using radio boxes, one of which is checked by default on form load. I have created the IF statements needed in order to test whether the checked condition is true for that radio button. but i need some he...

How to control the groupbox items in .net winforms?

I am using .net winforms. I am having groupBox it contains set of controls like textbox,dropdown.... How to control the filds which is avilable in groupBox? Example: I need to clear all the contol fields. ...

CF - Set Focus to a specific control

Hi ! I have a Form that has a panel with some textBoxes and checkBox that is outside the panel. Every time the Form is loaded the checkBox has focus. I have put en event handler when form loads and tried to set focus on first textbox instead having it on the checkbox. this.Activated += new EventHandler(form_Activated); in the method...

How do I detect if a System.Windows.Forms.Label with AutoEllipsis is actually displaying ellipsis?

I have a Windows Forms Application where I display some client data in a Label. I have set label.AutoEllipsis = true. If the text is longer than the label, it looks like this: Some Text Some longe... // label.Text is actually "Some longer Text" // Full text is displayed in a tooltip which is what I want. But now I want ...

How to reference dynamically created checkedlistbox items in C#

I'm trying to see if a particular item in a checkedlistbox is checked or not. I assumed referencing the item would be: var checkBox = CheckBoxCheckedListBox1.Items[0]; But that returns an object. Casting to a CheckBox throws an exeption. Thanks! ...

How to create a clip region from a path that includes the 'outline'?

I am creating a rounded rectangle GraphicsPath (see red outline image below), and then using this as a clip region both when drawing graphics, and as the Region of a Form. Unfortunately, although the path looks good, it doesn't work well as a region (see solid black image below) Is there a way that I can generate a clipping region fro...

Detecting Idle time in a C# WinForms without Application.Idle

Hi, I have a strange issue that I'm not too sure on how to fix or address. I'm writing a mini text editor style application - RichTextBox editor. I need to do some complex parsing after the Selection changes - updating position, selection text and various other bits about the context of the text around the area. As it takes a bit of p...