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 an instance of the class.
public PopupControl()
Properties
AutoClose
Indicates whether to automatically close when system events occur.
protected virtual bool AutoClose { get; set; }
Property Value
- bool:
trueif 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 that contains the required creation parameters when the handle to the control is created.
DropShadowEnabled
Indicates whether a drop-shadow is enabled.
public bool DropShadowEnabled { get; set; }
Property Value
- bool:
trueif a drop-shadow is enabled; otherwise,false. The default value istrue.
Remarks
Even when true, a drop-shadow will not be shown if the system does not support drop-shadow.
Methods
Dispose(bool)
Disposes of the resources (other than memory) used by the Form.
protected override void Dispose(bool disposing)
| Parameter | Type | Description |
|---|---|---|
| disposing | bool |
|
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 | The event data. |
OnDisplaying(EventArgs)
Raises the Displaying event.
protected virtual void OnDisplaying(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | 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 | The event data. |
OnHiding(EventArgs)
Raises the Hiding event.
protected virtual void OnHiding(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The event data. |
OnVisibleChanged(EventArgs)
Raises the VisibleChanged event.
protected override void OnVisibleChanged(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The 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 | |
| keyData | Keys | One of the Keys values that represents the key to process. |
Returns
- bool:
trueif the keystroke was processed and consumed by the control; otherwise,falseto allow further processing.
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 |
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.
Displaying
Occurs before the popup is displayed.
Hidden
Occurs after the popup is closed.
Hiding
Occurs before the popup is closed.
Inherited Members
- MarshalByRefObject.GetLifetimeService()
- MarshalByRefObject.InitializeLifetimeService()
- MarshalByRefObject.MemberwiseClone(bool)
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()
Extension Methods
- ObjectExtensions.TryConvertToDouble(object, out double)
- ObjectExtensions.TryConvertToDouble(object, IFormatProvider, out double)
- ControlExtensions.FindAncestorOfType<T>(Control, bool)
- ControlExtensions.FindCommonAncestor(Control, Control)
- ControlExtensions.FindDescendantOfType<T>(Control, bool)
- ControlExtensions.GetAncestors(Control)
- ControlExtensions.GetChildren(Control)
- ControlExtensions.GetDescendants(Control)
- ControlExtensions.GetParent(Control)
- ControlExtensions.GetParent<T>(Control)
- ControlExtensions.GetSelfAndAncestors(Control)
- ControlExtensions.GetSelfAndDescendants(Control)
- ControlExtensions.GetSiblings(Control)
- ControlExtensions.IsAncestorOf(Control, ILogicalTreeNode)
- ControlExtensions.IsAncestorOf(Control, Control)