windows-forms-designer

WinForms designer properties of different derived types

若如初见. 提交于 2019-12-06 10:51:55
问题 Say I have a particular type that I want to make available to the Windows Forms designer... public class Style { public CustomBrush Brush { get; set; } } And CustomBrush is implemented like so... public abstract CustomBrush { ... } public SolidCustomBrush : CustomBrush { ... } public GradientCustomBrush : CustomBrush { ... } Is there a way at design time that I can choose from any of the types derived from CustomBrush , instantiate an instance of the selected type, and modify it via the

Changing an extended RichTextBox text in constructor doesn't work

帅比萌擦擦* 提交于 2019-12-06 07:20:58
I have the following class: public partial class RichTextBoxEx : RichTextBox { public RichTextBoxEx() { InitializeComponent(); Text = "Some Text"; } } However, when I place it over a form and run the program, the RichTextBox is empty. What is the problem and how can I fix it? I assume there is something basic I'm missing here, but I cannot figure out what, and I did not manage to find any information about this. The property values which you set in constructor of the control are usually respected. But for Text property, the case is a bit different. I've already described about it in another

How can I override behavior of DockStyle Editor in PropertyGrid

你。 提交于 2019-12-06 05:53:34
We have a custom panel which inherits Panel and has an Orientation property implemented similarly to the SplitContainer Orientation property. For our custom panel, DockStyle.Fill is never valid and depending on the Orientation property value, DockStyle needs to be Left or Right for Vertical or Top or Bottom for Horizontal. The DockStyleEditor class is sealed so we can't subclass it for our own custom UITypeEditor. Is there a way to override certain behaviors using a TypeDescriptor or some other way? What we would like to do for our custom panel DockStyle editor in the Property Grid is: 1.

WinForms Designer and TableLayoutPanel SmartTag Customization

邮差的信 提交于 2019-12-06 05:00:27
I am trying to customize the existing Smart Tag content for a TableLayoutPanel Windows Forms control for use in the Windows Forms designer (I implemented a designer that leverages the WinForms designer features exposed by the System.ComponentModel.Design and System.Windows.Forms.Design namespaces). Whatever approach is offered as a solution, it's got to also work when my control is added to the Visual Studio toolbox and when my control is placed on a WinForm surface in design mode while in the Visual Studio IDE. Here's what I'm trying to do: In design mode, a TableLayoutPanel control instance

How to make combo box auto expand on mouse hover and close when the mouse leaves combo box in c#? [duplicate]

為{幸葍}努か 提交于 2019-12-06 04:21:16
This question already has answers here : Winforms: how to open combobox properly? (5 answers) Closed 5 years ago . I have a windows form. In that windows form i have a combo box. I have predefined items in the combo box as Add, Remove and Delete. I want to make the combo box auto expand on mouse hover. How can I do that? I noticed that auto expand code should be given in the mouse hover event of combo box. like this private void comboBox1_MouseHover(object sender, EventArgs e) { } but I don't know how to expand the combo box. Can anyone tell me how to do that? Ok I got it done the expanding

Display a MultilineStringEditor at design-time to edit the lines of an edit-control?

末鹿安然 提交于 2019-12-05 23:19:22
I'm following this C# article to learn how to create an ActionList and Action Items, however the article is only focused to action items of type DesignerActionPropertyItem ... I would like to create an item of type DesignerActionMethodItem to call a method that must open a MultilineStringEditor to edit the text lines of the control, just the same action item that we can see in a default RichTextBox control: Someone could explain me how to do this in C# or VB.NET?. I'm stuck on the values to pass to the UITypeEditor.EditValue() method, I think that is the method that invokes/displays the editor

How to show a form on current screen in C#?

你。 提交于 2019-12-05 20:48:40
I want to show a new form in the same window from where it was invoked. I know a way to show this form on PrimaryScreen or Virtual Screen by code similar to as below: MyForm.Location = Screen.PrimaryScreen.Bounds.Location; But i want to show it on current screen. Is there a way to find out and show it on current screen? jreichert I have done something like this to show my form centered to the current screen: var screen = Screen.FromPoint(Cursor.Position); myForm.StartPosition = FormStartPosition.Manual; myForm.Left = screen.Bounds.Left + screen.Bounds.Width / 2 - myForm.Width / 2; myForm.Top =

cv::Mat detect PixelFormat

偶尔善良 提交于 2019-12-05 14:27:34
I'm trying to use pictureBox->Image (Windows Forms) to display a cv::Mat image (openCV). I want to do that without saving the Image as a file ('cause i want to reset the image every 100ms). I just found that topic here: How to display a cv::Mat in a Windows Form application? When i use this solution the image appears to be white only. I guess i took the wrong PixelFormat. So how do figure out the PixelFormat i need? Haven't seen any Method in cv::Mat to get info about that. Or does this depend on the image Source i use to create this cv::Mat? Thanks so far :) Here i took a screen. Its not

Visual Studio “Select Resource” dialog replacement

丶灬走出姿态 提交于 2019-12-05 12:26:09
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 experience if it can be done at all? I thought I will find the appropriate dll and extend its beaviour,

Form designer breaks on generic abstract UserControl

此生再无相见时 提交于 2019-12-05 05:47:24
I have a generic abstract UserControl class, SensorControl , which I want all my sensor control panels to inherit from. The problem When attempting to design the EthernetSensorControl (one of my inherited UserControl forms, from within Visual Studio, the following error is displayed in the form designer: The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: DeviceSensorControl --- The base class 'Engine.Sensors.SensorControl' could not be loaded. Ensure the assembly has been referenced and