TextContextMenuEventArgs Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXTextControl.Windows. Forms. dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXTextControl.from the setup.Windows. Forms. dll
- Inherits
- Cancel
Event Args - Text
Context Menu Event Args
- Cancel
Description
The TextContextMenuEventArgs class provides data for the TextControl.TextContextMenuOpening event of a Windows Forms TextControl. This event occurs, immediately before a built-in context menu will be opened. A TextControl provides context menus for different parts of a document. The ContextMenuLocation property informs for which part the menu will be opened. The pre-defined menu provided with the TextContextMenu property can be altered or expanded.
Syntax
public class TextContextMenuEventArgs : CancelEventArgsPublic Class TextContextMenuEventArgs
Inherits CancelEventArgsExamples
The following example uses TextContextMenuEventArgs.ContextMenuLocation while handling TextContextMenuOpening.
textControl.TextContextMenuOpening += (_, e) =>
{
Console.WriteLine($"Context Menu Location: {e.ContextMenuLocation}");
};AddHandler textControl.TextContextMenuOpening,
Sub(sender, e)
Console.WriteLine($"Context Menu Location: {e.ContextMenuLocation}")
End SubMembers
Properties
| Property | Description |
|---|---|
| ContextMenuLocation | Gets the location in the document for which the context menu will be opened. The context menu items, which will be shown, depend on this location. The property value can be a combination (bitwise or) of the ContextMenuLocation values. |
| Location | Gets the location, in pixels, where the context menu is displayed. The coordinates are relative to the top-left corner of the screen. |
| TextContextMenu | Gets or sets the context menu, which will be shown. The items depend on the document location where the mouse click occurs. The menu can be altered, extended or completely replaced. When this property is set to null, the TextControl uses system menu items. To completely suppress a context menu, the Cancel Property must be set the true. |