windows-forms-designer

How to use Ninject in a Windows Forms application?

怎甘沉沦 提交于 2019-11-27 21:19:08
I have an WinForms application with this Main Form : ICountRepository countRepository; public MainForm(ICountRepository countRepository) { this.countRepository = countRepository; } public void IncrementCount() { countRepository.IncrementCount(); } but i am struggling to inject ICountRepository into the mainform. How do I do that ? Well the first steps are to switch from: var form = new MainForm(); Application.Run(form); to: var kernel = new StandardKernel( new ModuleRegisteringICountRepository()); var form = kernel.Get<MainForm>(); Application.Run(form); Perhaps a clarifying edit or two about

Reportviewer tool missing in visual studio 2017 RC

橙三吉。 提交于 2019-11-27 17:59:54
I just started to write reporting software in new version of visual studio named visual studio 2017 RC but just noticed that core reportviewing tools is missing from both windows forms and WPF application template. Can anyone tell me why the reportviewer tool is disappeared from visual studio 2017 ? Really having trouble without it . Is there any alternate to work with this tool in new visual studio ? Update : 8/7/2019 A newer version of the ReportViewer control has been released, probably coinciding with Visual Studio 2019. I was working with V150.1358.0. Following the directions in this

Displaying a collection of controls in Windows Forms

风格不统一 提交于 2019-11-27 16:22:47
I want to display something like the following :- Each row is about a process (information like PID, Parent etc.). User can check the checkbox and click Launch button to get some dynamic details about that process. The problem is that CheckedListBox control doesn't allow more than one columns and other controls like ListView (which allow multiple columns) don't allow controls like checkbox to be embedded in a columns. I want to know if there is a control which will allow me to have a list of custom controls where each custom control contains a checkbox , Some Text and Some Dynamic Text . How

How to make a DataTable from DataGridView without any Datasource?

∥☆過路亽.° 提交于 2019-11-27 14:42:57
I want to get a DataTable from DataGridView of the Grid values. In other words DataTable same as DataGridView Values Hans Olsson Might be a nicer way to do it but otherwise it would be fairly trivial to just loop through the DGV and create the DataTable manually. Something like this might work: DataTable dt = new DataTable(); foreach(DataGridViewColumn col in dgv.Columns) { dt.Columns.Add(col.Name); } foreach(DataGridViewRow row in dgv.Rows) { DataRow dRow = dt.NewRow(); foreach(DataGridViewCell cell in row.Cells) { dRow[cell.ColumnIndex] = cell.Value; } dt.Rows.Add(dRow); } You can cast the

Is there a way to auto generate controls on a form from a binding source?

孤者浪人 提交于 2019-11-27 09:51:15
When I add a binding source to my windows form, is there a quick way to populate the form with all the properties of the bound object? A drag and drop Field List, similar to that found in many report writers would be good. In Visual Studio, the Data Sources Window displays the data sources in your project. You can use Data Source Configuration Wizard to create and edit data sources from databases, services, or objects. After creating data sources in your project, you can use the Data Sources window to create data-bound controls in your user interface by dragging items from the window onto a

How to set FlowLayoutPanel contents at Center of Form

孤街浪徒 提交于 2019-11-27 07:22:52
问题 I have a few Button controls in a FlowLayoutPanel , and I want to set them precisely at middle bottom of Form . In the image below I set the Button precisely at middle by setting the FlowLayoutPanel padding manually by 400 to left. But when I try to resize or restore down the buttons wont at middle anymore because of manually set of padding. Is there anything that I can do to set the buttons in middle of FlowLayoutPanel whenever I try to resize it. I'm following the answer base on this post

Why does C# designer-generated code (like Form1.designer.cs) play havoc with Subversion?

喜欢而已 提交于 2019-11-27 05:20:07
问题 My workshop has recently switched to Subversion from SourceSafe, freeing us from automatic locks. This led to concurrent editing of the Forms, which is wonderful. But when multiple developers commit their changes, the code files created by the designer (all the files named TheFormName.designer.cs ) cause conflicts which are very difficult to resolve. As far as I can tell, this is because the code generated by the designer is heavily re-arranged whenever the user modifies it, no matter how

Custom Control - Clickable link in properties box

橙三吉。 提交于 2019-11-27 03:41:54
问题 I'm making a custom control using C#, and I need to add a link to the property box(so I can show a form once it's clicked). Here's an example: 回答1: You are looking for DesignerVerb. A designer verb is a menu command linked to an event handler. Designer verbs are added to a component's shortcut menu at design time. In Visual Studio, each designer verb is also listed, using a LinkLabel, in the Description pane of the Properties window. You can use a verb for setting value of a single property,

Prevent Winforms Designer from Generating Property Values for Inherited Controls

一世执手 提交于 2019-11-27 03:39:52
问题 I have a custom DataGridView , let's say as such: public MyGridView : DataGridView { public MyGridView() { BackgroundColor = Color.Red; } } Now, when I use this control in a project using the designer, for some reason it feels a need to also set the property in the designer.cs file. So in the designer file, I would have: this.MyGridView1.BackgroundColor = System.Drawing.Color.FromArgb((byte)(int)255, (byte)(int)0, (byte)(int)0); The problem me with this is that it prevents me from being able

How do I get which radio button is checked from a groupbox?

…衆ロ難τιáo~ 提交于 2019-11-27 02:41:52
问题 I have these groupboxes: I want to run some code according to checked true state of a radio button like: string chk = radiobutton.nme; // Name of radio button whose checked is true switch(chk) { case "Option1": // Some code break; case "Option2": // Some code break; case "Option3": // Some code break; } Is there any direct way so that I can only get the name of the checked radio button? 回答1: You can find all checked RadioButtons like var buttons = this.Controls.OfType<RadioButton>()