PowerTools PlusPak for Windows Forms 8.0J
SymbolFontImage プロパティ
使用例 

シンボルフォントを表す項目に表示されるイメージを取得または設定します。
構文
Public Property SymbolFontImage As Image
public Image SymbolFontImage {get; set;}

プロパティ値

シンボルフォントを表す項目に表示されるSystem.Drawing.Image
解説
このユーザー指定のSymbolFontImageは、ShowFontTypeImagetrueの場合にのみ、項目に表示できます。
使用例

次のサンプルコードは、フォントドロップダウンリスト内の各フォントタイプ項目に異なるイメージを設定する方法を示します。この例を実行するには、以下のコードをSystem.Windows.Forms.Formに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出す必要があります。また、MonospacedFontImage、OpenTypeFontImage、SymbolFontImage、およびTrueTypeFontImageという名前のイメージファイルがCドライブのルートディレクトリーに存在する必要があります。

private void CustomItemStyleWithFontTypeImages()
{
    this.button1.Visible = false;

    // Create an instance of GcFontPicker control.
    GcFontPicker gcFontPicker = new GcFontPicker();

    // Initialize the Name and Location of the gcFontPicker.
    gcFontPicker.Name = "gcFontPicker";
    gcFontPicker.Location = new Point(10, 10);

    // Set different images for different font types.
    gcFontPicker.ItemStyle.ShowFontTypeImage = true;
    gcFontPicker.ItemStyle.MonospacedFontImage = Bitmap.FromFile("C:\\MonospacedFontImage.bmp");
    gcFontPicker.ItemStyle.OpenTypeFontImage = Bitmap.FromFile("C:\\OpenTypeFontImage.bmp");
    gcFontPicker.ItemStyle.SymbolFontImage = Bitmap.FromFile("C:\\SymbolFontImage.bmp");
    gcFontPicker.ItemStyle.TrueTypeFontImage = Bitmap.FromFile("C:\\TrueTypeFontImage.bmp");

    // adds gcFontPicker to the form.
    this.Controls.Add(gcFontPicker);
}
Private Sub CustomItemStyleWithFontTypeImages()
    Me.button1.Visible = False

    ' Create an instance of GcFontPicker control.
    Dim gcFontPicker As New GcFontPicker()

    ' Initialize the Name and Location of the gcFontPicker.
    gcFontPicker.Name = "gcFontPicker"
    gcFontPicker.Location = New Point(10, 10)

    ' Set different images for different font types.
    gcFontPicker.ItemStyle.ShowFontTypeImage = True
    gcFontPicker.ItemStyle.MonospacedFontImage = Bitmap.FromFile("C:\MonospacedFontImage.bmp")
    gcFontPicker.ItemStyle.OpenTypeFontImage = Bitmap.FromFile("C:\OpenTypeFontImage.bmp")
    gcFontPicker.ItemStyle.SymbolFontImage = Bitmap.FromFile("C:\SymbolFontImage.bmp")
    gcFontPicker.ItemStyle.TrueTypeFontImage = Bitmap.FromFile("C:\TrueTypeFontImage.bmp")

    ' adds gcFontPicker to the form.
    Me.Controls.Add(gcFontPicker)
End Sub
プラットフォーム

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

参照

ItemStyle クラス
ItemStyle メンバ

Send Feedback