BaseEdit.ToolTipAnchor Property

Gets or sets whether the tooltip is anchored relative to the mouse cursor or relative to the editor. This property is not in effect if you handle the ToolTipController.GetActiveObjectInfo event.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

[DefaultValue(ToolTipAnchor.Default)]
[Browsable(true)]
[DXCategory("ToolTip")]
public override ToolTipAnchor ToolTipAnchor { get; set; }
<DefaultValue(ToolTipAnchor.Default)>
<Browsable(True)>
<DXCategory("ToolTip")>
Public Overrides Property ToolTipAnchor As ToolTipAnchor

Property Value

Type Default Description
DevExpress.Utils.ToolTipAnchor

Default

A DevExpress.Utils.ToolTipAnchor value that specifies whether the tooltip is anchored relative to the mouse cursor or relative to the editor. By Default, the behavior depends on the ToolTipController.ToolTipAnchor property.

Remarks

Tooltips for editors can be specified using the BaseControl.SuperTip and BaseControl.ToolTip properties. When displayed, tooltips are aligned according to the ToolTipController.ToolTipLocation setting relative to the anchor point, which is the mouse cursor or the editor. By default, the anchor point is specified with the ToolTipController.ToolTipAnchor global setting. The ToolTipAnchor property allows you to override the global setting for the current editor.

If the ToolTipAnchor property is set to Cursor, tooltips are anchored relative to the mouse cursor. In this mode, a tooltip might overlap the current editor (for instance, when a large tooltip is displayed close to a screen edge). In the figure below, the tooltip for the RatingControl is anchored at the bottom right relative to the mouse cursor.

BaseEdit_ToolTipAnchor_Cursor

If the ToolTipAnchor property is set to Object, tooltips are anchored relative to the editor. In this mode, tooltips never overlap the current editor, no matter how big they are. In the following figure, the tooltip is anchored at the bottom right relative to the editor.

BaseEdit_ToolTipAnchor_Object

You can also dynamically anchor tooltips, while handling the ToolTipController.BeforeShow event, and specifying the ToolTipControllerShowEventArgs.ToolTipAnchor event argument.

If you handle the ToolTipController.GetActiveObjectInfo event, the ToolTipAnchor property has no effect. Specify control bounds manually as shown below.

private void toolTipController1_GetActiveObjectInfo(
  object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) {
    ToolTipControlInfo info = new ToolTipControlInfo(this.button1, "Text");
    info.SuperTip = new SuperToolTip();
    info.SuperTip.Items.Add(new ToolTipTitleItem() { Text = "Title" });
    info.SuperTip.Items.Add(new ToolTipItem() { Text = "Text" });
    info.ObjectBounds = e.SelectedControl.RectangleToScreen(e.SelectedControl.ClientRectangle);
    e.Info = info;
}
See Also