winforms

Graphics.DrawImage Doesn't Always Paint The Whole Bitmap?

I have run into a strange problem when using Graphics.DrawImage. When using e.Graphics.DrawImage(Image, Point) in OnPaint to paint a bitmap 'buffer' on the control, it appears that parts of the image are omitted. The buffer is populated in a helper method which draws directly onto the Bitmap using a Graphics constructed from it. Wh...

Datagridview: How to set a cell in editing mode?

Hey guys (this one is about winforms) I need to programatly set a cell in editing mode. I know that setting that cell as CurrentCell and then call the method BeginEdit(bool), it should happen, but in my case, it doesn't. What i really want to do is, with my DGV with several columns, the user can ONLY select and also edit the first two....

Change the background color of Winform ListView headers

How can you change the background color of the Headers of a ListView? ...

VB - ListView - Change Header Height?

Useing Winform and VB.Net - how can I change the column header height? ...

Modify ApplicationSettings

Our .NET application controls measurement instruments. The application is installed and many different windows users can access it. When something changes in the system a user has to update the settings. For this we use the standard Settings features of VS2005. This means that every single user has to manually change the settings if anyt...

How to programatically (or via VS) set program Icon in non-ico format

Hi, I have a set of icons in PNG. I was able to load them into my project under Resources>Icons and I select other than ICO format. The problem is I cannot assign it to the forms since its non ICO. I tried some conversions but I was not succesful. Thanks for your advice! ...

Binding WinForms ListBox to object properties

I am doing some WinForms coding for the first time and am trying to use data bindings. I have a listbox which I bind to an array of strings from my controller object and I also want to bind the SelectedItem from the list box to another string property on the controller so I can track it. listBox.DataSource = controller.ItemNames; listB...

How to get control properties then save them to XML and load it back?

Actually I would need 4 methodes. I'm using c# .NET 3.5 and windows forms. Get ALL control properties (also sub properites like MenuItems etc.) from current form where name matches list name //don't works ok Save results to XML //don't know how to save the results Load result from XML and finally set loaded control properties from XML...

Get byte size of List<T>

Hi, Silly question, but in a winforms app Im currently working on, I would like to get the amount of bytes allocated/used by a List<[SomeObject]> held in memory (for statistical purposes). Is this possible? I have searched thru the possible options, but there is obviously no myList.GetTotalBytes() method. ...

Binding a ComboBox using a DataContext and LINQ to SQL

I have a simple SQLite database I use to track invoices. I recently decided to write an application for it as an excuse to learn LINQ. I found other questions that address this issue, but none of the solutions worked for me. Using the O/RM designer, I modeled my database similar to the following (simplified): +------------+ ...

How to resize controls seperated by a splitter beyond their container panel size?

I've got a few UserControls on a panel separated by splitters. The containing panel is set to AutoScroll. Since the Splitter control takes its parent's size into consideration when it resizes the controls it 'splits', the resizing of the UserControls inside it is limited by the panel's size. I want to be able to move the splitter down ...

Align controls to center of form in Windows Forms Designer

This is something that's been driving me up the wall: how can i get the windows forms designer to provide pixel snapping for the horizontal and vertical centers of the form I'm working on? ...

Execute a shell command from a .net application

I need to execute a shell command from my .NET app, not unlike os.execute(a little ways down on that page) in Lua. However with a cursory search i couldn't find anything, how do i do it? ...

Why context menu swallow my click event?

I have a user control, which handles mouse click event, when mouse clicked, the control highlight an contained item. it worked smoothly until i attach a context menu to it-the right mouse click opens the context menu, but the item that is supposed to be highlighted by right click doesn't work as usual. So the right-click event is swallo...

Single Document Interface [how to]

let's suppose i make an application in C#(winforms), we can run multiple instances of the same application by just running the exe[clr], i want that there should be only one instance allowed... i think its close to the defination of SDI [single document interface]... how to do it. ...

Winforms Animated background

i want the background of my winform to be animated like a animated gif in the background or a video file being played as a background or a flash movie... how to do it ...

Is it important to dispose SolidBrush and Pen?

I recently came across this VerticalLabel control on CodeProject. I notice that the OnPaint method creates but doesn't dispose Pen and SolidBrush objects. Does this matter, and if so how can I demonstrate whatever problems it can cause? EDIT This isn't a question about the IDisposable pattern in general. I understand that callers s...

How can I update and get values in Windows Forms while moving one form to other form (like cookies)?

How can I update and get values in a Windows Forms application while moving one form to other form (like cookies)? I need to update the values to some variable and again I am going to refer stored values and need to do some calculations. I have used cookies in ASP.NET but I am not able to find out the same concept in .NET Windows Forms...

Winforms - Adjust width of vertical scrollbar on CheckedListBox

I have a CheckListBox on my form but I want to make the scrollbar wider as users are using touch screens not a mouse. How can I change the scroll bar width? EDIT: I am talking about the width of the vertical scrollbar ...

How to get all controls from a form at runtime in c#?

Is there a simple way to get all controls that contains the property ".Text"? I'm able to get all "top level" controls, but my code doesn't find sub controls like menu items on all levels etc. I also tried "ctrl.HasChildren". Does somebody know how to do this in winforms at runtime? Best regards. ...