winforms

Ribbon based GUI - Winforms vs WPF

For a new project, I'm writing an administrative tool as a client software. So far, I've only written some small winforms application with a 'old-lookin' GUI. I'm thinking of something fresh, new looking like ribbon based design. The questions that come into my mind are: 1) Should I prefer WPF over Winforms for a ribbon based GUI(thou...

DataGridView Combo column throwing an exception

I'm trying to add a Combo column to a DataGridView - when I run the program and select a combo item and try to move off of the row it throws a DataError event exception. Here's the code maybe someone can figure out a solution: public partial class Form1 : Form { public Form1() { InitializeComponent(); var nameColumn =...

Changing properties on user control based on Enabled property.

In .NET C# 3.5 Winforms, I have a user control with some simple child controls such as textboxes, labels, and buttons. Currently when I set the .Enabled property of the user control to false, the controls dim accordingly. However, if I use a custom .BackColor for the user control, sometimes the dimming is not as apparent as I would prefe...

Could not find default endpoint element ... in WCF Client.

I created a proxy Library Class in the Service Solution referencing the Contract Assembly as well and copied the libraries (Contract,Proxy) to another solution folder. Then referenced the Proxy,Contract and System.ServiceModel libraries in another class library where i need to use the one method contained, as well as adding an App.Config...

Gradient Drawing Bug

I'm having trouble with a gradient drawing call. I have a Form that looks like this. The problem is every now and again the above gradient drawing bug will start happening. It should go right across of course. Sometimes it only takes some build-rebuild-mashing to fix and it'll simply just "start" after a build every now and again. Th...

Display an image in one MenuItem without resizing the other MenuItems in a ContextMenuStrip

Hello Everyone, I have a ContextMenuStrip with two MenuItems on it. I would like to display an image on one of those items but when I do this, the other item resizes to the image scaling size of the MenuStrip, even though it does not have an image itself. Is there a way around this to just resize the item that has an image without affec...

how to stop a progress bar control from well progressing

I have a marquee style progress bar at some point I want it to stop well marqueeing I guess How do I ? this is on win7 .NET 3.5 ...

Multiline Text as the button label - WIndows Forms

Basically, i am creating a button in Oval shape. But my button label is too long to display in one line. So i wanted to split in to multiple lines. So the Oval button looks good. My Problem is, How to enable word wrap on a Button? Any suggestions? ...

C# WinForms - Cannot Access Main Form When Child Form Is Open.

Scenario I have a C# WinForms application with a main form. I also have a button on this main form, that, when clicked, creates and displays a new form. The problem.... ...Is that I cannot click on anything on the main form when the new form is open. The Question How do I solve this? Is it possible to use both forms simultaneously? ...

AutoScaleMode problems with changed default font

Hi, I have some problems with the Form.AutoScaleMode property together with fixed size controls, when using a non-default font. I boiled it down to a simple test application (WinForms 2.0) with only one form, some fixed size controls and the following properties: class Form1 : Form { // ... private void InitializeComponent() ...

WPF vs Winforms - performance no longer a major criteria?

I know this question has been asked before, but in view of .NET 4.0 and the improvements that have gone into making WPF more performant, does the community think that performance is no longer a criteria for choosing one technology over another. ...

wpf and win32 overlapping issue

I have a wpf Window, which has wpf control and windows forms control hosted in WindowsFormsHost. The expected behavior is that the WPF control should be rendered on top of WindowsFormsHost. Unfortunately, this is a limitation in the interop story, WindowsFormsHost elements are always drawn on top, and don't get affected by z-order. http...

How to find out the length(size) of scroll bar?

How to fine out the length(size) of vertical scroll bar? I have 5 pages in a document, that take 5 page down command to go to bottom.i want to find out the length of the scroll bar that the five pages are going to take in total. Is there a way i can find out the total length/size of scroll bar for that, in C#? ...

how do I read an xls file with datetime columns using OleDb

currently I am having sucsess with reading the excel file with my c# ,net 2 winform application. All works well with string and numerical types, but when it comes to date columns it still casts them as string. I have read that ado.net scans the first eight rows and then uses that to determine the datatype...I have extended my test file...

Are events in WinForms fired asynchronously?

I recognize this may be a duplicate post, but I want to make sure I ask this question clearly and get an answer based on my wording. I have a collection of forms which inherit from a common visual element: MainVisualForm. This element provides me a way to know when the form is advancing of stepping backwards. What form comes next in th...

How can I show a form without any controls focused?

I want to show a form, but I don't want any of the controls focused. For example, right now when the form is shown, the button with tabindex 0 is focused. I want the form itself, not a button, to be focused, so that if the user accidentally hits a key it won't do anything. Is this possible? Thanks! ...

Display WinForm Image in WPF application

I have a dll with quite a bit of System.Drawing.Image resources that I have wrapped into static properties so I can update them dynamically. I would like to use the images through xaml in a WPF application, but the only way I can figure is to do it through the code behind manually. Is there a way to do the winform to wpf image converti...

ListBox and Datasource - prevent first item from being selected

Hey. I've got the following code that populates my list box UsersListBox.DataSource = GrpList; However, after the box is populated, the first item in the list is selected by default and the "selected index changed" event fires. How do I prevent the item from being selected right after the list box was populated, or how do I prevent th...

C# - How to initialize gradient panel demo?

I found a web page that describes how to create a gradient panel in a WinForms application. Does anyone know how to initialize this panel demonstration? There is source code but no comments or examples how the code can be used. ...

C# - Center form based on listview coordinates?

I have a form that contains two listview controls. When I click on each listview another smaller form will appear. How do I get the smaller form to center on the calling listview control? I think it has something to with the SetBounds but I am not sure. ...