GrapeCity.Win.Containers 名前空間 > GcGroupBoxControlBase クラス : ItemSettings プロパティ |
Public ReadOnly Property ItemSettings As GroupItemSettings
public GroupItemSettings ItemSettings {get;}
次のサンプルコードは、いくつかの項目を含むGcCheckedGroupBoxコントロールを作成する方法を示します。また、ItemSettingsプロパティを使用して項目の外観をカスタマイズする方法も示します。この例では、グループボックス内のすべての項目でボタンの外観を使用しています。このサンプルコードを実行するには、以下のコードをSystem.Windows.Forms.Formプロジェクトに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出します。
private void CreateMyGcCheckedGroupBoxWithItemSettings() { GcCheckedGroupBox gcCheckedGroupBox = new GcCheckedGroupBox(); // Set gcRadioGroupBox1's location. gcCheckedGroupBox.Location = new Point(10, 10); gcCheckedGroupBox.Text = "Button appearance items"; // Create some radio button items. CheckBoxItem[] items = new CheckBoxItem[] { new CheckBoxItem("item1"), new CheckBoxItem("item2"), new CheckBoxItem("item3"), }; // First add some items. gcCheckedGroupBox.Items.AddRange(items); // Use flat theme to draw gcCheckedGroupBox. gcCheckedGroupBox.FlatStyle = GrapeCity.Win.Common.FlatStyleEx.Flat; // Set all items as button appearance. gcCheckedGroupBox.ItemSettings.Appearance = Appearance.Button; gcCheckedGroupBox.ItemSettings.UseVisualStyleBackColor = false; // Set all items' background and foreground color. gcCheckedGroupBox.ItemSettings.BackColor = Color.AliceBlue; gcCheckedGroupBox.ItemSettings.ForeColor = Color.Blue; // Set all items' font. gcCheckedGroupBox.ItemSettings.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); // Set all items' TextEffect. gcCheckedGroupBox.ItemSettings.TextEffect = GrapeCity.Win.Common.TextEffect.Raised; // Customize the flat appearance. gcCheckedGroupBox.ItemSettings.FlatAppearance.BorderColor = Color.Violet; gcCheckedGroupBox.ItemSettings.FlatAppearance.BorderSize = 2; gcCheckedGroupBox.ItemSettings.FlatAppearance.CheckedBackColor = Color.Red; gcCheckedGroupBox.ItemSettings.FlatAppearance.MouseDownBackColor = Color.RosyBrown; gcCheckedGroupBox.ItemSettings.FlatAppearance.MouseOverBackColor = Color.Silver; // Customize the layout of items. gcCheckedGroupBox.LayoutSettings.LayoutMode = LayoutMode.Flow; gcCheckedGroupBox.LayoutSettings.HorizontalSpace = 5; // Add gcRadioGroupBox to the form. this.Controls.Add(gcCheckedGroupBox); }
Private Sub CreateMyGcCheckedGroupBoxWithItemSettings() Dim gcCheckedGroupBox As New GcCheckedGroupBox() ' Set gcRadioGroupBox1's location. gcCheckedGroupBox.Location = New Point(10, 10) gcCheckedGroupBox.Text = "Button appearance items" ' Create some radio button items. Dim items As CheckBoxItem() = New CheckBoxItem() {New CheckBoxItem("item1"), New CheckBoxItem("item2"), New CheckBoxItem("item3")} ' First add some items. gcCheckedGroupBox.Items.AddRange(items) ' Use flat theme to draw gcCheckedGroupBox. gcCheckedGroupBox.FlatStyle = FlatStyleEx.Flat ' Set all items as button appearance. gcCheckedGroupBox.ItemSettings.Appearance = Appearance.Button gcCheckedGroupBox.ItemSettings.UseVisualStyleBackColor = False ' Set all items' background and foreground color. gcCheckedGroupBox.ItemSettings.BackColor = Color.AliceBlue gcCheckedGroupBox.ItemSettings.ForeColor = Color.Blue ' Set all items' font. gcCheckedGroupBox.ItemSettings.Font = New System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) ' Set all items' TextEffect. gcCheckedGroupBox.ItemSettings.TextEffect = TextEffect.Raised ' Customize the flat appearance. gcCheckedGroupBox.ItemSettings.FlatAppearance.BorderColor = Color.Violet gcCheckedGroupBox.ItemSettings.FlatAppearance.BorderSize = 2 gcCheckedGroupBox.ItemSettings.FlatAppearance.CheckedBackColor = Color.Red gcCheckedGroupBox.ItemSettings.FlatAppearance.MouseDownBackColor = Color.RosyBrown gcCheckedGroupBox.ItemSettings.FlatAppearance.MouseOverBackColor = Color.Silver ' Customize the layout of items. gcCheckedGroupBox.LayoutSettings.LayoutMode = LayoutMode.Flow gcCheckedGroupBox.LayoutSettings.HorizontalSpace = 5 ' Add gcRadioGroupBox to the form. Me.Controls.Add(gcCheckedGroupBox) 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