windows-forms-designer

Allowing javascript to run on a windows form web browser

萝らか妹 提交于 2019-11-27 00:46:42
问题 I want to use a Web Browser to access a website that uses JavaScript on load. I understand that Web Browser is a wrapper of the current installed version of Internet Explorer. However, testing the website on Internet Explorer yields no errors but does not work if I use the Web Browser to access the content. I have also looked at my internet security settings to ensure it is enabled. The issue I get is; 回答1: Awkwardly enough, I found the answer moments after posting this but I thought anyone

Expose Columns property of a DataGridView in UserControl and make it editable via Designer

≯℡__Kan透↙ 提交于 2019-11-26 23:23:46
问题 Short description: I have a UserControl with a DataGridView on it. I want to expose the DataGridView Columns collection to the designer, so I can change the columns on my User Control at design time. Question: Which designer attributes do I need for this? For those interested in the longer version: I have a UserControl with the following features: a DataGridView that shows "pages" of items from a collection. a NumericUpdown control to select which page to show. page up / page down buttons

How to use Ninject in a Windows Forms application?

五迷三道 提交于 2019-11-26 23:02:00
问题 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 ? 回答1: Well the first steps are to switch from: var form = new MainForm(); Application.Run(form); to: var kernel = new StandardKernel( new

Show controls added programmatically in WinForms app in Design view?

孤人 提交于 2019-11-26 22:14:08
问题 Using Visual Studio (any version will do), is it possible for controls added programmatically (rather than via the Design view) to then be shown when switching back to the Design view? I've tried something ridiculously simple like: public Form1() { AddCtrl(); InitializeComponent(); AddCtrl(); } private void AddCtrl() { this.SuspendLayout(); this.Controls.Add(new TextBox()); this.ResumeLayout(false); this.PerformLayout(); } ...but to no avail. 回答1: Does the designer run my code? When a form

Custom browsable property for Form at design time

孤街醉人 提交于 2019-11-26 22:10:32
问题 I want to make a custom property for a windows form browsable during design-time but none of my efforts have panned out to success. The obvious solution would seem to be to set the browsable attribute to true: [Browsable(true), EditorBrowsable(EditorBrowsableState.Always), Description("Custom Border Colour"), Category("Custom")] public Color BorderColour { get { return bCol; } set { bCol = value; } } But this doesn't work. I have done it numerous time for custom controls and it works like a

Click event for .Net (Windows Forms) user control

允我心安 提交于 2019-11-26 21:53:49
问题 This is probably a very simple question, but for some reason, even the right way to web search for the answer eludes me... I'm trying to create a user control that consists of a few labels and progress bars. However, I want the entire control to have a "Click" event that is raised no matter what item inside the control is clicked on. I've created a "HandleClick" procedure that is assigned to each control: private void HandleClick(object sender, EventArgs e) { // Call the callback function, if

Combining multiple Attributes to a single Attribute

一曲冷凌霜 提交于 2019-11-26 17:51:33
On a control I am using multiple attribute properties: [Browsable(false)] [Bindable(false)] [EditorBrowsable(EditorBrowsableState.Never)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Obsolete("", true)] public new Boolean AllowDrop; I am using those properties on a lot of the other control properties as well. I am wondering if there is a way to reduce the amount of code to write each time. It would be nice if I could combine multiple attributes like this: [Hidden(true)] public new Boolean AllowDrop; Where the Hidden Property would include all the attributes above.

How can I get Visual Studio 2008 Windows Forms designer to render a Form that implements an abstract base class?

人盡茶涼 提交于 2019-11-26 17:04:11
I engaged a problem with inherited Controls in Windows Forms and need some advice on it. I do use a base class for items in a List (selfmade GUI list made of a panel) and some inherited controls that are for each type of data that could be added to the list. There was no problem with it, but I now found out, that it would be right, to make the base-control an abstract class, since it has methods, that need to be implemented in all inherited controls, called from the code inside the base-control, but must not and can not be implemented in the base class. When I mark the base-control as abstract

How to make a DataTable from DataGridView without any Datasource?

最后都变了- 提交于 2019-11-26 16:54:46
问题 I want to get a DataTable from DataGridView of the Grid values. In other words DataTable same as DataGridView Values 回答1: 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

Reportviewer tool missing in visual studio 2017 RC

痞子三分冷 提交于 2019-11-26 15:32:40
问题 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 ? 回答1: ** Update**: 11/19/2019 Microsoft has released a new version of the control 150.1400.0