GrapeCity.Win.Pickers 名前空間 > ItemGroupStyle クラス : BackColor プロパティ |
次のサンプルコードは、GcFontPicker.ItemGroupStyleプロパティ上でBackColorプロパティを設定して、フォントドロップダウンリスト内のグループの背景色を設定します。この例を実行するには、以下のコードをSystem.Windows.Forms.Formに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出す必要があります。
private void CreateGcFontPickerWithItemGroupStyle() { // 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 BackColor and ForeColor of the groups. gcFontPicker.ItemGroupStyle.BackColor = Color.Green; gcFontPicker.ItemGroupStyle.ForeColor = Color.Gold; // Set the Font of the groups. gcFontPicker.ItemGroupStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, GraphicsUnit.Point); // Set the caption of all fonts group. gcFontPicker.ItemGroupStyle.AllFontsText = "My All Fonts"; // Set the caption of preferred fonts group. gcFontPicker.ItemGroupStyle.PreferredFontsText = "My Preferred Fonts"; // Add some items to the preferred fonts in order to show the group. gcFontPicker.PreferredFonts.AddRange(new FontInfo[] { gcFontPicker.AllFonts["MingLiU"], gcFontPicker.AllFonts["MS UI Gothic"], }); // Set the caption of recently used fonts. gcFontPicker.ItemGroupStyle.RecentlyUsedFontsText = "My Recently Used Fonts"; // Add some items to the recently used fonts in order to show the group. gcFontPicker.RecentlyUsedFonts.AddRange(new FontInfo[] { gcFontPicker.AllFonts["Nina"], gcFontPicker.AllFonts["Vrinda"] }); // adds gcFontPicker to the form. this.Controls.Add(gcFontPicker); }
Private Sub CreateGcFontPickerWithItemGroupStyle() ' 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 BackColor and ForeColor of the groups. gcFontPicker.ItemGroupStyle.BackColor = Color.Green gcFontPicker.ItemGroupStyle.ForeColor = Color.Gold ' Set the Font of the groups. gcFontPicker.ItemGroupStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, GraphicsUnit.Point) ' Set the caption of all fonts group. gcFontPicker.ItemGroupStyle.AllFontsText = "My All Fonts" ' Set the caption of preferred fonts group. gcFontPicker.ItemGroupStyle.PreferredFontsText = "My Preferred Fonts" ' Add some items to the preferred fonts in order to show the group. gcFontPicker.PreferredFonts.AddRange(New FontInfo() {gcFontPicker.AllFonts("MingLiU"), gcFontPicker.AllFonts("MS UI Gothic")}) ' Set the caption of recently used fonts. gcFontPicker.ItemGroupStyle.RecentlyUsedFontsText = "My Recently Used Fonts" ' Add some items to the recently used fonts in order to show the group. gcFontPicker.RecentlyUsedFonts.AddRange(New FontInfo() {gcFontPicker.AllFonts("Nina"), gcFontPicker.AllFonts("Vrinda")}) ' 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