winforms

C# comboBox databinding - nothing happens, then it goes back to blank

My combobox reverts to unselected, some time later thanks to the currencyManager. The databinding for the SelectedValue does not fire its parse event, the setter for the current object's bound property never fires. There are several other properties bound to the same bindingSource for their value that work. The comboBox below it, which...

multi layer screen like photoshop in .Net

Hello everybody I want to write a utility that it works like Adobe Photoshop. if you work with this product, you meet a capability that we able to create a new layer and modify it easily. now i should write a code that draw a shape in run-time and insert several other shape with own Right-Click options. I don't want specifically it, it...

My own tableheader?

I want to make a table header: The steps I have taken Made a user control Placed a TableLayoutPanel on it(this is basically a grid layout?) Added and removed the number of columns/rows I wanted Placed a label in each cell For each label set its dock to fill and borderstyle to fixedsingle However the borders are not lined up against ...

Replacement for yes/no/cancel MessageBox (C#)

I am looking for a decent replacement for the standard windows YES/NO or YES/NO/CANCEL MessageBox. I have often seen these standard dialogs misused in ways such as: "To save in plain text answer YES, or to save in html answer NO". Obviously, the text should read "Save As: and the "buttons should be labeled "Text" and "HTML". It is not...

Dynamically bind a DataRepeater (Microsoft.VisualBasic.PowerPacks)

I am using a DataRepeater to show data from a business objects on the screen. I am using windows forms in C# to accomplish this. The datasource is not available at compile time so I want to bind the datasource at runtime. Here is the simplified scenario. I'm using this business class: public class Product { private double _price; ...

Problem with Images on TreeView

I have a TreeView with ItemHeight=16 and CheckBoxes=true. I want to show images that are 8x16 pixels in size on the nodes. But when I do this, the "Plus/Minus" and "CheckBoxes" change their size (get smaller). How can I fix this? I don't want to use a 16x16 image because I don't want to loose those 8 pixels with white space. Any sugges...

Best practices for naming user controls?

I've created quite a few user controls to encapsulate GUI functionality used in multiple places in my app. I've noticed I usually have a tendency to describe the function of the control and tack "Control" on the end of the name, but not always. I'd like to standardize the naming and wanted to know if there's a best practice for naming Us...

Correct way to unbind a BindingSource from a DataGridView

I have a BindingList<> of objects, set to the DataSource of a BindingSource. This is set to the DataSource of a DataGridView. I'm concerned with not causing any potential memory leaks, so wondering if there is a preferred way to unbind these connections when I am finished with the data. I'm thinking of: datagridview.DataSource = null;...

Dynamic options dialog (using reflection)

Does anyone know of a good component (C# WinForms) which would allow creating an options (settings) form, given a custom class with a bunch of properties? I am not looking for something shiny, but something merely better than a property grid. I can easily take care of the visual part, but I simply don't want to lose time doing reflection...

Change Property Attribute Like ReadOnly at Design-Time (PropertyGrid)

Hi to all! I develop a custom control that have some field like below: ControlKind, Field1 , Field2 I want to change attribute of one of field per controlKind, Like: if controlKind == useField1, then Field1 show and Field2 hidde in properyGrid (or readonly or filter) can i do it ? Thanks in advance ...

Setting position of a Console Window opened in a WinForms App

Hi, I found some source code in this thread posted by Rex Logan here on SO : link text ... there's also some very interesting code posted in this same thread by Foredecker, but it is incomplete and complex : I'm not up enough on the 'Trace facility to know how to fully implement it ... I am able to use this Console code Rex (kindly) ...

How to determine when a PropertyGrid control is about to modify an object's property

I have a control extending PropertyGrid which allows users to set the properties of some of my program objects. These objects have an event which is raised when one of their properties changes, and the PropertyGrid subscribes to this event so that it refreshes itself when a property is changed. My problem occurs when large numbers of obj...

Enable full find-as-you-type combo box in WinForms?

The Windows Forms ComboBox control only offers partial find-as-you-type functionality - it only searches for the first letter. For example if you type "c" and "a", don't expect "California" to become selected - instead you'll land on a state starting with "a". Somehow, perhaps through Firefox, I got used to being able to find items by t...

Generic method to get a control name when moused over?

Hello, I am writing an application that I am working on a skinning feature to it. What I want to do is allow a user to create an XML document that my code will parse through and set properties of the controls on a form. This is the easy part. Where I am stuck is giving the user a way to find out the control names/types with minimal ...

OutOfMemory, but no gcroots for many objects

We are developing a rather large Windows Forms application. In several customers' computers it often crashes with OutOfMemory exception. After obtaining full memory dump of the application moments after the exception (clrdump invoked from UnhandledException handler) I analyzed it with ".NET Memory Profiler" and windbg. The Memory Profil...

trying to determine best user interface for layouts - winform button that shows dropdown

I am adding layout management to my winforms GUI which really just means that you can "Save" the current column settings with a "Key" so for example you can have "View 1" or "View 2". anyway, i dont have much real estate on the screen but i am trying to figure out the best way to: Allow you to save the current layout as a "Saved Layo...

how to show contextmenustrip when a button is clicked in the right position

i want to click on a button and have it show a contextmenustrip right below the button. it keeps showing up in the left hand side of the screen when i try pointtoacreen and top and left coordinates. any suggestions ...

c# checked listbox MouseMove vs MouseHover event handler

I am using the following MouseMove event-handler to show the text-file content as a tooltip on CheckedListBox and there is a text-file object tagged to each checkedListBoxItem. private void checkedListBox1_MouseMove(object sender, MouseEventArgs e) { int itemIndex = checkedListBox1.IndexFromPoint(new Point(e.X, e.Y))...

Toolstripbutton text gets cut off in contextmenustrip

i am instantiating my own ToolStripButton and adding it to a contextmenustrip it pops up but the text gets cut off: string[] layouts = new string[]{"Test 1", "test 2", "test 3"} List<ToolStripButton> items = new List<ToolStripButton>(); foreach (string layout in layouts) { ToolStripBu...

Stopping TextBox flicker during update

My WinForms application has a TextBox that I'm using as a log file. I'm appending text without the form flickering using TextBox.AppendText(string);, however when I try to purge old text (as the control's .Text property reaches the .MaxLength limit), I get awful flicker. The code I'm using is as follows: public static void AddTextToCo...