GrapeCity.Win.Pickers 名前空間 > GcFontPicker クラス : ShowAllFonts プロパティ |
次のサンプルコードは、GcFontPicker コントロールのお気に入りフォントを独自に定義する方法を示します。また、ShowPreferredFonts プロパティの使用方法も示します。このサンプルコードを実行するには、以下のコードを System.Windows.Forms.Form プロジェクトに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出します。
private void CreateGcFontPickerWithPreferredFonts() { // 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); // Initialize PreferredFonts. gcFontPicker.ShowPreferredFonts = true; gcFontPicker.ShowAllFonts = true; gcFontPicker.PreferredFonts.AddRange(new FontInfo[] { new FontInfo("MingLiU", "Represents MingLiU Font"), new FontInfo("MS UI Gothic","Represents MS UI Gothic Font"), new FontInfo("Nina","Represents Nina Font"), new FontInfo("Vrinda","Represents Vrinda Font"), }); gcFontPicker.ItemGroupStyle.PreferredFontsText = "My Preferred Fonts"; // Set the SelectedFont to the first item of PreferredFonts. gcFontPicker.SelectedFontInfo = gcFontPicker.PreferredFonts[0]; // adds gcFontPicker to the form. this.Controls.Add(gcFontPicker); }
Private Sub CreateGcFontPickerWithPreferredFonts() ' 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) ' Initialize PreferredFonts. gcFontPicker.ShowPreferredFonts = True gcFontPicker.ShowAllFonts = True gcFontPicker.PreferredFonts.AddRange(New FontInfo() {New FontInfo("MingLiU", "Represents MingLiU Font"), New FontInfo("MS UI Gothic", "Represents MS UI Gothic Font"), New FontInfo("Nina", "Represents Nina Font"), New FontInfo("Vrinda", "Represents Vrinda Font")}) gcFontPicker.ItemGroupStyle.PreferredFontsText = "My Preferred Fonts" ' Set the SelectedFontInfo to the first item of PreferredFonts. gcFontPicker.SelectedFontInfo = gcFontPicker.PreferredFonts(0) ' 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