private void showBtn_Click(object sender, System.EventArgs e)
        {
            NTaskDialog dlg = new NTaskDialog();

            dlg.Title         = "Q2 2007 Radio Buttons Support";
            dlg.Content.Text  = "<font size='12' face='Trebuchet MS'>Task Dialog <b>Radio Buttons</b> example</font>";
            dlg.Content.Image = NSystemImages.Information;
            dlg.Content.Style.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            dlg.Content.ImageSize = new NSize(32, 32);
            dlg.PreferredWidth    = 300;

            if (m_arrButtons.Count > 0)
            {
                NRadioBoxElement[] buttons = new NRadioBoxElement[m_arrButtons.Count];
                m_arrButtons.CopyTo(buttons);
                dlg.RadioButtons = buttons;
            }

            dlg.Show();

            NRadioBoxElement box = dlg.CheckedRadioButton;

            if (box != null)
            {
                checkedButtonLabel.Text = box.Text;
            }
            else
            {
                checkedButtonLabel.Text = "None";
            }

            dlg.RadioButtons = null;
            dlg.Dispose();
        }
        private void removeBtn_Click(object sender, System.EventArgs e)
        {
            NRadioBoxElement box = buttonsList.SelectedItemTag as NRadioBoxElement;

            if (box == null)
            {
                return;
            }

            m_arrButtons.Remove(box);
            buttonsList.Items.RemoveAt(buttonsList.SelectedIndex);
            buttonProperties.SelectedObject = null;
        }
        private void addBtn_Click(object sender, System.EventArgs e)
        {
            NRadioBoxElement box = new NRadioBoxElement();

            m_arrButtons.Add(box);

            box.Text = "Test <b>Radio</b> Button " + m_arrButtons.Count;

            NListBoxItem item = new NListBoxItem();

            item.Tag  = box;
            item.Text = "Button " + m_arrButtons.Count;

            buttonsList.Items.Add(item);

            buttonProperties.SelectedObject = box;
        }
        private void buttonsList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NRadioBoxElement box = buttonsList.SelectedItemTag as NRadioBoxElement;

            buttonProperties.SelectedObject = box;
        }
예제 #5
0
        public NThemableElementsUC(MainForm f) : base(f)
        {
            InitializeComponent();

            Dock = DockStyle.Fill;

            NRectShape shape = new NRectShape();

            shape.StrokeStyle = new NStrokeStyle(3, Color.Brown);

            m_Host             = new NUIElementHost();
            m_ElementContainer = new NUIElementContainer();
            m_ElementContainer.Style.Background = shape;
            m_Host.Bounds = new Rectangle(10, 10, 250, 250);

            //add one button
            NPushButtonElement button = new NPushButtonElement();

            button.Text   = "Push Button";
            button.Bounds = new NRectangle(10, 10, 100, 24);
            m_ElementContainer.AddChild(button);

            //add one checkbox
            NCheckBoxElement checkBox = new NCheckBoxElement();

            checkBox.Text        = "Check Box";
            checkBox.ThreeStates = true;
            checkBox.Bounds      = new NRectangle(10, 36, 100, 24);
            m_ElementContainer.AddChild(checkBox);

            //add one radiobox
            NRadioBoxElement radioBox = new NRadioBoxElement();

            radioBox.Text   = "Radio Box 1";
            radioBox.Bounds = new NRectangle(10, 62, 100, 24);
            m_ElementContainer.AddChild(radioBox);

            radioBox        = new NRadioBoxElement();
            radioBox.Text   = "Radio Box 2";
            radioBox.Bounds = new NRectangle(120, 62, 100, 24);
            m_ElementContainer.AddChild(radioBox);

            NCheckButtonElement checkButton = new NCheckButtonElement();

            checkButton.Text   = "Check Button";
            checkButton.Bounds = new NRectangle(10, 88, 100, 24);
            m_ElementContainer.AddChild(checkButton);

            NRadioButtonElement radioButton = new NRadioButtonElement();

            radioButton.Text   = "Radio Button 1";
            radioButton.Bounds = new NRectangle(10, 116, 100, 24);
            m_ElementContainer.AddChild(radioButton);

            radioButton        = new NRadioButtonElement();
            radioButton.Text   = "Radio Button 2";
            radioButton.Bounds = new NRectangle(120, 116, 100, 24);
            m_ElementContainer.AddChild(radioButton);

            m_Host.Element = m_ElementContainer;
            m_Host.Parent  = this;
        }