ToolStripItem.Owner プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ToolStripItem.Owner プロパティの意味・解説 

ToolStripItem.Owner プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

この項目の所有者取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As ToolStripItem
Dim value As ToolStrip

value = instance.Owner

instance.Owner = value
public ToolStrip Owner { get; set;
 }
public:
property ToolStrip^ Owner {
    ToolStrip^ get ();
    void set (ToolStrip^ value);
}
/** @property */
public ToolStrip get_Owner ()

/** @property */
public void set_Owner (ToolStrip value)

プロパティ
ToolStripItem を所有しているか、これから所有する ToolStrip。

解説解説

Owner プロパティ使用してすべての ToolStripItem共通しToolStrip 自体定義されている ImageList などのオブジェクト検索します

項目が ToolStripOverflow に該当しても、Owner は同じままです。DisplayedItems コレクション内の特定の要素に対しては、Ownernull 参照 (Visual Basic では Nothing) に設定できますが、Items コレクション場合設定できません。

使用例使用例

Owner プロパティ使ったカスタム レンダリング方法を、次のコード例示します。このコード例は、ToolStripItem クラストピック取り上げているコード例一部分です。

' This method defines the painting behavior of the control.
' It performs the following operations:
'
' Computes the layout of the item's image and text.
' Draws the item's background image.
' Draws the item's image.
' Draws the item's text.
'
' Drawing operations are implemented in the 
' RolloverItemRenderer class.
Protected Overrides Sub
 OnPaint(e As PaintEventArgs)
   MyBase.OnPaint(e)
   
   If Not (Me.Owner Is
 Nothing) Then
      ' Find the dimensions of the image and the text 
      ' areas of the item. 
      Me.ComputeImageAndTextLayout()
      
      ' Draw the background. This includes drawing a highlighted 
      ' border when the mouse is in the client area.
      Dim ea As New ToolStripItemRenderEventArgs(e.Graphics,
 Me)
      Me.Owner.Renderer.DrawItemBackground(ea)
      
      ' Draw the item's image. 
      Dim irea As New ToolStripItemImageRenderEventArgs(e.Graphics,
 Me, imageRect)
      Me.Owner.Renderer.DrawItemImage(irea)
      
      ' If the item is on a drop-down, give its
      ' text a different highlighted color.
      Dim highlightColor As Color = IIf(Me.IsOnDropDown,
 Color.Salmon, SystemColors.ControlLightLight)
      
      ' Draw the text, and highlight it if the 
      ' the rollover state is true.
      Dim rea As New ToolStripItemTextRenderEventArgs(e.Graphics,
 Me, MyBase.Text, textRect, IIf(Me.rolloverValue,
 highlightColor, MyBase.ForeColor), MyBase.Font, MyBase.TextAlign)
      Me.Owner.Renderer.DrawItemText(rea)
   End If
 End Sub
// This method defines the painting behavior of the control.
// It performs the following operations:
//
// Computes the layout of the item's image and text.
// Draws the item's background image.
// Draws the item's image.
// Draws the item's text.
//
// Drawing operations are implemented in the 
// RolloverItemRenderer class.
protected override void OnPaint(PaintEventArgs
 e)
{
    base.OnPaint(e);

    if (this.Owner != null)
    {
        // Find the dimensions of the image and the text 
        // areas of the item. 
        this.ComputeImageAndTextLayout();

        // Draw the background. This includes drawing a highlighted
 
        // border when the mouse is in the client area.
        ToolStripItemRenderEventArgs ea = new ToolStripItemRenderEventArgs(
             e.Graphics,
             this);
        this.Owner.Renderer.DrawItemBackground(ea);

        // Draw the item's image. 
        ToolStripItemImageRenderEventArgs irea =
            new ToolStripItemImageRenderEventArgs(
            e.Graphics,
            this,
            imageRect );
        this.Owner.Renderer.DrawItemImage(irea);

        // If the item is on a drop-down, give its
        // text a different highlighted color.
        Color highlightColor = 
            this.IsOnDropDown ?
            Color.Salmon : SystemColors.ControlLightLight;

        // Draw the text, and highlight it if the 
        // the rollover state is true.
        ToolStripItemTextRenderEventArgs rea =
            new ToolStripItemTextRenderEventArgs(
            e.Graphics,
            this,
            base.Text,
            textRect,
            this.rolloverValue ? highlightColor : base.ForeColor
,
            base.Font,
            base.TextAlign);
        this.Owner.Renderer.DrawItemText(rea);
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ToolStripItem.Owner プロパティ」の関連用語

ToolStripItem.Owner プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ToolStripItem.Owner プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS