Inheritance: VisualSimpleBase
コード例 #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonRadioButtonActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonRadioButtonActionList(KryptonRadioButtonDesigner owner)
            : base(owner.Component)
        {
            // Remember the radio button instance
            _radioButton = owner.Component as KryptonRadioButton;

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }
コード例 #2
0
        /// <summary>
        /// Initialize a new instance of the KryptonRadioButtonActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonRadioButtonActionList(KryptonRadioButtonDesigner owner)
            : base(owner.Component)
        {
            // Remember the radio button instance
            _radioButton = owner.Component as KryptonRadioButton;

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }
コード例 #3
0
        private void UpdateRadioButtons()
        {
            if (_radioButtons.Count == 0)
            {
                _panelMainRadio.Visible = false;
            }
            else
            {
                _panelMainRadio.Controls.Clear();
                _panelMainRadio.Visible = true;

                Size maxButtonSize = Size.Empty;
                foreach (KryptonTaskDialogCommand command in _radioButtons)
                {
                    // Create and add a new radio button instance
                    KryptonRadioButton button = new KryptonRadioButton();
                    button.LabelStyle = LabelStyle.NormalPanel;
                    button.Values.Text = command.Text;
                    button.Values.ExtraText = command.ExtraText;
                    button.Values.Image = command.Image;
                    button.Values.ImageTransparentColor = command.ImageTransparentColor;
                    button.Enabled = command.Enabled;
                    button.CheckedChanged += new EventHandler(OnRadioButtonCheckedChanged);
                    button.Tag = command;
                    if (_defaultRadioButton == command)
                        button.Checked = true;
                    _panelMainRadio.Controls.Add(button);

                    // Note that largest radio button encountered
                    Size buttonSize = button.GetPreferredSize(Size.Empty);
                    maxButtonSize.Width = Math.Max(maxButtonSize.Width, buttonSize.Width);
                    maxButtonSize.Height = Math.Max(maxButtonSize.Height, buttonSize.Height);
                }

                // Enforce a maximum width to the commands
                maxButtonSize.Width = Math.Min(Math.Max(maxButtonSize.Width, 150), 400);

                // Position the radio buttons in a vertical stack and size owning panel
                Point offset = new Point(BUTTON_GAP - 1, 2);
                foreach (KryptonRadioButton button in _panelMainRadio.Controls)
                {
                    button.Location = offset;
                    button.Size = maxButtonSize;
                    offset.Y += maxButtonSize.Height;
                }

                // Size to the contained command controls
                _panelMainRadio.Size = new Size(maxButtonSize.Width, offset.Y);
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: yp25/Krypton
 public KryptonRadioButtonProxy(KryptonRadioButton checkBox)
 {
     _radioButton = checkBox;
 }