winforms

Idea for reducing code redundancy with ControlArrays in C#

in VB 6.0 we had used control arrays so we had only one method to take care of all those controls and we were passing "which control" to it. but now in C#, I did not use control arrays so if in VB 6.0 I had a array of size three controls now in C# I have three different control names...so kind of I am still using that method but the only...

How do you determine the appropriate size when drawing a CheckBox?

I'm helping someone convert a huge mess of panels and 700 meticulously-placed checkboxes with something slightly more sane. My plan is to implement a custom control that uses the ControlPaint class to draw the checkboxes manually; this will make it easier to work with the data and dropping 700 GDI handles from the form will likely be a ...

C# Mouse handling / forms

So I'm new to C# and have done a few gamey projects as learning exercises. One I'm currently doing is a sort of practice run at an RTS. It's VERY basic stuff. I have a commandbutton that builds tanks; said tanks are instances of a class that contains a picturebox. Said tanks can be moved around by left clicking anywhere on the form wh...

Parameter count mismatch with Invoke?

The code block below results in the error: TargetParameterCountException was unhandled by user code. Parameter count mismatch. public void AddListViewItem(string[] Data) { if (InvokeRequired) { Invoke(new Action<string[]>(AddListViewItem), Data); } else { ListViewD...

Disabling A Form Element To Refresh?

I'm adding 50k~ish items to a list view and it refreshes each time (this is slowing it down big time). How can I disable the redrawing of the form, and enable it when it's done adding all of the items? ...

How do i save altered datagrid value into a datatable?

I have a dataset, and 2 datatables. Datatable1 = Combobox source (This will display a list of options) Datatable2 = DataGrid (This will display data relevant to the options in combo box) Submit Button (populate datagrid based on combo box selected value) When i select an item in combo box and click submit, it load up the relevant reco...

ActiveReports always prints last page when NewPage is set to "After"

I have an ActiveReports file with the NewPage property set to "After" in the Detail Section of my report. Every time I print, I get an extra page at the end of the report. How can I prevent this from happening? The only extra page is the last page. So I'm pretty sure this is not an issue about page margins. ...

C# library to take screenshots?

Is there a good library I can use in c# to take a screenshot/snapshot? One where I can drag and drop a region of my screen, to take a screenshot/snapshot of it? ...

Change the font size of a .net form in Windows CE 6.0 not working?

I have been tasked with modifying an existing phone application to allow it to resize to multiple resolutions. I have it resizing fine by using the Scale function but i'm still finding that the fonts are far too small when run on a high resolution Windows CE device. I am currently attempting to set the forms font to a larger size and re...

C# Winforms: Efficiently Displaying Many Controls

I'm building a control that comprises 15x15 = 225 buttons, and needs to be resizable. Because it's a grid, anchoring and docking won't work. I've tried both TableLayoutPanel as well as handling the resize event to manually place and size controls. In both cases, resizing is unacceptably slow. Suspend/Resume Layout in the resize funct...

How to display a "loading" overlay on windows forms while the form is loading its controls (or updating them) ?

I'm looking for an effective way to notify the user that a given form is currently loading (or updating) it's UI and it will take few seconds. This may occurs at initial load or at update. Since it's very intensive and modifying ui controls, this has to be done on the ui thread, and therefore blocking the user. Changing the cursor is n...

How can i make an MDI form inactive when child form is active

I placed an MDI form in my application . If i select an option from file menu as New i will have a child form loaded. My code is as follows to show the child form private void ShowNewForm(object sender, EventArgs e) { foreach (Form frm in Application.OpenForms) { if (frm.Text == "Main") { ...

Filtering at bindingsource doesn't work

I have textbox when I put phrase of description of task or id of task. I want to filter this list by text of this textbox. But when I put text into this textbox filtering doesn't work. Collection i datagridview doesn't change. What can be wrong ? public void BindData() { var emptyBindingSource = new BindingSource...

Show lot of Data in chart (Create Waveform)

hello i want to create a SoundEditro with a wave form. i want to show all samples in this wave form but samples count > 9000000 thus my program work very bad. please help me, for create a waveform that show all samples rapidly. i use from MSChart for Framework 3.5 sp1 ...

Printing Windows Form

I have inherited some code to print the contents of a form however the image produced on paper seems to have some sort of shadow/blurriness as if its tried to do anti-alasing but not done so very well and the letters are pixelated on the edges. Does anyone know a way of improving the final quality? System.Drawing.Printing.PrintDocument...

Event using generic EventHandler<> not visible in Designer

I've just noticed that if I add an event using a generic eventhandler to my UserControl, the event is not visible in the designer when I add the user control to a form. public event EventHandler<TEventArgs<int>> EventNotVisibleInDesigner; public event EventHandler EventVisibleInDesigner; Not particularly worrisome, but is this by-desi...

ReportViewer (.rdlc) light designer for WinForms

Are there any other ReportViewer designer beside the Visual Studio (with GUI of course I know that any XML/TEXT editor can change definition of .rdlc file) ? One day when I finish my rich (fat) client application at all, Ill love to try embed in report designer, so end users can do cosmetics modification of theirs report files without ha...

RepeatButton for Winforms

Is there anything like RepeatButton in Windows Forms? How can I implement same behavior using an ordinary button? ...

DateTime Picker In WinForm How To Pick Time?

I'm using a WinForm DateTime picker and it does a fantastic job of choosing dates, but I don't know how to do times. It looks like a time is associated with the value, so maybe there's a way to use this to pick a time? If there is no built in way to do this, I'll just create another box for the time and modify the DateTime value from t...

Extending UI Component Class in C#/VS2010

I've only just started using C#/VS this past week and wondered how to do something which, I think, should be quite simple: What I want to do is extend the class used by a UI component and therefore implement my own methods in it - just for one instance of a UI component though. If I was using xcode/objective c I would normally just chan...