windows-forms-designer

The variable 'variable_name' is either undeclared or was never assigned

本小妞迷上赌 提交于 2019-11-29 04:41:45
问题 I have a question related to the error on the title. Im working with c# and Visual Studio 2010. I have a form declared as "public class FormularioGeneral : Form", which is the base for the rest of the forms in my application. When i try to access the Designer View i get this error several times, as you can see in the image: All the errors references lines inside the InitializeComponent method, where the value is assigned to a property like this one: [...] this.PanelMargenIzquierdoCapaBase

How to set FlowLayoutPanel contents at Center of Form

荒凉一梦 提交于 2019-11-28 12:58:39
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 to add and remove buttons dynamically. Reza Aghaei Perform these settings on the controls: Add your

How do you create a C# property that can subscribe to another WinForm control at design time?

大兔子大兔子 提交于 2019-11-28 12:27:04
I want to create a property in a control that will act as a viewer that will be able to connect to another non-visual control to show its current status. In this example let’s say that the viewer will simply show the status of online or offline . I want to be able to drop a non-visual control, let’s call it a Heater of type IHeater , on the form and then drop a HeaterMonitor . I want to go into the properties of the HeaterMonitor and for the custom Source property see a list of all of the IHeaters currently on the form. Selecting an instance ( Heater1 ) in the Source property would subscribe

Embed a form onto a tabcontrol in windows forms

十年热恋 提交于 2019-11-28 12:13:13
I have a tab control in a windows form and I want to be able to click on a tab and in the body area of the tab I want it to display another form as an embedded component. Is this possible? If so, can someone please provide an example or a link to an example of how to accomplish this? You are probably looking for Tabbed MDI Child Forms You can embed a Form but it's not the best choice. Better place the contents on UserControls and add that to the TabPage. Set your MainForm (Parent) as IsMDIContainer = true; Create an instance of the ChildForm and call this function: FormChild frmChild = new

Set the default value of DesignerSerializationVisibility to hidden

♀尐吖头ヾ 提交于 2019-11-28 11:44:16
问题 Is there a way to set the a default value for the attribute DesignerSerializationVisibility for all the properties of a given class? In practice, a way to switch the default behavior of black-listing the properties with a white-list approach. Thanks 回答1: My preferance You can provide default values for properties in constructor and decorate them using suitable DefaultValue attribute, then the designer will serialize them only if the value of them is different than default value. Also if you

Allow multi-line String properties in the Properties window

梦想的初衷 提交于 2019-11-28 11:20:15
I've got a Windows Form User Control with a string property for setting the text of a textbox. This string can be multi-line. I've noticed that on some controls with a text property, and instead of being forced to type in the single line property textbox, you get a little pop up where you can type multiple lines. (As a matter of fact, a Windows Forms Textbox control allows this on the Text property.) How do I enable this functionality in the properties window for the property I have designed? The following is not real code in my app, but an example of how such a property might be defined

Custom Control - Clickable link in properties box

孤者浪人 提交于 2019-11-28 10:37:34
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: 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, multiple properties or for example for just showing an about box. Example: Create a designer for your

Prevent Winforms Designer from Generating Property Values for Inherited Controls

 ̄綄美尐妖づ 提交于 2019-11-28 10:34:04
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 to change the color in the constructor of my MyGridView , without having to go through all the forms in

Custom DataGridView Column duplicates when using it in Designer

浪子不回头ぞ 提交于 2019-11-28 09:33:14
问题 I made a custom DataGridView component which has a standard DataGridViewImageColumn inside. A new property changes the visibility of the column when i don't need in in a particular table. I add the column in the constructor and update it on CellFormatting event. That is the part working like intended. When I drop the control onto a new form it shows up with the new column in it. Running the program results in two image columns in the grid. A new form just added the component and set Dock.Fill

Is there a built-in TypeConverter or UITypeEditor to edit a list of strings

扶醉桌前 提交于 2019-11-28 09:03:04
问题 I wish to know if .Net-3.5 comes with a built-in List<string> or string[] TypeConverter or UITypeEditor so that I can edit this kind of property from a property grid. 回答1: You can use [Editor("System.Windows.Forms.Design.StringArrayEditor, System.Design, [assembly version and public key token information here]", typeof(System.Drawing.Design.UITypeEditor))] 回答2: UITypeEditor for List<String> For string[] you don't need to do anything special and the property grid will use a standard dialog