windows-forms-designer

Why should I insert a non-UI Windows.Forms component from the designer?

不羁的心 提交于 2019-12-18 06:16:16
问题 In C# (and Visual Basic) you can add several non-UI components (those that don't inherit from System.Windows.Forms.Control ) directly from the form designer. Examples of those components are System.Windows.Forms.FolderBrowserDialog and System.Windows.Forms.Timer . But what's the benefit from adding non-UI controls with the UI designer instead of instancing them directly from code? There's a rationale behind that? 回答1: I think using non-UI components in designer at least has these benefits:

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

蓝咒 提交于 2019-12-17 20:24:14
问题 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

Allow multi-line String properties in the Properties window

无人久伴 提交于 2019-12-17 19:49:00
问题 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?

Disable designer in Visual Studio?

时光总嘲笑我的痴心妄想 提交于 2019-12-17 18:12:15
问题 I'm using Visual C# Express to write Windows Form applications, and call me old school, but I don't like the designer. It is a nuisance and pollutes my project with lots of unwanted files, as well as unwanted monkey-generated source code. Please tell me there's a way to turn it off completely. 回答1: Just dont add "new form" , add to the project new class and inherit him from the Form class. 回答2: Add a [System.ComponentModel.DesignerCategory("")] attribute before a UI class to avoid designer

Adding a Form as a property to a user control with Designer support

冷暖自知 提交于 2019-12-14 03:55:14
问题 I have created a custom label. It has a property of type Form , which the user can select the form in the designer and then when the label is clicked that form is loaded. It works fine but the only form in the properties dropdown list is the one that the label is on. Is there a way to show all possible forms or perhaps have the user pass the form as a string and then convert that to be a form. Here is the code for my label: Public Class BMLabel Private t As String Private id As String Private

Windows form Chart label modification

99封情书 提交于 2019-12-13 19:08:15
问题 Am creating an windows form application which uses chart.I want to modify the chart How to edit the chart area back ground color (white color in in screen shot) How to apply different color to each bar. How to format the Y axis label(need to align the file extension to left end and integer value to right end) This is my current screen shot Need to update my screen like this Is it possible to align label like this 回答1: Here is an example: To style the Chart you use this: // prepare: chart1

Override OnPaint

﹥>﹥吖頭↗ 提交于 2019-12-13 14:43:08
问题 If I override OnPaint and draw a square on the control, how do I get that e.graphics.draw... to show up when I'm previewing it in the designer? 回答1: http://msdn.microsoft.com/en-us/magazine/cc164048.aspx http://msdn.microsoft.com/en-us/magazine/cc164145.aspx While you could manually register with Control.OnPaint to add your design time UI, you'll find that overriding OnPaintAdornments is a better option because it is only called after the control's design-time/run-time UI is painted, letting

Visual Studio “Select Resource” dialog replacement

人走茶凉 提交于 2019-12-13 12:27:48
问题 In my project I have more than 750 images in resource. Using VS built in "Select Resource" dialog is a nightmare to find and select one image - let's say - for a button in winforms designer. It would be much more usable if it was some explorer like dialog and it is lack of search functionality. Do you have any idea how to replace this dialog? Is there any extension that can do that? If there is no such extension I would create an extension/add-in whatever I need to do. Do you have any real

How to avoid error “Constructor on type 'MyType' not found” when inheriting a base class

核能气质少年 提交于 2019-12-13 11:52:51
问题 I have a Visual Studio 2010 Windows Forms app which includes a Form base class that other classes will inherit. The base class' constructor takes a parameter that the child classes will pass to the base class. Example: public partial class BaseForm : Form { public BaseForm(int number) { InitializeComponent(); } } public partial class ChildForm : BaseForm { public ChildForm(int number) : base(number) { InitializeComponent(); } } The problem that I'm running into is, when I attempt to open the

VB.net get location of userControl in another container

怎甘沉沦 提交于 2019-12-13 07:24:01
问题 While referring to the above image: in VB.net,I have four instances of Windows.Forms.UserControl. A,B,C, and D. As you can see, B is in A, C is in B, and D is in C. D has a reference to A, and would like to calculate its location in A. Something like Me.getLocationInContainer(A) where Me is referring to D. How can I do this? I have done a bit of research and found pointToScreen() and pointToClient() but can't really figure out how to make use of them. The function names are not helping either