예제 #1
0
        public void SetButtons(ChoiceWndButton[] ButtonsArray, ChoiceWndButton Default = null)
        {
            flowLayoutPanel1.Controls.Clear();

            foreach (var btn in ButtonsArray)
            {
                if (btn.Text == null)
                {
                    continue;
                }

                RadioButton r = new RadioButton();
                r.Text = btn.Text;
                r.Tag  = new KeyValuePair <ChoiceWndButton, object>(btn, btn.Tag);

                r.Margin   = new Padding(2);
                r.AutoSize = true;

                flowLayoutPanel1.Controls.Add(r);

                if (btn == Default)
                {
                    r.Checked = true;
                    flowLayoutPanel1.ScrollControlIntoView(r);
                }
            }
        }
예제 #2
0
        public UI.Forms.DialogAnswer GetAnswer()
        {
            string          value  = "";
            object          tag    = null;
            ChoiceWndButton button = null;

            foreach (RadioButton btn in flowLayoutPanel1.Controls)
            {
                if (btn.Checked)
                {
                    value  = btn.Text;
                    tag    = ((KeyValuePair <ChoiceWndButton, object>)btn.Tag).Value;
                    button = ((KeyValuePair <ChoiceWndButton, object>)btn.Tag).Key;
                    break;
                }
            }
            return(new UI.Forms.DialogAnswer(value, result, tag)
            {
                ChoiceWndButton = button
            });
        }