windows-forms-designer

Override OnPaint

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? ...

Windows Forms in Unmanaged Code?

I find myself annoyed that Visual Studio comes with a fancy GUI interface designer and that it is only accessible to .NET applications and not even managed C++. Is there any easy way to at least open up a C DLL type interface with unmanaged/foreign code? ...

C#: Event not showing up in the Property Grid

I am creating a special search text box. Among other things it have these two events: [Category("Behavior")] public event EventHandler<GenericEventArgs<string>> Search; [Category("Property Changed")] public event EventHandler<EventArgs> ActiveColorChanged; [Category("Property Changed")] public event EventHandle...

Visual Studio Designer is always trying to change my control

I have a somewhat complex UserControl, and Visual Studio 2008 is giving me a rather harmless annoyance when working with it. Every single time I open the control with the Designer, it decides to immediately change some of the harmless values set by the designer - namely the initialization of Size properties. If I save those changes, cl...

Setting DefaultValue for properties of non-Constant types?

Hi, I have a Windows.Forms component which has a "mySize" property that returns a Size struct. My intention was to have this property calculate the returned mySize automatically based on the size of the component, unless mySize has been explicity set, in which case, return the set value of mySize. Unfortunately, now that I am embedding t...

Concrete Implementation of Generic Form Not Working in Designer

I have a base class, defined as below (I'm also using DevExpress components): public abstract partial class BaseFormClass<R> : XtraForm where R : DataRow { ... } Contrary to what I've read from elsewhere, I'm still able to design this class. I didn't have to create a concrete class from it to do so. But, when I create a concrete cla...

How does the Winforms Designer instantiate my form?

I'm developing my own WinForms designer. It must be able to load existing custom form types. One of the issues I hit is forms without a default ctor: My code currently instantiates the form before it can load it into the designer, which requires a default ctor. OTOH, VS2008 is able to load such forms. I believe it doesn't actually insta...

Visual Studio 2008 WPF designer won't load my forms

I'm trying to see a form developed by someone else (ex-employee) in Visual Studio 2008 but keep running into the following error when I try and look at MainForm.xaml (it fails to load in the designer view): Error Could not create an instance of type 'NumericTextBox'. D:\MySolution\GUI\MainForm.xaml My solution is organised somethin...

WinForm designer and right snapline for controls in container when resizing it...

Using Visual Studio 2008 WinForm designer, I have a container (form, panel, groupbox, whatever) and some controls in it. The container is set to not automatically resize or dock in any way. When placing a control in the container I can use the snaplines to help in positioning the control. However, the snaplines does not appear when I r...

Customizing the behavior of ControlDesigners for Controls derived from native .NET controls.

My question is related to this question: http://stackoverflow.com/questions/93541/baseline-snaplines-in-custom-winforms-controls However, in my case, I have created a new control that derives from TextBox rather than containing a TextBox. I would like to have a custom ControlDesigner, but I would like to modify the behavior of the Text...

CodeDOM serializer for custom collection class

Hi everyone, Please help me with this. I have a custom collection class which implement ICollection, IDictionary, ... so it act as traditional List but i can raise custom event. The custom collection class has following property: - An inner list that hold values - A DataSource and DataField Then I create a Custom Control which ...

How do I handle drag-and-drop in the designer?

I've created a control, DataGridViewContainer, that fakes partial-line scrolling in a DataGridView - basically it's a panel and a scrollbar and a few event handlers. I'd like to be able to use DataGridViewContainer at design time, dragging a DataGridView onto it to set its .DataGridView property to the dragged control. How do I handle ...

Standard margins between controls and standard control sizes

For example, Windows Forms Designer offers to place my controls on the form the way there are 12 pixels between form border and control border. It seems too much to me. Is it standard value? Also, as I understand standard button height should be 23 pixels. Am I right? Is there any documents that state all this? And can I setup this defau...

Is it OK to change a winforms designer file?

I have created a class that is simply THIS Class UserControlBase Inherits UserControl End Class Then I changed the Inherits clause in each of my UserControls designer file to Inherits UserControlBase I know that generally you shouldn't manually mod the designer file. But in cases like this what else can you do? Is this O...

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

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? ...

How to apply dependency injection to UserControl views while keeping Designer happy?

public class StatisticsViewPresenter { private IStatisticsView view; private Statistics statsModel; public StatisticsViewPresenter(IStatisticsView view, Statistics statsModel) { this.view = view; this.statsModel = statsModel; } } I don't use events (but am willing to if it can solve my problem), so ...

UseCompatibleTextRendering property not created by designer when it is set to false

I do not wish to use compatible text rendering, but I do not wish to use Application.SetCompatibleTextRenderingDefault(false); Naturally, I thought all I had to do was set each label's UseCompatibleTextRendering property to false. The Forms Designer, however, apparently only generates code to set the property if UseCompatibleTextRend...

C#: Does ResumeLayout(true) do the same as ResumeLayout(false) + PerformLayout()?

I have looked at the generated designer code of Forms and UserControls, and in the InitializeComponent() method they always start with this.SuspendLayout(); and end with this.ResumeLayout(false); this.PerformLayout(); But from what I can see in the msdn documentation of those methods, wouldn't ending with this.Resu...

How to change default image of derived ToolStripButton?

It seems like a simple task. Create a C# class that derives from ToolStripButton. The derived ToolStripButton should behave exactly the same as the parent class in the designer and the application, except that the default image should be different. Surprisingly just changing the constructor is not sufficient: public CustomToolStripButt...

VS2008 - Windows Form Editing Confuses VS

We have a project in our solution that houses a test application with multiple windows forms. Every time I open up a form in the form editor, Visual Studio goes out to lunch, chewing up an entire processor... until I kill the process. I tried to port over to a new project, thinking something in one of the forms, or the project file w...