In This Article

PopupControl Class

Represents the base class for a Form that may be used as a popup.

public class PopupControl : Form, IDisposable
Inheritance:
object MarshalByRefObject Component Control ScrollableControl ContainerControl Form object
Derived:
StandardColorPickerPopup
Implements:
IDisposable

Constructors

PopupControl()

Initializes a new instance of the PopupControl class.

public PopupControl()

Properties

AutoClose

Gets whether to automatically close when system events occur.

protected virtual bool AutoClose { get; set; }

Property Value

bool:

true if the popup should be closed when system events occur; otherwise, false.

CreateParams

Gets the required creation parameters when the control handle is created.

protected override CreateParams CreateParams { get; }

Property Value

CreateParams:

A CreateParams object that contains the required creation parameters when the handle to the control is created.

DropShadowEnabled

Gets or sets whether a drop-shadow is enabled.

public bool DropShadowEnabled { get; set; }

Property Value

bool:

true if a drop-shadow is enabled; otherwise, false.

Methods

Dispose(bool)

Releases the unmanaged resources used by the object and optionally releases the managed resources.

protected override void Dispose(bool disposing)
Parameter Type Description
disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method is called by the public Dispose method and the Finalize method. Dispose invokes this method with the disposing parameter set to true. Finalize invokes this method with disposing set to false.

HidePopup()

Hides the popup.

public virtual void HidePopup()

NegotiateLocation(Rectangle, Corner, Orientation, int)

Negotiates the location of the popup based on excluded bounds and the desired corner.

public void NegotiateLocation(Rectangle exclusionBounds, Corner exclusionCorner, Orientation orientation, int offset)
Parameter Type Description
exclusionBounds Rectangle

The bounds over which the object may not be displayed.

exclusionCorner Corner

The corner of the exclusion bounds at which to place the popup.

orientation Orientation

Whether the popup should extend horizontally or vertically from the corner.

offset int

The amount to offset from the exclusion bounds.

NegotiateLocation(Rectangle, int)

Negotiates the location of the popup based on excluded bounds.

public void NegotiateLocation(Rectangle exclusionBounds, int offset)
Parameter Type Description
exclusionBounds Rectangle

The bounds over which the object may not be displayed.

offset int

The amount to offset from the exclusion bounds.

Remarks

This method defaults to extending the popup vertically from the lower left corner.

OnDisplayed(EventArgs)

Raises the Displayed event.

protected virtual void OnDisplayed(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnDisplaying(EventArgs)

Raises the Displaying event.

protected virtual void OnDisplaying(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnHandleCreated(EventArgs)

Raises the HandleCreated event.

protected override void OnHandleCreated(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnHidden(EventArgs)

Raises the Hidden event.

protected virtual void OnHidden(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnHiding(EventArgs)

Raises the Hiding event.

protected virtual void OnHiding(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnVisibleChanged(EventArgs)

Raises the VisibleChanged event.

protected override void OnVisibleChanged(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

ProcessCmdKey(ref Message, Keys)

Processes a command key.

protected override bool ProcessCmdKey(ref Message m, Keys keyData)
Parameter Type Description
m Message

A Message, passed by reference, that represents the window message to process.

keyData Keys

One of the Keys values that represents the key to process.

Returns

bool:

true if the character was processed by the control; otherwise, false.

SetBoundsCore(int, int, int, int, BoundsSpecified)

Performs the work of setting the specified bounds of this control.

protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
Parameter Type Description
x int

The new Left property value of the control.

y int

The new Top property value of the control.

width int

The new Width property value of the control.

height int

The new Height property value of the control.

specified BoundsSpecified

A bitwise combination of the BoundsSpecified values.

SetVisibleCore(bool)

Sets the control to the specified visible state.

protected override void SetVisibleCore(bool visible)
Parameter Type Description
visible bool

true to make the control visible; otherwise, false.

ShowPopup(Control, bool)

Shows the popup.

public virtual void ShowPopup(Control owner, bool activate)
Parameter Type Description
owner Control

The Control that is the owner of the popup.

activate bool

Whether the form should be activated after being displayed.

WndProc(ref Message)

Processes Windows messages.

protected override void WndProc(ref Message m)
Parameter Type Description
m Message

The Windows Message to process.

Events

Displayed

Occurs after the popup is displayed.

public event EventHandler Displayed

Event Type

EventHandler

Displaying

Occurs before the popup is displayed.

public event EventHandler Displaying

Event Type

EventHandler

Hidden

Occurs after the popup is closed.

public event EventHandler Hidden

Event Type

EventHandler

Hiding

Occurs before the popup is closed.

public event EventHandler Hiding

Event Type

EventHandler

Inherited Members

Extension Methods