ToolStripItem.Alignmentとは? わかりやすく解説

ToolStripItem.Alignment プロパティ

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

項目が ToolStrip の先頭または末尾のいずれに合わせて配置されるかを示す値を取得または設定します

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

Public Property Alignment As
 ToolStripItemAlignment
Dim instance As ToolStripItem
Dim value As ToolStripItemAlignment

value = instance.Alignment

instance.Alignment = value
public ToolStripItemAlignment Alignment { get;
 set; }
public:
property ToolStripItemAlignment Alignment {
    ToolStripItemAlignment get ();
    void set (ToolStripItemAlignment value);
}
/** @property */
public ToolStripItemAlignment get_Alignment ()

/** @property */
public void set_Alignment (ToolStripItemAlignment
 value)
public function get Alignment
 () : ToolStripItemAlignment

public function set Alignment
 (value : ToolStripItemAlignment)

プロパティ
ToolStripItemAlignment 値の 1 つ既定値Left です。

例外例外
例外種類条件

InvalidEnumArgumentException

代入された値が、ToolStripItemAlignment 値ではありません。

解説解説

Alignment プロパティを ToolStripItem.RightToLeft プロパティと共に使用してToolStrip 内の項目の配置制御したり、既に配置されている項目を確認したりします

ToolStripItem.RightToLeft プロパティが No の場合Left として設定された項目は ToolStrip左揃え配置されRight として設定された項目は右揃え配置されます。

ToolStripItem.RightToLeft プロパティが Yes の場合Left として設定された項目は ToolStrip右揃え配置されRight として設定された項目は左揃え配置されます。

使用例使用例

Alignment プロパティ設定する方法次のコード例示します。このコード例は、ToolStripItem クラストピック取り上げているコード例一部分です。

' This utility method creates a RolloverItem 
' and adds it to a ToolStrip control.
 Private Function CreateRolloverItem( _
 ByVal owningToolStrip As ToolStrip, _
 ByVal txt As String, _
 ByVal f As Font, _
 ByVal imgKey As String,
 _
 ByVal tir As TextImageRelation, _
 ByVal backImgKey As String)
 As RolloverItem

     Dim item As New RolloverItem()

     item.Alignment = ToolStripItemAlignment.Left
     item.AllowDrop = False
     item.AutoSize = True

     item.BackgroundImage = owningToolStrip.ImageList.Images(backImgKey)
     item.BackgroundImageLayout = ImageLayout.Center
     item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText
     item.DoubleClickEnabled = True
     item.Enabled = True
     item.Font = f

     ' These assignments are equivalent. Each assigns an
     ' image from the owning toolstrip's image list.
     item.ImageKey = imgKey
     'item.Image = owningToolStrip.ImageList.Images[infoIconKey];
     'item.ImageIndex = owningToolStrip.ImageList.Images.IndexOfKey(infoIconKey);
     item.ImageScaling = ToolStripItemImageScaling.None

     item.Owner = owningToolStrip
     item.Padding = New Padding(2)
     item.Text = txt
     item.TextAlign = ContentAlignment.MiddleLeft
     item.TextDirection = ToolStripTextDirection.Horizontal
     item.TextImageRelation = tir

     Return item
 End Function
// This utility method creates a RolloverItem 
// and adds it to a ToolStrip control.
private RolloverItem CreateRolloverItem(
    ToolStrip owningToolStrip,
    string txt,
    Font f,
    string imgKey,
    TextImageRelation tir,
    string backImgKey)
{
    RolloverItem item = new RolloverItem();

    item.Alignment = ToolStripItemAlignment.Left;
    item.AllowDrop = false;
    item.AutoSize = true;

    item.BackgroundImage = owningToolStrip.ImageList.Images[backImgKey];
    item.BackgroundImageLayout = ImageLayout.Center;
    item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
    item.DoubleClickEnabled = true;
    item.Enabled = true;
    item.Font = f;

    // These assignments are equivalent. Each assigns an
    // image from the owning toolstrip's image list.
    item.ImageKey = imgKey;
    //item.Image = owningToolStrip.ImageList.Images[infoIconKey];
    //item.ImageIndex = owningToolStrip.ImageList.Images.IndexOfKey(infoIconKey);
    item.ImageScaling = ToolStripItemImageScaling.None;

    item.Owner = owningToolStrip;
    item.Padding = new Padding(2);
    item.Text = txt;
    item.TextAlign = ContentAlignment.MiddleLeft;
    item.TextDirection = ToolStripTextDirection.Horizontal;
    item.TextImageRelation = tir;

    return item;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ToolStripItemAlignment 列挙体

メモ : この列挙体は、.NET Framework version 2.0新しく追加されたものです。

ToolStrip 内の ToolStripItem の配置決定します

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

Public Enumeration ToolStripItemAlignment
Dim instance As ToolStripItemAlignment
public enum ToolStripItemAlignment
public enum class ToolStripItemAlignment
public enum ToolStripItemAlignment
public enum ToolStripItemAlignment
メンバメンバ
 メンバ説明
LeftToolStrip向きに応じてToolStripItemToolStrip左端または上端固定するよう指定しますSystem.Windows.Forms.RightToLeft の値が Yes場合Left としてマークされた項目は、ToolStrip右側揃えられます。 
RightToolStrip向きに応じてToolStripItemToolStrip右端または下端固定するよう指定しますSystem.Windows.Forms.RightToLeft の値が Yes場合Right としてマークされた項目は、ToolStrip左側揃えられます。 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からToolStripItem.Alignmentを検索した結果を表示しています。
Weblioに収録されているすべての辞書からToolStripItem.Alignmentを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からToolStripItem.Alignment を検索

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

辞書ショートカット

すべての辞書の索引

「ToolStripItem.Alignment」の関連用語

ToolStripItem.Alignmentのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS