menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PopupBase - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PopupBase

    Represents a class that provides the support to host any control.

    Inheritance
    System.Object
    PopupBase
    Popup
    Implements
    IPopupHost
    IPopupChild
    IKeyboardMessage
    IMouseMoveMessage
    IMouseHook
    IKeyboardHook
    IPopupParent
    IPopup
    Namespace: Syncfusion.WinForms.Core
    Assembly: Syncfusion.Core.WinForms.dll
    Syntax
    public class PopupBase : Panel, IPopupHost, IPopupChild, IKeyboardMessage, IMouseMoveMessage, IMouseHook, IKeyboardHook, IPopupParent, IPopup

    Constructors

    PopupBase()

    Initializes a new instance of the PopupBase class.

    Declaration
    public PopupBase()

    PopupBase(IContainer)

    Initializes a new instance of the PopupBase class with a specified container.

    Declaration
    public PopupBase(IContainer container)
    Parameters
    Type Name Description
    System.ComponentModel.IContainer container

    A System.ComponentModel.IContainer that represents the container of the PopupControlContainer.

    Remarks

    Containers are objects that encapsulate and track zero or more components. In this context, containment refers to logical containment, not visual containment. You can use components and containers in a variety of scenarios, including scenarios that are both visual and not visual.

    Note to Implementers: To be a container, the class must implement the IContainer interface, which supports methods for adding, removing and retrieving components.

    Unlike other controls, a PopupControlContainer is not a direct child of your form (though this is the case during design-time). This requires you to explicitly dispose of this control before the form gets destroyed. With this constructor override, the PopupControlContainer automatically plugs itself into a form's default component-containment pattern (through the IContainer member) during design-time. If you create this class in code, then you have to set it up manually.

    The implementation simply adds the PopupControlContainer instance into the container.

    Properties

    DefaultMargin

    The default margin.

    Declaration
    protected override Padding DefaultMargin { get; }
    Property Value
    Type
    System.Windows.Forms.Padding

    DefaultSize

    Gets the default size.

    Declaration
    protected override Size DefaultSize { get; }
    Property Value
    Type
    System.Drawing.Size

    DesignMode

    Gets a value indicating whether the control is in design-mode.

    Declaration
    public bool DesignMode { get; }
    Property Value
    Type
    System.Boolean

    ParentControl

    Gets or sets the PopupControlContainer's control parent.

    Declaration
    public Control ParentControl { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.Control

    A control instance.

    Remarks

    The Parent-Child relationship in this case is NOT similar to the one in the control hierarchy.

    When you specify a Parent Control via ParentControl and pass a Point.Empty location to ShowPopup, the popup location will be dynamically determined based on the ParentControl bounds and the screen area.

    PopupHost

    Gets or sets a reference to the PopupHost that will be used to host this PopupControlContainer when dropped down.

    Declaration
    public PopupHostBase PopupHost { get; set; }
    Property Value
    Type Description
    PopupHostBase

    The PopupHost object that will host this PopupControlContainer.

    Remarks

    PopupHost is the top level form-based control that hosts this PopupControlContainer when dropped down.

    The PopupControlContainer usually creates a custom PopupHost when it is asked to drop down. However, you can provide your own PopupHost if you have a customized version.

    You can also get a reference to the PopupHost that the PopupControlContainer uses by default and make changes to it. The PopupControlContainer creates a default PopupHost when there is no PopupHost supplied to it, but Show(Point) gets called to show the popup. Hence, the best place to get the default PopupHost associated with this PopupControlContainer is in the handler. Or call Syncfusion.WinForms.Core.PopupBase.EnsurePopupHost to create the default PopupHost if it is not yet created.

    PopupParent

    Gets or sets the IPopupParent parent.

    Declaration
    public IPopupParent PopupParent { get; set; }
    Property Value
    Type Description
    IPopupParent

    An instance that implements IPopupParent.

    Remarks

    When you associate an IPopupParent interface with the PopupControlContainer you get even more control over the alignment and positioning of the Popup, (this you would do instead of the PopupControl based parenting).

    When you provide this interface, the alignment and positioning logic is delegated to this interface.

    RelativeAlignment

    Gets or sets the position for popup.

    Declaration
    protected PopupRelativeAlignment RelativeAlignment { get; set; }
    Property Value
    Type
    PopupRelativeAlignment

    ShowShadow

    Gets or sets a value indicating whether a shadow should be drawn around the popup window.

    Declaration
    public bool ShowShadow { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if a shadow is needed; False otherwise.

    Style

    Gets or sets the drop down style.

    Declaration
    public DropDownStyleInfo Style { get; set; }
    Property Value
    Type
    DropDownStyleInfo

    Methods

    ChildClosing(IPopupChild, PopupCloseAction)

    Occurs while child closing.

    Declaration
    protected virtual void ChildClosing(IPopupChild childUI, PopupCloseAction popupCloseType)
    Parameters
    Type Name Description
    IPopupChild childUI

    The child.

    PopupCloseAction popupCloseType

    The popup type.

    CreatePopupHost()

    Creates a new popup host.

    Declaration
    protected virtual PopupHostBase CreatePopupHost()
    Returns
    Type Description
    PopupHostBase

    Returns the popup host.

    Dispose(Boolean)

    Releases the unmanaged resources.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    The boolean value.

    GetBorderOverlapCue(PopupRelativeAlignment)

    Get the border.

    Declaration
    protected virtual Point[] GetBorderOverlapCue(PopupRelativeAlignment relativeAlignment)
    Parameters
    Type Name Description
    PopupRelativeAlignment relativeAlignment

    The alignment.

    Returns
    Type Description
    System.Drawing.Point[]

    Returns the points

    GetLocationForPopupAlignment(PopupRelativeAlignment, out PopupRelativeAlignment)

    Get the location for popup.

    Declaration
    protected virtual Point GetLocationForPopupAlignment(PopupRelativeAlignment prevAlignment, out PopupRelativeAlignment newAlignment)
    Parameters
    Type Name Description
    PopupRelativeAlignment prevAlignment

    Previous alignment

    PopupRelativeAlignment newAlignment

    The new alignment.

    Returns
    Type Description
    System.Drawing.Point

    returns the point.

    GetPreferredLocation(PopupRelativeAlignment, out PopupRelativeAlignment)

    Gets preferred location.

    Declaration
    public virtual Point GetPreferredLocation(PopupRelativeAlignment prevAlignment, out PopupRelativeAlignment newAlignment)
    Parameters
    Type Name Description
    PopupRelativeAlignment prevAlignment

    The previous alignment

    PopupRelativeAlignment newAlignment

    The new alignment.

    Returns
    Type Description
    System.Drawing.Point

    Returns the preferred location.

    Hide()

    Hides a popup that is open.

    Declaration
    public virtual void Hide()
    Remarks

    This method will hide the popup with the Canceled mode.

    Hide(PopupCloseAction)

    Hides a popup with the specified PopupCloseAction mode.

    Declaration
    public virtual void Hide(PopupCloseAction popupCloseType)
    Parameters
    Type Name Description
    PopupCloseAction popupCloseType

    A PopupCloseType value.

    IsRelatedControl(Control, Boolean)

    Checks whether the control is a related control.

    Declaration
    public virtual bool IsRelatedControl(Control control, bool askPopupParent)
    Parameters
    Type Name Description
    System.Windows.Forms.Control control

    The control

    System.Boolean askPopupParent

    The boolean value.

    Returns
    Type Description
    System.Boolean

    Returns true if control relates properly.

    IsShowing()

    Indicates whether the popup is currently dropped down.

    Declaration
    public bool IsShowing()
    Returns
    Type Description
    System.Boolean

    True indicates popup is dropped down; False otherwise.

    OnBeforePopup(CancelEventArgs)

    Raises the BeforePopup event.

    Declaration
    protected virtual void OnBeforePopup(CancelEventArgs args)
    Parameters
    Type Name Description
    System.ComponentModel.CancelEventArgs args

    A CancelEventArgs that contains the event data.

    Remarks

    The OnBeforePopup method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

    Note to Inheritors: When overriding OnBeforePopup in a derived class, be sure to call the base class's OnBeforePopup method so that registered delegates receive the event.

    OnCloseUp(PopupCloseAction)

    Raises the event.

    Declaration
    protected virtual void OnCloseUp(PopupCloseAction popupCloseType)
    Parameters
    Type Name Description
    PopupCloseAction popupCloseType

    A PopupCloseAction.

    Remarks

    The OnCloseUp method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

    Note to Inheritors: When overriding OnCloseUp in a derived class, be sure to call the base class's OnCloseUp method so that registered delegates receive the event.

    OnPopup(EventArgs)

    Raises the PopupBase event.

    Declaration
    protected virtual void OnPopup(EventArgs args)
    Parameters
    Type Name Description
    System.EventArgs args

    An EventArgs instance containing data pertaining to this event.

    Remarks

    The OnPopup method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

    Note to Inheritors: When overriding OnPopup in a derived class, be sure to call the base class's OnPopup method so that registered delegates receive the event.

    OnSizeChanged(EventArgs)

    Occurs when size changed.

    Declaration
    protected override void OnSizeChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    The event arguments.

    ProcessDialogKey(Keys)

    Overridden. See System.Windows.Forms.Control.ProcessDialogKey.

    Declaration
    protected override bool ProcessDialogKey(Keys key)
    Parameters
    Type Name Description
    System.Windows.Forms.Keys key

    The key.

    Returns
    Type Description
    System.Boolean

    Returns the boolean.

    ProcessMouseMessage(Control, Int32, IntPtr, IntPtr)

    Process the mouse message.

    Declaration
    protected virtual bool ProcessMouseMessage(Control destination, int msg, IntPtr lParam, IntPtr wParam)
    Parameters
    Type Name Description
    System.Windows.Forms.Control destination

    The destination.

    System.Int32 msg

    The message.

    System.IntPtr lParam

    The handle parameter.

    System.IntPtr wParam

    The window parameter

    Returns
    Type Description
    System.Boolean

    Returns the boolean value.

    Show(Point)

    Shows the popup.

    Declaration
    public virtual void Show(Point location)
    Parameters
    Type Name Description
    System.Drawing.Point location

    The location.

    VeryifyMouseBasedDeactivation(Control, Int32)

    Verify the mouse mouse based activation.

    Declaration
    protected virtual void VeryifyMouseBasedDeactivation(Control destinationControl, int msg)
    Parameters
    Type Name Description
    System.Windows.Forms.Control destinationControl

    The destination control.

    System.Int32 msg

    The message.

    WndProc(ref Message)

    Overridden. System.Windows.Forms.Control.WndProc.

    Declaration
    protected override void WndProc(ref Message m)
    Parameters
    Type Name Description
    System.Windows.Forms.Message m

    The message.

    Explicit Interface Implementations

    IKeyboardHook.KeyboardHookProc(Int32, Int32)

    The keyboard hook process.

    Declaration
    bool IKeyboardHook.KeyboardHookProc(int wParam, int lParam)
    Parameters
    Type Name Description
    System.Int32 wParam

    The window handle parameter.

    System.Int32 lParam

    The handle parameter.

    Returns
    Type Description
    System.Boolean

    Returns the process.

    IKeyboardMessage.KeyboardMessage(ref Message)

    The keyboard message.

    Declaration
    bool IKeyboardMessage.KeyboardMessage(ref Message m)
    Parameters
    Type Name Description
    System.Windows.Forms.Message m

    A message.

    Returns
    Type Description
    System.Boolean

    Returns the boolean value.

    IMouseHook.MouseHook(Int32, Point, IntPtr, Int32, Int32)

    The mouse hook process.

    Declaration
    bool IMouseHook.MouseHook(int msg, Point point, IntPtr hwnd, int hitTestCode, int extraInfo)
    Parameters
    Type Name Description
    System.Int32 msg

    A message.

    System.Drawing.Point point

    The point.

    System.IntPtr hwnd

    The handle.

    System.Int32 hitTestCode

    The hit test code

    System.Int32 extraInfo

    The extra information.

    Returns
    Type Description
    System.Boolean

    Returns the boolean value.

    IMouseMoveMessage.MouseMoveMessage(ref Message)

    The mouse message.

    Declaration
    bool IMouseMoveMessage.MouseMoveMessage(ref Message m)
    Parameters
    Type Name Description
    System.Windows.Forms.Message m

    A message.

    Returns
    Type Description
    System.Boolean

    Returns the boolean value.

    IPopup.GetPopupParentControl()

    Gets the popup parent control.

    Declaration
    Control IPopup.GetPopupParentControl()
    Returns
    Type Description
    System.Windows.Forms.Control

    Returns the popup parent control

    IPopupParent.ChildClosing(IPopupChild, PopupCloseAction)

    Occurs while child closing occurs.

    Declaration
    void IPopupParent.ChildClosing(IPopupChild childUI, PopupCloseAction popupCloseType)
    Parameters
    Type Name Description
    IPopupChild childUI

    The child.

    PopupCloseAction popupCloseType

    The popup close type.

    IPopupParent.GetBorderOverlapCue(PopupRelativeAlignment)

    Gets the border points

    Declaration
    Point[] IPopupParent.GetBorderOverlapCue(PopupRelativeAlignment relativeAlignment)
    Parameters
    Type Name Description
    PopupRelativeAlignment relativeAlignment

    The relative alignment.

    Returns
    Type Description
    System.Drawing.Point[]

    Returns the points collection.

    IPopupParent.GetLocationForPopupAlignment(PopupRelativeAlignment, out PopupRelativeAlignment)

    Get the location for popup.

    Declaration
    Point IPopupParent.GetLocationForPopupAlignment(PopupRelativeAlignment prevAlignment, out PopupRelativeAlignment newAlignment)
    Parameters
    Type Name Description
    PopupRelativeAlignment prevAlignment

    Previous alignment.

    PopupRelativeAlignment newAlignment

    The new alignment.

    Returns
    Type Description
    System.Drawing.Point

    Returns the points.

    IPopupParent.IsRightToLeft

    Gets a value indicating whether the right to left mode.

    Declaration
    bool IPopupParent.IsRightToLeft { get; }
    Returns
    Type
    System.Boolean

    Implements

    IPopupHost
    IPopupChild
    IKeyboardMessage
    IMouseMoveMessage
    IMouseHook
    IKeyboardHook
    IPopupParent
    IPopup
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved