winforms

Replace panel scrollbar with custom scrollbar

Is there a way to inject a panel with a custom scrollbar? I have the following issues with the current scrollbar: the software I create has to work on both Compact framework and full framework on the cf a touchscreen is attached and the default scrollbars aren't touchscreen-friendly On the full framework the behavior of the scrollbars...

How do I rotate a label in C#?

I want to show a label at 90 degrees (so I can put a bunch of them at the top of a table as the headings). Is there an easy way to do this? Thanks! ...

c# .net close of form causes parent to minimize

I have an issue where the parent form will minimize to the task tray (but I don't think it is loosing focus because the next form that shows, the Studio IDE, has focus ) when I close a dialog/form that was shown by calling ShowDialog(owner). The weird thing is that this doesn't happen every time. I don't see how the owner/parent parame...

C# Run Windows Form Application from Service (and in Vista)

I am writing an application in C# that needs to run as a service but also have user interaction. I understand that services have no UI, etc, so I've divided up my program into a windows form application and a service that can communicate with each other. The problem I'm having is that I need the service to make sure the windows form ap...

Threading.Timer vs. Forms.Timer

The short form of this question: When, if ever, is it appropriate to use the Forms.Timer in a multithreaded WinForms application? More specifically, I am architecting an application that uses multiple System.Threading.Timers to launch processes asynchronously, check queues containing the results of those asynchronous processes, and upda...

Winforms Combobox and Databinding

I am databinding a combobox to a DataSet, however I want to insert a single item at the top for "None". Doing: combobox.Items.Insert(0,"None"); Doesn't work, as the combobox is now expecting a DataRowView, however DataRowView doesn't have a public constructor, so I can't fake it that way. Any advice? I'm sure this is a well solved ...

Can we access a reusable DaysOfWeek control?

Just wondering if we have access to the PocketOutlook DaysOfWeek control/editor, or if anybody else has made their own for free usage. I'm looking for something exactly like what's in the Outlook Calendar appointment reoccurring pattern editor. Open Calendar Create a new Appointment Click on "Occurs", then "< Edit Pattern... >" Click ...

How can you stop a Winforms Panel from scrolling?

If you put a DataGridView that is 400 pixels high on a panel that's 300 pixels high, so that there's a scroll bar on the panel, then scroll down so that the lower half of the grid is shown, then click on a control outside the panel, then click on a line in the grid, the panel scrolls up to the top and the wrong row in the grid is selecte...

Modal operation using IMessageFilter and DoEvents

This is a Windows Forms application. I have a function which captures some mouse events modally till a condition is met. For example, I would like to wait for the user to select a point in the window's client area (or optionally cancel the operation using the Escape key) before the function returns. I am using the following structure: A...

How to change the row position of virtual mode DataGridView?

How to change the row position of virtual mode DataGridView? I am using Windows Forms. ...

Retrieving application settings after a name change?

I have a Windows forms application that contains per-user settings. I'm using Properties.Settings.Default.Upgrade() to preserve these settings between versions and everything is fine. Recently I had to change the exe name of my application, so after an upgrade, all settings revert to default values. I guess the settings system thinks ...

Exception refuses to be handled.

I tried two ways of catching unexpected unhandled exceptions: static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ErrorHandler.HandleException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(f...

Binding a ComboBox to an IList and using SelectedValue

I have a ComboBox set up as follows, where KVPList is an IList (of KeyValuePair if it matters): comboBox.DisplayMember = "Value"; comboBox.ValueMember = "Key"; comboBox.DataSource = KVPList; I then have set up a binding with SelectedValue, binding to a BindingSource (to a DataSet). For whatever reason, the combo box always turns up bl...

How to write c# service that I can also run as a winforms program?

I have a windows service written in C# that acts as a proxy for a bunch of network devices to the back end database. For testing and also to add a simulation layer to test the back end I would like to have a GUI for the test operator to be able run the simulation. Also for a striped down version to send out as a demo. The GUI and service...

Can I make DataGridView.EndEdit trigger the CellValidating event?

I'm using a DataGridView in my WinForms application. My main objective is to make the Enter key not move to the next row in the grid. I still want the enter key to validate and end edit mode. I found this FAQ entry and subclassed DataGridView to override ProcessDialogKey(). If the key pressed is Enter, I call EndEdit(), otherwise I call...

User Login technique C# Win App

HI, I am doing ERP solution in C#(2.0) windows application and SQL2005 Database.The network application communicate through Database.I used normal technique for user login and logout, keeping a status bit.My problem is that when my application interrupted with any other reason user status might not change.That will cause the user ca...

Creating custom contextmenu

I have a v simple dialog box that I would like to display as a context menu. I can catch the right click and show it as a modal dialog with no borders, if possible I would like it to look properly like the windows context menu (bar on lhs, blue border) - is there a way of doing this automatically to collect user desktop settings, (needs...

Winform - determine if mouse has left user control

Hi all, I am struggling with something that I think should be easily (ish). I have a windows form and a flowgridlayout panel at the bottom of the form. Inside this form I dynamically populate it with X number of User Controls. The controls are all the same type. The goal is when the user hoovers the mouse over the user control it op...

Opening a "known file type" into running instance of custom app - .NET

How would you open a file (that has a known file/app association in the registry) into a "running instance" of the application it's supposed to open in? An example would be, I have Excel open and I click on an XLS file.....the file opens up in the current Excel instance. I want to do this for a custom application...how does the eventing/...

Winforms WPF interop performance

My project requires a background thread to initiate the creation of a WPF control hosted in a Winform. The creation of said control must be performed on the foreground thread, which is very costly and causes the UI to hang for 1 to 2.5 seconds (depending on whether this is the first time the control is created). Are there any pre creat...