GrapeCity.Win.Pickers 名前空間 > GcFontPicker クラス : HideSelection プロパティ |
次のサンプルコードは、フォントを選択するためのGcFontPickerコントロールを作成して使用する方法を示します。また、HideSelectionプロパティの使用方法も示します。この例を実行するには、button1という名前のSystem.Windows.Forms.Buttonインスタンスを含むSystem.Windows.Forms.Formに以下のコードを追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出す必要があります。
private void CreateMyFontPicker() { // Create an instance of GcFontPicker control GcFontPicker gcFontPicker = new GcFontPicker(); // Initialize the Name and Location of gcFontPicker. gcFontPicker.Name = "gcFontPicker"; gcFontPicker.Location = new Point(10, 50); // Remains hightlight the text of gcFontPicker when gcFontPicker lost focus. gcFontPicker.HideSelection = false; // Hightlight the text of gcFontPicker when gcFontPicker gets focus. gcFontPicker.HighlightText = true; // Show a ToolTip for the item whose width extends the width of drop-down list. gcFontPicker.ShowOverflowTips = true; gcFontPicker.SelectedFontChanged += new EventHandler(GcFontPicker_SelectedFontChanged); // Add gcFontPicker to the form. this.Controls.Add(gcFontPicker); } // Change the button1's font to the Font created by gcFontPicker. private void GcFontPicker_SelectedFontChanged(object sender, EventArgs e) { this.button1.Font = (sender as GcFontPicker).CreateFont(); }
Private Sub CreateMyFontPicker() ' Create an instance of GcFontPicker control Dim gcFontPicker As New GcFontPicker() ' Initialize the Name and Location of gcFontPicker. gcFontPicker.Name = "gcFontPicker" gcFontPicker.Location = New Point(10, 50) ' Remains hightlight the text of gcFontPicker when gcFontPicker lost focus. gcFontPicker.HideSelection = False ' Hightlight the text of gcFontPicker when gcFontPicker gets focus. gcFontPicker.HighlightText = True ' Show a ToolTip for the item whose width extends the width of drop-down list. gcFontPicker.ShowOverflowTips = True AddHandler gcFontPicker.SelectedFontChanged, AddressOf GcFontPicker_SelectedFontChanged ' Add gcFontPicker to the form. Me.Controls.Add(gcFontPicker) End Sub ' Change the button1's font to the Font created by gcFontPicker. Private Sub GcFontPicker_SelectedFontChanged(ByVal sender As Object, ByVal e As EventArgs) Me.button1.Font = TryCast(sender, GcFontPicker).CreateFont() 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