GrapeCity.Win.Pickers 名前空間 : ItemStyle クラス |
次のサンプルコードは、ItemStyleを使用してドロップダウンリスト内の項目の外観をカスタマイズする方法を示します。この例を実行するには、以下のコードをSystem.Windows.Forms.Formに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出す必要があります。また、MonospacedFontImage、OpenTypeFontImage、SymbolFontImage、およびTrueTypeFontImageという名前のイメージファイルがCドライブのルートディレクトリーに存在する必要があります。
private void CreateGcFontPickerWithItemStyle() { // 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, 50); // Set the item's BackColor and ForeColor. gcFontPicker.ItemStyle.BackColor = Color.Green; gcFontPicker.ItemStyle.ForeColor = Color.Gold; // Use the Font set by user not the Font represented by the item. gcFontPicker.ItemStyle.ShowFontNamesInFont = false; gcFontPicker.ItemStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, GraphicsUnit.Point); // 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 CreateGcFontPickerWithItemStyle() ' 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, 50) ' Set the item's BackColor and ForeColor. gcFontPicker.ItemStyle.BackColor = Color.Green gcFontPicker.ItemStyle.ForeColor = Color.Gold ' Use the Font set by user not the Font represented by the item. gcFontPicker.ItemStyle.ShowFontNamesInFont = False gcFontPicker.ItemStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, GraphicsUnit.Point) ' 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
System.Object
GrapeCity.Win.Pickers.ItemStyle
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