• HOME
  • PRODUCTS
  • DEMOS
  • BUY
  • BLOG
  • FORUM
  • DOCUMENTATION
  • ABOUT
  • FREE EVALUATION
Search Results for

    Show / Hide Table of Contents

    FormDesignerControl Class

    Definition

    Namespace: Alternet.FormDesigner.WinForms
    Assembly: Alternet.FormDesigner.v8.dll

    Represents a control supports all standard form editing operations with controls.

    Inheritance
    Object
    MarshalByRefObject
    Component
    Control
    FormDesignerControl
    Implements
    IDropTarget
    ISynchronizeInvoke
    IWin32Window
    IBindableComponent
    IComponent
    IDisposable
    IFormDesignerControl
    ITypeDiscoveryService
    Syntax
    [ToolboxBitmap(typeof(FormDesignerControl), "Images.FormDesignerControl.Icon.bmp")]
    public class FormDesignerControl : Control, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IFormDesignerControl, ITypeDiscoveryService

    Remarks

    FormDesignerControl control is based on .NET Framework FormDesigner services, which are implemented in System.ComponentModel.Design namespace and included in .NET framework. It allows AlterNET's FormDesignerControl to look and feel very similar to Visual Studio's WinForms Form Designer.

    Form Designer supports all common editing operations, such as dragging, selecting, and deleting components and controls; changing their size and z-order; aligning them horizontally or vertically, and copying and pasting controls. Like Visual Studio Form Designer, it serializes its content into C#/VisualBasic code, TypeScript/JavaScript, and Python.

    Here are some of the essential features provided by the FormDesigner:

    • Placing controls on the design surface and arranging them.
    • Save/load forms being designed.
    • Write event handlers code and run the designed form.

    The DesignerCommands property provides an interface to Form Designer commands, such as Copy/Paste, Undo/Redo, Aligning and Arranging controls, etc.

    The SelectedComponents property contains a list of selected components or controls.

    Set ToolboxControl property to specify the toolbox control associated with the designer.

    Note that FormDesignerControl is compatible with .NET Framework 4.5.2 + and .NET 6.0+

    Examples

    Here is how to declare a FormDesignerControl and handle its events from the C# code:

    public partial class Form1 : Form
    {
        private void Form1_Load(object sender, EventArgs e)
        {
            var formDesigner = new Alternet.FormDesigner.WinForms.FormDesignerControl();
            formDesigner.AutoSaveToSource = false;
            formDesigner.Dock = System.Windows.Forms.DockStyle.Fill;
            formDesigner.Parent = this;
            formDesigner.ComponentAdded += Designer_ComponentAdded;
        }
    
        private void Designer_ComponentAdded(object sender, ComponentEventArgs e)
        {
            System.Windows.Forms.MessageBox.Show(e.Component.ToString());
        }
    }
    

    Here is how to declare a FormDesignerControl and handle its events from the Visual Basic code:

    Partial Public Class Form1
        Inherits Form
    
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
            Dim formDesigner = New Alternet.FormDesigner.WinForms.FormDesignerControl()
            formDesigner.AutoSaveToSource = False
            formDesigner.Dock = System.Windows.Forms.DockStyle.Fill
            formDesigner.Parent = Me
            AddHandler designer.ComponentAdded, AddressOf Designer_ComponentAdded
        End Sub
    
        Private Sub Designer_ComponentAdded(ByVal sender As Object, ByVal e As ComponentEventArgs)
            System.Windows.Forms.MessageBox.Show(e.Component.ToString())
        End Sub
    End Class
    

    Constructors

    FormDesignerControl()

    Initializes a new instance of the FormDesignerControl class with default settings.

    Properties

    AutoAddComponentAssemblyReferences

    Gets or sets a boolean value indicating whether designer should automatically try to add assembly references after a control is added.

    AutoSaveToSource

    Gets or sets a boolean value indicating whether designer should automatically translate changes to the source upon every change.

    CommandKeyBindings

    Represents a list of CommandKeyBinding accepted by this FormDesignerControl.

    DesignerCommands

    Represents a collection of standard designer commands like selecting, copying, pasting, moving and resizing controls.

    DesignerHost

    Provides an interface for managing designer transactions and components.

    ImportedNamespaces

    In case of Visual Basic, gets collection of globally available namespaces.

    IsBeingLoaded

    When implemented by a class, gets a boolean value indicating that designer is currently being loaded.

    IsModified

    Represents a value indicates whether designer content has been modified since last save.

    IsSmartDiffCodeSerializationRequired

    Gets or sets method used to identify whether FormDesignerControl content should be saved only by taking into account code difference.

    Options

    Gets designer options like snap settings, grid size etc.

    PrimarySelection

    Gets first selected component or control.

    ReferencedAssemblies

    Gets collection of assemblies where the controls and components used on the form being designed are declared.

    SelectedComponents

    Contains list of selected components or controls.

    ServiceContainer

    Represents a container for designer-related services.

    Source

    Gets or sets FormDesigner Source.

    ToolboxControl

    Gets or sets toolbox control associated with the designer.

    UserData

    Gets or sets user-specific data associated with this Form Designer

    Methods

    CreateContext(IFormDesignerDataSource)
    CreateDefaultKeyBindings()
    CreateDesignerCommands()
    Dispose(Boolean)
    GetLocalizationLanguage()

    Gets current culture information

    HandleKeyboardShortcuts(Keys, Keys)
    RaiseComponentChanged(Object)
    Reload()

    Reloads form to be designed from the source.

    Save()

    Serializes designer to C# or Visual Basic file.

    SetLocalizationLanguage(CultureInfo)

    Sets current culture information

    ShowPropertiesWindow(Object, EventArgs)
    TryAddComponentAssemblyReferences(IComponent)
    TryFindCommandKeyBinding(Keys, Keys)
    ViewCode(Object, EventArgs)

    Events

    CommandStateChanged

    Occurs when state of designer commands changes (for example when undo stack becomes available).

    CompilerErrorClick

    Occurs when user clicks on compiler error on Form Designer surface.

    ComponentAdded

    Occurs when some component was added on the designer surface.

    ComponentAdding

    Occurs when some component is being added on the designer surface.

    ComponentChanged

    Occurs when some component was changed on the designer surface.

    ComponentRemoved

    Occurs when some component was removed from the designer surface.

    DesignedContentChanged

    Occurs when user modifies any aspect of the control being designed.

    DesignerHostChanged

    Occurs when designer host changes, for example if new form is loaded.

    DesignSurfaceKeyDown

    Occurs when user presses a key when design surface is focused.

    LoadingErrorOccured

    Occurs when there is a parse error of the design code during loading.

    NavigateToUserMethodRequested

    Occurs when form designer is requested to navigate to the event handler. For example, when user double clicks on the control.

    ReferencedAssembliesChanged
    SelectionChanged

    Occurs when user selects different control in the designer.

    ShowPropertiesRequested

    Occurs when user request to open Property Window.

    TypeDiscoveryRequested
    ViewCodeRequested

    Occurs when user request to view designer source code.

    Explicit Interface Implementations

    ITypeDiscoveryService.GetTypes(Type, Boolean)
    Inherited Members
    Control.GetAccessibilityObjectById(Int32)
    Control.SetAutoSizeMode(AutoSizeMode)
    Control.GetAutoSizeMode()
    Control.GetPreferredSize(Size)
    Control.AccessibilityNotifyClients(AccessibleEvents, Int32)
    Control.AccessibilityNotifyClients(AccessibleEvents, Int32, Int32)
    Control.BeginInvoke(Delegate)
    Control.BeginInvoke(Delegate, Object[])
    Control.BringToFront()
    Control.Contains(Control)
    Control.CreateAccessibilityInstance()
    Control.CreateControlsInstance()
    Control.CreateGraphics()
    Control.CreateHandle()
    Control.CreateControl()
    Control.DefWndProc(Message)
    Control.DestroyHandle()
    Control.DoDragDrop(Object, DragDropEffects)
    Control.DrawToBitmap(Bitmap, Rectangle)
    Control.EndInvoke(IAsyncResult)
    Control.FindForm()
    Control.GetTopLevel()
    Control.RaiseKeyEvent(Object, KeyEventArgs)
    Control.RaiseMouseEvent(Object, MouseEventArgs)
    Control.Focus()
    Control.FromChildHandle(IntPtr)
    Control.FromHandle(IntPtr)
    Control.GetChildAtPoint(Point, GetChildAtPointSkip)
    Control.GetChildAtPoint(Point)
    Control.GetContainerControl()
    Control.GetScaledBounds(Rectangle, SizeF, BoundsSpecified)
    Control.GetNextControl(Control, Boolean)
    Control.GetStyle(ControlStyles)
    Control.Hide()
    Control.InitLayout()
    Control.Invalidate(Region)
    Control.Invalidate(Region, Boolean)
    Control.Invalidate()
    Control.Invalidate(Boolean)
    Control.Invalidate(Rectangle)
    Control.Invalidate(Rectangle, Boolean)
    Control.Invoke(Delegate)
    Control.Invoke(Delegate, Object[])
    Control.InvokePaint(Control, PaintEventArgs)
    Control.InvokePaintBackground(Control, PaintEventArgs)
    Control.IsKeyLocked(Keys)
    Control.IsInputChar(Char)
    Control.IsInputKey(Keys)
    Control.IsMnemonic(Char, String)
    Control.NotifyInvalidate(Rectangle)
    Control.InvokeOnClick(Control, EventArgs)
    Control.OnAutoSizeChanged(EventArgs)
    Control.OnBackColorChanged(EventArgs)
    Control.OnBackgroundImageChanged(EventArgs)
    Control.OnBackgroundImageLayoutChanged(EventArgs)
    Control.OnBindingContextChanged(EventArgs)
    Control.OnCausesValidationChanged(EventArgs)
    Control.OnContextMenuChanged(EventArgs)
    Control.OnContextMenuStripChanged(EventArgs)
    Control.OnCursorChanged(EventArgs)
    Control.OnDockChanged(EventArgs)
    Control.OnEnabledChanged(EventArgs)
    Control.OnFontChanged(EventArgs)
    Control.OnForeColorChanged(EventArgs)
    Control.OnRightToLeftChanged(EventArgs)
    Control.OnNotifyMessage(Message)
    Control.OnParentBackColorChanged(EventArgs)
    Control.OnParentBackgroundImageChanged(EventArgs)
    Control.OnParentBindingContextChanged(EventArgs)
    Control.OnParentCursorChanged(EventArgs)
    Control.OnParentEnabledChanged(EventArgs)
    Control.OnParentFontChanged(EventArgs)
    Control.OnParentForeColorChanged(EventArgs)
    Control.OnParentRightToLeftChanged(EventArgs)
    Control.OnParentVisibleChanged(EventArgs)
    Control.OnPrint(PaintEventArgs)
    Control.OnTabIndexChanged(EventArgs)
    Control.OnTabStopChanged(EventArgs)
    Control.OnTextChanged(EventArgs)
    Control.OnVisibleChanged(EventArgs)
    Control.OnParentChanged(EventArgs)
    Control.OnClick(EventArgs)
    Control.OnClientSizeChanged(EventArgs)
    Control.OnControlAdded(ControlEventArgs)
    Control.OnControlRemoved(ControlEventArgs)
    Control.OnCreateControl()
    Control.OnHandleCreated(EventArgs)
    Control.OnLocationChanged(EventArgs)
    Control.OnHandleDestroyed(EventArgs)
    Control.OnDoubleClick(EventArgs)
    Control.OnDragEnter(DragEventArgs)
    Control.OnDragOver(DragEventArgs)
    Control.OnDragLeave(EventArgs)
    Control.OnDragDrop(DragEventArgs)
    Control.OnGiveFeedback(GiveFeedbackEventArgs)
    Control.OnEnter(EventArgs)
    Control.InvokeGotFocus(Control, EventArgs)
    Control.OnGotFocus(EventArgs)
    Control.OnHelpRequested(HelpEventArgs)
    Control.OnInvalidated(InvalidateEventArgs)
    Control.OnKeyDown(KeyEventArgs)
    Control.OnKeyPress(KeyPressEventArgs)
    Control.OnKeyUp(KeyEventArgs)
    Control.OnLayout(LayoutEventArgs)
    Control.OnLeave(EventArgs)
    Control.InvokeLostFocus(Control, EventArgs)
    Control.OnLostFocus(EventArgs)
    Control.OnMarginChanged(EventArgs)
    Control.OnMouseDoubleClick(MouseEventArgs)
    Control.OnMouseClick(MouseEventArgs)
    Control.OnMouseCaptureChanged(EventArgs)
    Control.OnMouseDown(MouseEventArgs)
    Control.OnMouseEnter(EventArgs)
    Control.OnMouseLeave(EventArgs)
    Control.OnMouseHover(EventArgs)
    Control.OnMouseMove(MouseEventArgs)
    Control.OnMouseUp(MouseEventArgs)
    Control.OnMouseWheel(MouseEventArgs)
    Control.OnMove(EventArgs)
    Control.OnPaint(PaintEventArgs)
    Control.OnPaddingChanged(EventArgs)
    Control.OnPaintBackground(PaintEventArgs)
    Control.OnQueryContinueDrag(QueryContinueDragEventArgs)
    Control.OnRegionChanged(EventArgs)
    Control.OnResize(EventArgs)
    Control.OnPreviewKeyDown(PreviewKeyDownEventArgs)
    Control.OnSizeChanged(EventArgs)
    Control.OnChangeUICues(UICuesEventArgs)
    Control.OnStyleChanged(EventArgs)
    Control.OnSystemColorsChanged(EventArgs)
    Control.OnValidating(CancelEventArgs)
    Control.OnValidated(EventArgs)
    Control.PerformLayout()
    Control.PerformLayout(Control, String)
    Control.PointToClient(Point)
    Control.PointToScreen(Point)
    Control.PreProcessMessage(Message)
    Control.PreProcessControlMessage(Message)
    Control.ProcessCmdKey(Message, Keys)
    Control.ProcessDialogChar(Char)
    Control.ProcessDialogKey(Keys)
    Control.ProcessKeyEventArgs(Message)
    Control.ProcessKeyMessage(Message)
    Control.ProcessKeyPreview(Message)
    Control.ProcessMnemonic(Char)
    Control.RaiseDragEvent(Object, DragEventArgs)
    Control.RaisePaintEvent(Object, PaintEventArgs)
    Control.RecreateHandle()
    Control.RectangleToClient(Rectangle)
    Control.RectangleToScreen(Rectangle)
    Control.ReflectMessage(IntPtr, Message)
    Control.Refresh()
    Control.ResetMouseEventArgs()
    Control.ResetText()
    Control.ResumeLayout()
    Control.ResumeLayout(Boolean)
    Control.Scale(SizeF)
    Control.ScaleControl(SizeF, BoundsSpecified)
    Control.Select()
    Control.Select(Boolean, Boolean)
    Control.SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean)
    Control.SendToBack()
    Control.SetBounds(Int32, Int32, Int32, Int32)
    Control.SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)
    Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified)
    Control.SetClientSizeCore(Int32, Int32)
    Control.SizeFromClientSize(Size)
    Control.SetStyle(ControlStyles, Boolean)
    Control.SetTopLevel(Boolean)
    Control.SetVisibleCore(Boolean)
    Control.RtlTranslateAlignment(HorizontalAlignment)
    Control.RtlTranslateAlignment(LeftRightAlignment)
    Control.RtlTranslateAlignment(ContentAlignment)
    Control.RtlTranslateHorizontal(HorizontalAlignment)
    Control.RtlTranslateLeftRight(LeftRightAlignment)
    Control.RtlTranslateContent(ContentAlignment)
    Control.Show()
    Control.SuspendLayout()
    Control.Update()
    Control.UpdateBounds()
    Control.UpdateBounds(Int32, Int32, Int32, Int32)
    Control.UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)
    Control.UpdateZOrder()
    Control.UpdateStyles()
    Control.WndProc(Message)
    Control.IDropTarget.OnDragEnter(DragEventArgs)
    Control.IDropTarget.OnDragOver(DragEventArgs)
    Control.IDropTarget.OnDragLeave(EventArgs)
    Control.IDropTarget.OnDragDrop(DragEventArgs)
    Control.OnImeModeChanged(EventArgs)
    Control.AccessibilityObject
    Control.AccessibleDefaultActionDescription
    Control.AccessibleDescription
    Control.AccessibleName
    Control.AccessibleRole
    Control.AllowDrop
    Control.Anchor
    Control.AutoScrollOffset
    Control.LayoutEngine
    Control.BackColor
    Control.BackgroundImage
    Control.BackgroundImageLayout
    Control.BindingContext
    Control.Bottom
    Control.Bounds
    Control.CanFocus
    Control.CanRaiseEvents
    Control.CanSelect
    Control.Capture
    Control.CausesValidation
    Control.CheckForIllegalCrossThreadCalls
    Control.ClientRectangle
    Control.ClientSize
    Control.CompanyName
    Control.ContainsFocus
    Control.ContextMenu
    Control.ContextMenuStrip
    Control.Controls
    Control.Created
    Control.CreateParams
    Control.Cursor
    Control.DataBindings
    Control.DefaultBackColor
    Control.DefaultCursor
    Control.DefaultFont
    Control.DefaultForeColor
    Control.DefaultMargin
    Control.DefaultMaximumSize
    Control.DefaultMinimumSize
    Control.DefaultPadding
    Control.DefaultSize
    Control.DisplayRectangle
    Control.IsDisposed
    Control.Disposing
    Control.Dock
    Control.DoubleBuffered
    Control.Enabled
    Control.Focused
    Control.Font
    Control.FontHeight
    Control.ForeColor
    Control.Handle
    Control.HasChildren
    Control.Height
    Control.IsHandleCreated
    Control.InvokeRequired
    Control.IsAccessible
    Control.IsMirrored
    Control.Left
    Control.Location
    Control.Margin
    Control.MaximumSize
    Control.MinimumSize
    Control.ModifierKeys
    Control.MouseButtons
    Control.MousePosition
    Control.Name
    Control.Parent
    Control.ProductName
    Control.ProductVersion
    Control.RecreatingHandle
    Control.Region
    Control.RenderRightToLeft
    Control.ResizeRedraw
    Control.Right
    Control.RightToLeft
    Control.ScaleChildren
    Control.Site
    Control.Size
    Control.TabIndex
    Control.TabStop
    Control.Tag
    Control.Text
    Control.Top
    Control.TopLevelControl
    Control.ShowKeyboardCues
    Control.ShowFocusCues
    Control.UseWaitCursor
    Control.Visible
    Control.Width
    Control.PreferredSize
    Control.Padding
    Control.CanEnableIme
    Control.DefaultImeMode
    Control.ImeMode
    Control.ImeModeBase
    Control.PropagatingImeMode
    Control.BackColorChanged
    Control.BackgroundImageChanged
    Control.BackgroundImageLayoutChanged
    Control.BindingContextChanged
    Control.CausesValidationChanged
    Control.ClientSizeChanged
    Control.ContextMenuChanged
    Control.ContextMenuStripChanged
    Control.CursorChanged
    Control.DockChanged
    Control.EnabledChanged
    Control.FontChanged
    Control.ForeColorChanged
    Control.LocationChanged
    Control.MarginChanged
    Control.RegionChanged
    Control.RightToLeftChanged
    Control.SizeChanged
    Control.TabIndexChanged
    Control.TabStopChanged
    Control.TextChanged
    Control.VisibleChanged
    Control.Click
    Control.ControlAdded
    Control.ControlRemoved
    Control.DragDrop
    Control.DragEnter
    Control.DragOver
    Control.DragLeave
    Control.GiveFeedback
    Control.HandleCreated
    Control.HandleDestroyed
    Control.HelpRequested
    Control.Invalidated
    Control.PaddingChanged
    Control.Paint
    Control.QueryContinueDrag
    Control.QueryAccessibilityHelp
    Control.DoubleClick
    Control.Enter
    Control.GotFocus
    Control.KeyDown
    Control.KeyPress
    Control.KeyUp
    Control.Layout
    Control.Leave
    Control.LostFocus
    Control.MouseClick
    Control.MouseDoubleClick
    Control.MouseCaptureChanged
    Control.MouseDown
    Control.MouseEnter
    Control.MouseLeave
    Control.MouseHover
    Control.MouseMove
    Control.MouseUp
    Control.MouseWheel
    Control.Move
    Control.PreviewKeyDown
    Control.Resize
    Control.ChangeUICues
    Control.StyleChanged
    Control.SystemColorsChanged
    Control.Validating
    Control.Validated
    Control.ParentChanged
    Control.ImeModeChanged
    Component.Dispose()
    Component.GetService(Type)
    Component.ToString()
    Component.Events
    Component.Container
    Component.DesignMode
    Component.Disposed
    MarshalByRefObject.MemberwiseClone(Boolean)
    MarshalByRefObject.GetLifetimeService()
    MarshalByRefObject.InitializeLifetimeService()
    MarshalByRefObject.CreateObjRef(Type)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()

    Implements

    System.Windows.Forms.IDropTarget
    System.ComponentModel.ISynchronizeInvoke
    System.Windows.Forms.IWin32Window
    System.Windows.Forms.IBindableComponent
    System.ComponentModel.IComponent
    System.IDisposable
    IFormDesignerControl
    System.ComponentModel.Design.ITypeDiscoveryService
    In This Article
    Back to top Copyright AlterNET Software Download PDF