ToolTip.HorizontalOffset プロパティ

定義

対象の左開始位置からポップアップの配置ポイントまでの横方向の距離を取得または指定します。

public:
 property double HorizontalOffset { double get(); void set(double value); };
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))]
public double HorizontalOffset { get; set; }
[<System.ComponentModel.Bindable(true)>]
[<System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))>]
member this.HorizontalOffset : double with get, set
Public Property HorizontalOffset As Double

プロパティ値

対象の左開始位置からポップアップの配置ポイントまでの横方向の距離。 ターゲットの原点とポップアップ配置ポイントの詳細については、「 ポップアップ配置の動作」を参照してください。 既定値は 0 です。

属性

次の例は、 を作成して配置する方法を ToolTip示しています。

<Ellipse Height="25" Width="50" 
         Fill="Gray" 
         HorizontalAlignment="Left"
         ToolTipService.InitialShowDelay="1000"
         ToolTipService.ShowDuration="7000"
         ToolTipService.BetweenShowDelay="2000">
  <Ellipse.ToolTip>
    <ToolTip Placement="Right" 
             PlacementRectangle="50,0,0,0"
             HorizontalOffset="10" 
             VerticalOffset="20"
             HasDropShadow="false"
             Opened="whenToolTipOpens"
             Closed="whenToolTipCloses"
             >
      <BulletDecorator>
        <BulletDecorator.Bullet>
          <Ellipse Height="10" Width="20" Fill="Blue"/>
        </BulletDecorator.Bullet>
        <TextBlock>Uses the ToolTip Class</TextBlock>
      </BulletDecorator>
    </ToolTip>
  </Ellipse.ToolTip>
</Ellipse>
//Create an ellipse that will have a 
//ToolTip control. 
Ellipse ellipse1 = new Ellipse();
ellipse1.Height = 25;
ellipse1.Width = 50;
ellipse1.Fill = Brushes.Gray;
ellipse1.HorizontalAlignment = HorizontalAlignment.Left;

//Create a tooltip and set its position.
ToolTip tooltip = new ToolTip();
tooltip.Placement = PlacementMode.Right;
tooltip.PlacementRectangle = new Rect(50, 0, 0, 0);
tooltip.HorizontalOffset = 10;
tooltip.VerticalOffset = 20;

//Create BulletDecorator and set it
//as the tooltip content.
BulletDecorator bdec = new BulletDecorator();
Ellipse littleEllipse = new Ellipse();
littleEllipse.Height = 10;
littleEllipse.Width = 20;
littleEllipse.Fill = Brushes.Blue;
bdec.Bullet = littleEllipse;
TextBlock tipText = new TextBlock();
tipText.Text = "Uses the ToolTip class";
bdec.Child = tipText;
tooltip.Content = bdec;

//set tooltip on ellipse
ellipse1.ToolTip = tooltip;
'Create an ellipse that will have a 
'ToolTip control. 
Dim ellipse1 As New Ellipse()
ellipse1.Height = 25
ellipse1.Width = 50
ellipse1.Fill = Brushes.Gray
ellipse1.HorizontalAlignment = HorizontalAlignment.Left

'Create a tooltip and set its position.
Dim tooltip As New ToolTip()
tooltip.Placement = PlacementMode.Right
tooltip.PlacementRectangle = New Rect(50, 0, 0, 0)
tooltip.HorizontalOffset = 10
tooltip.VerticalOffset = 20

'Create BulletDecorator and set it
'as the tooltip content.
Dim bdec As New BulletDecorator()
Dim littleEllipse As New Ellipse()
littleEllipse.Height = 10
littleEllipse.Width = 20
littleEllipse.Fill = Brushes.Blue
bdec.Bullet = littleEllipse
Dim tipText As New TextBlock()
tipText.Text = "Uses the ToolTip class"
bdec.Child = tipText
tooltip.Content = bdec

'set tooltip on ellipse
ellipse1.ToolTip = tooltip

注釈

を配置ToolTipする場合は、PlacementTargetPlacementPlacementRectangleHorizontalOffset、および の各プロパティをVerticalOffsetProperty設定します。 これらのプロパティは、 の場合 Popupと同じように動作します。 詳細については、「Popup Placement Behavior」を参照してください。

依存プロパティ情報

識別子フィールド HorizontalOffsetProperty
に設定されたメタデータ プロパティ true なし

適用対象

こちらもご覧ください