winforms

BindingSource.Filter Exclude Values - How?

My BindingSource is bound to a collection of objects (not using ADO.NET) and I would like to filter it and exclude some values but not sure if I'm using this exactly since the result set I am expecting is not coming back. I was thinking something like this, but its not working: MyBindingSource.Filter = "State = 'NY' AND State = 'MA' AN...

Slow operations in the Model-View-Presenter pattern

How do you handle slow operations in the Model-View-Presenter (or MVC or M-V-VM or whatever variant you are using)? When you have a slow operation in WinForms or SWT/JFace or whatever desktop framework you are using, you have to run it on a background thread to avoid completely locking up the application. Where do you handle this? I ca...

Mouse Wheel Event (C#)

Hi, I can't get the Mouse Wheel event in the main form. As a demo I came up with a simple example: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.panel1.MouseWheel += new MouseEventHandler(panel1_MouseWheel); this.panel1.MouseMove += new MouseEventHandler(panel1_MouseW...

Image representation suitable for both WPF and Windows Forms

When working with Windows forms and images, I deal with System.Drawing.Image descendats. When I work with WPF I deal with System.Windows.Media.Imaging.BitmapSource class. Is there a UI framework independent way of referencing a memory image? Maybe it would be a Intptr or byte array? Thank you. ...

changing Visibility to hosted winForms element in wpf application

Hi, I have ReportViewer winForms control for showing Microsoft Reports in my WPF application hosted over WindowsFormsIntegration. When the MouseDown event of my textBlock triggers, I would like it to fade lets say from 0 to 100 visability, like some other elements in my Window. It doesn't, so I was wondering is it the same for all hoste...

is it possible to edit the text in a listview column?

Is it possible to edit the text in a listview sub-item column in a report view? In other words integrate a combo box or a textbox to facilitate input ...

Testing Custom Control derived from ComboBox

I've created a control derived from ComboBox, and wish to unit test its behaviour. However, it appears to be behaving differently in my unit test to how it behaves in the real application. In the real application, the Combobox.DataSource property and the .Items sync up - in other words when I change the Combobox.DataSource the .Items l...

a Problem with Windows Help Button (EDIT-New problem)

Dear all, a strange behavior happens when install the application and then run the exe file. first let me explain my steps: 1) i added HelpProvidor and i set HelpNameSpace property to the chm file path. 2) in the form properties i set HelpNavigator on helpProvidor property to : KeywordIndex and HelpString on HelpProvidor to Use ASGA...

Image.FromHbitmap WPF equivalent

Hello. Is there a System.Drawing.Image.FromHbitmap equivalent in WPF? Also, is it possible to dispose the handle properly after creating an image? Thank you. ...

Is it possible to customize a WindowsForms ColorDialog in .NET?

Is it somehow possible to customize or subclass System.Windows.Forms.ColorDialog to add a few buttons? I know that it uses the native Windows color dialog, but is there a way to customize it from .NET? ...

How do I tell if a Drag Drop has ended in Winforms?

How do I tell is a Drag Drop has ended WinForms .net. I need to stop part of my form from refreshing it's view of data when a drag drop is in progress. I have tried using a flag but I don't seem to be capturing all the events I need to to keep the flag in sync with the progress of drag drop. Specifically I can't tell when the drag dro...

How do you deal with exceptions in UserControls constructors when using the .net Winform Designer ?

When you load an UserControl in the WinForm designer, VisualStudio executes the InitializeComponent() method of the control, but not its constructor. This really makes a difference because it's quite common to have some code in the constructor which cannot run at design time. Unfortunately, when you add an UserControl to another control...

The designer must create an instance of...cannot because the type is declared abstract

Visual Studio complains: Warning 1 The designer must create an instance of type 'RentalEase.CustomBindingNavForm' but it cannot because the type is declared as abstract. Visual Studio won't let me access the Designer for the form. The class already implements all abstract methods from the CustomBindingNavForm. CustomBindingNavForm pro...

Is there a way to get hold of the cancel event of the dialog boxes.

Is there a way in C# winform to alter the cancel button event of open or save dialog box. ...

Embedded video in WinForms (AxShockwaveFlash)

I have uploaded a couple of tutorial videos in youtube. In my winforms application (by using the AxShockwaveFlash object) i reproduce the selected video by the user. AxShockwaveFlash1.LoadMovie(http://www.youtube ..video1) Here comes the story. The first time the user selects a video, reproduction works like a charm. When the user s...

Group Box in WinForms

Hi everyone. I have a question about design winforms. Should I use, or not, group boxes in my forms? Is it good to the user? Give me some advantages, or disadvantages? Some people think thar it's not goog enough to use. What do you think about it? ...

Windows forms: how get the actual width of the item in the list box

To make sure that the text in listbox items is not truncated I want to adjust its width to the width of the item with longest text. Is there any way to get a "actual" width of the listbox item the one which is based on the item's text. ListBox.GetItemRectangle does not seem to be returning this actual width. thank you. ...

Cancel ComboBox dropdown closing

I want to cancel this operation if the user selects a specific item because I don't want to force the user to open the dropdown again. Can this be done? ...

What is best practices for printing from a WinForms application?

I am looking for best practices in regards to printing from a WinForms application. What are the pitfalls? What layout techniques work? Would it be easier to use WPF for printing (MSDN WPF Printing Overview)? In my particular case, I have an existing WinForms application that needs to be extended with printing functionality. The pro...

Adding objects to a SortedBindingList

I have a WinForm containing a DataGridView with a list of members in a group. The form contains functionality (bindingNavigator) for adding new members and changing the role of the current members. I want to be albe to sort the members and implemented this by introducing a SortedBindingList to the mix. However this has the unfortunate ef...