winforms

How do I show like-values in custom fields in a property grid?

I have a property grid that helps me manage all of the controls on a form. These controls are for designer-type folks, so I'm not really worried that much about the user interface... until someone selects multiple objects. I have a UITypeEditor for the "BottomDiameter" property on these common objects. It keeps track of units (meters vs...

Possible to Create ToolStripMenuItem With Both TextBox and Label?

In a WinForms .Net 2.0 application, I want to create a context menu with a ToolStripMenuItem that has both a label AND a textbox in the item itself. An example of what I am talking about can be found in Access - when viewing an Access table, the context menu has options for "Filter By Selection", "Filter Excluding Selection", and then "F...

Backgroundworker abort

Hi, I recently tried to use backgroundworker instead of "classic" threads and I'm realizing that it's causing, at least for me, more problems than solutions. I have a backgroundworker running a synchronous read (in this case from serialPort) and getting blocked around 30 seconds in 1 code line, then cancellationpending isn't the solutio...

How do I improve performance of winforms application in Mono?

I have a remoting application (2 player Magic the Gathering Game) using windows form in C# and I am seeing very poor performance in mono. One thing I can think of that might affect the performance is that I have custom images for button background and form backgrounds(.png). Moreover I heavily use card images (.jpg). Lastly I have stuck...

Event Handling With Dynamic ToolStripItem

Hello, I'm trying to dynamically add items to a toolstrip with the following code: contextMenuStrip.Items.Add(string.Format("{0} kB/s", currSpeed), null, new EventHandler(Connection.SetSpeed)); The problem is that I need to pass a parameter to Connection.SetSpeed: currSpeed (int). How can I do that? Thanks for your time. Best regard...

TextBox Validation in VB.NET and Windows Forms

I'm using the following code to validate the text entered by user. It works perfectly fine. But I want to add the backspace feature so as to allow the user to delete the wrongly entered number. I have tried a couple of things and they worked but before last digit (after the decimal point) i.e. it does not allows to delete after the numb...

Persisting form data in Win forms applications.

In a C# winforms app what is the normal way to persist the data on form that is opened by another form? I'd planned on just keeping it all on the form object but when the form is closed it seems the that form object is disposed. meaning I loose all the data. I could wrap the form up in another object which takes all the data off it but ...

How to guarantee a NotifyIcon disappears?

Hi, I'm using a NotifyIcon control in one of my child (modal) forms and it is working fine. SHowing balloon tips as expected, handling mouse events etc... It doesn't however vanish when I would expect it to. Specifically, when i exit the child form and the parent is back in control the icon still remains. It's tooltip is accessible so ...

Winforms should I multi thread or use event timer?

I currently have a thread that listens for data from the network and then runs rules on it. I then want to pass the data to the GUI. I am worried about having a deadlock in the GUI. I cant figure out were to put the mutexes on the GUI side. I am also using c# and dotnet 3.5. What I have come up with is 1) Using a timer to create an eve...

Can I suspend redrawing of a form until I have performed all updates?

Using C# and .Net 2.0, I'm using an irregularly shaped form (TransparencyKey, FormBorderStyle = None, etc...) and want to allow "normal" bordered mode. I change the back colour to default from Lime I change FormBorderStyle to FixedSingle I change the TransparencyKey to Colour.None Unfortuanately this looks a complete mess on screen wi...

How do I hide some of the default control properties at design-time (C#)?

I have a custom control that I made. It inherits from System.Windows.Forms.Control, and has several new properties that I have added. Is it possible to show my properties (TextOn and TextOff for example) instead of the default "Text" property. My control works fine, I'd just like to de-clutter the property window. ...

WPF Window created from WinForms sometimes stops redrawing

I have a borderless, topmost, clickthrough WPF window that's used to display a notification message to the user that appears and then fades away, and it's created from a WinForms app when I click a button (this is a test project). Clicking the button multiple times creates several instances of this window. Most of the time it seems to...

C# dropdownmenuitem clicked and listview editing

I have 2 questions concerning C#. 1) I have a dropdown menu with several items in them. They are clickable, but when I click one, the older clicked one stays selected. Click another and the 2 original ones stay selected, and so on. I don't want this. What I want is that when I click one of the dropdownitems, that one is that selected on...

Winforms: How can I programmatically display the last item in a C# listview when there are vertical scrollbars?

How can I programmatically display the last item in a C# listview when there are vertical scrollbars? I've studied every method associated with listviews and can't find anything. ...

How do I remove the elipsis for a custom UITypeEditor that is read-only?

I have two fields that are of the same type in my property-grid. However, one is read-only, the other is editable. Both of these fields are of a custom type, and thus have a custom UITypeEditor, which puts the elipsis ([...]) button on the field. [ CategoryAttribute("5 - Wind"), DisplayName("Factored Area"), Descriptio...

What is the best way to implement input restrictions on a TextBox in C#?

What is the most elegant way of restricting the input of a TextBox control (or anything else that comes standard with .NET 3.5) to floating point numbers? Currently, I'm doing all the heavy lifting myself by inheriting from TextBox and overriding OnKeyPress. However, I can't help but wonder if I'm reinventing the wheel. ...

Workaround for the ImageList transparency bug?

If you add an PNG image to an ImageList control and use that ImageList with a ListView or TreeView in a Windows Forms (.Net 2.) application the icons shown in the ListView have a blue "halo" around them. Eg: Does anyone know a work around that allows you to add 32bit PNGs with an Alpha channel to an ImageList and retain the transpare...

Enable/Disable BindingNavigatorItems based on selected row

I have a winForm with a dataGridView containging members of a team. These members each have an assigned role and other properties that are listed in a column in the grid but for the purpose of what I want to achieve they are irrelevant. I've also added a bindingNavigator with add, edit and delete buttons. What I would like to implement ...

Where should I create ListViewItem list when using the MVP pattern?

Hi all, I have a small application that I have written that uses the MVP pattern as follows: I created an interface called IView I implemented this interface in the Form Passed in an instance of the form as type IView into the constructor of the presenter The form contains a ListView component. The items that populates the ListView ...

Free Syntax Highlighting .NET Editor

I need incorporate a syntax highlighting editor control into my application. It is required that the control be free and native .NET code only so the Scintilla.NET control is not feasible. The reason for this is because it is a ClickOnce application. I would like answers that use WinForms or WPF. It doesn't have to be from the same vend...