windows-forms-designer

How do I force a user control to have a fixed height already when dragging it from the toolbox onto a Windows form?

假装没事ソ 提交于 2019-12-21 06:35:25
问题 I want my newly designed user control to have a certain fixed height, right when being double-clicked within or drag'n'dropped from the toolbox onto its parent form. For now, doing either does display the user control just in the height the user control's designer happened to have. When starting the application with the constituent user control, the UC is displayed in the desired height, when stopping the app, it retains that height. This is due to the following code: Private Sub UTest_Load

Designing Windows.Form with multiple panels -> How to hide one panel (like a PS layer)

老子叫甜甜 提交于 2019-12-21 02:35:13
问题 How can I hide one panel in Visual Studio 2008 Form Designer like a layer in PS? Otherwise, can someone recommend another better method to design multiple "screens" that must be clicked through by the user? 回答1: What you describe is a wizard, and you might want to investigate the approach from Eric J. However, when I have cases where I want to have multiple panels in the same space within my UI and I want to switch between them in the designer, I like to use a TabControl and hide the tabs on

Control Nesting Limits in WinForms

余生长醉 提交于 2019-12-20 02:34:37
问题 I'm creating my form's controls in the runtime, and for some reason, I need the depth to be more than 49 nested controls (i.e. control is contained in another one). but the following error appears: How can I add more controls nested in each other ? Here is a little piece of code that may reproduce the error: public partial class Form1 : Form { public Form1() { InitializeComponent(); Panel lastPanel = panel1; for (int i = 0; i < 49; i++) { Console.WriteLine(i); Panel newPanel = new Panel();

Can't edit Point[] or List<Point> at design time

半世苍凉 提交于 2019-12-20 01:08:38
问题 I'm creating custom control that will draw shape from list (or array) of points. I have basic drawing functionality done, but now I'm struggling with design-time support in Visual Studio. I've created two properties: private Point _point; public Point Point { get { return _point; } set { _point = value; } } private Point[] _points; public Point[] Points { get { return _points; } set { _points = value; } } As seen on screen below Point is editable, but editor for Points isn't working. For each

How to access controls on hosted form in a user control WinForm

一笑奈何 提交于 2019-12-19 19:59:34
问题 In visual studio how do you access a control on a form hosting a user control? For example, when text changes in a text-box in a user control, I want text in another text-box in another user control to change. Both these user controls are hosted on the same form. Thanks in advance! 回答1: If you need different UI for data entry, I prefer to have 2 controls with different UI, but I will use a single data source for them and handle the scenario using data-binding. If you bind both controls to a

How to access controls on hosted form in a user control WinForm

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 19:59:08
问题 In visual studio how do you access a control on a form hosting a user control? For example, when text changes in a text-box in a user control, I want text in another text-box in another user control to change. Both these user controls are hosted on the same form. Thanks in advance! 回答1: If you need different UI for data entry, I prefer to have 2 controls with different UI, but I will use a single data source for them and handle the scenario using data-binding. If you bind both controls to a

Windows Form Startup with Admin Permission

社会主义新天地 提交于 2019-12-19 12:20:24
问题 I have a windows form application that need of the admin permission for running, to make this, I use this code: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> The next step for complete the development is that this windows form application start up after windows restart, turn off and turn on again or user logon. Here is my problem, this application need administrator permission and need startup after system startup, but I don't know to make this. things did I do:

User Control Property that shows a list of all Forms at design time

こ雲淡風輕ζ 提交于 2019-12-19 10:16:22
问题 As we all know Forms created with Form.cs file I have property of type Form example : public Form TargetForm {get;set;} i don't need to use Activiator.CreateInstance() to create Form I just need to choose a Form from Forms.cs files and attach it with property of TargetForm . See Screenshot http://prntscr.com/pmuxdd Tips i guess maybe something usefull to readers : TypeDescriptors, Attributes maybe that return a list of classes in Visual Studio Solutions. As we all know the ComponentModel API

Windows Forms Generic Inheritance

若如初见. 提交于 2019-12-18 08:47:14
问题 I have these classes: class Foo<T1, T2> : Form where T1, T2 : EventArgs class MiddleGoo : Foo<X,Y> class Goo : MiddleGoo X,Y are just simple classes derived from EventArgs. I see Goo in designer, but i want to create a class Boo between Foo and Goo like this: class Boo<T1, Y> : Foo<T1, Y> where T1 : EventArgs class MiddleGoo : Boo<X,Y> class Goo : MiddleGoo Workaround with middle class doesn't work, any ideas? EDIT: I meant Y and X are classes like YEventArgs and XEventArgs and my problem is

Where is the Visual Studio 2017 Winforms Designer cache?

心不动则不痛 提交于 2019-12-18 07:13:01
问题 I'm getting some annoying errors from Visual Studio Designer when trying to open one of my forms (Could not load type x from assembly y, even though assembly y clearly contains type x; the project builds and runs fine). It looks like Visual Studio Designer cache issue to me. I looked around and it seems like Visual Studio Designer uses a ShadowCache, normally found at C:\Users\%UserName%\AppData\Local\Microsoft\VisualStudio\15.0_6d397e1a\Designer\ShadowCache However, that folder is empty.