示例#1
0
 private void m_CollapseButton_Click(object sender, EventArgs e)
 {
     m_bCollapsed = !m_bCollapsed;
     UpdateCollapse();
     m_Groupbox.Focus();
     OnCollapseButtonClickEvent(new EventArgs());
 }
        private void HelperButton_Click(object sender, EventArgs e)
        {
            OnViewHelper();
            GroupBox helperGB = ViewHelper((sender as Button).Name.Replace("HelperButton", ""), (sender as Button).Parent as GroupBox, (sender as Button).Parent.Controls[(sender as Button).Name.Replace("HelperButton", "TextBox")] as TextBox);

            helperGB.Focus();
        }
        private void update(RepositoryBase repo)
        {
            flowLayoutPanel1.Controls.Clear();
            foreach (DonationCenter dc in repo.FindAll <DonationCenter>())
            {
                GroupBox box = new GroupBox();
                #region Card Creation
                box.Size = new Size(280, 120);
                Label name = new Label
                {
                    Font     = new Font(FontFamily.GenericSansSerif, 24.0f, FontStyle.Bold),
                    AutoSize = true,
                    Location = new Point(5, 15),
                    Text     = dc.name
                };
                box.Controls.Add(name);
                Font smallFont = new Font(FontFamily.GenericSansSerif, 14.0f);

                MenuItem item = new MenuItem("Delete");
                item.Click += ContextMenu1_Click;
                item.Tag    = dc.id;
                ContextMenu cm = new ContextMenu();
                cm.MenuItems.Add(item);
                box.ContextMenu = cm;
                box.Click      += new EventHandler(delegate(Object o, EventArgs a) { box.Focus(); box.BackColor = Color.AliceBlue; fill(dc.id); });
                //box.GotFocus += new EventHandler(delegate (Object o, EventArgs a) { });
                box.LostFocus += new EventHandler(delegate(Object o, EventArgs a) { box.BackColor = Color.Empty; });
                #endregion
                flowLayoutPanel1.Controls.Add(box);
            }
        }
示例#4
0
        public static bool IsBoxChecked(GroupBox grpBox)
        {
            theTruth = false;
            List <CheckBox> checkList = new List <CheckBox>();

            checkList = grpBox.Controls.OfType <CheckBox>().ToList <CheckBox>();
            foreach (CheckBox C in checkList)
            {
                if (C.Checked == true)
                {
                    theTruth = true;
                }
            }
            if (theTruth == false)
            {
                grpBox.Focus();
                MessageBox.Show("Please check at least one box", "Input Error");
            }
            return(theTruth);
        }
示例#5
0
        public static bool IsRadioSelected(GroupBox grpBox)
        {
            theTruth = false;
            List <RadioButton> radioList = new List <RadioButton>();

            radioList = grpBox.Controls.OfType <RadioButton>().ToList <RadioButton>();
            foreach (RadioButton B in radioList)
            {
                if (B.Checked == true)
                {
                    theTruth = true;
                }
            }

            if (theTruth == false)
            {
                grpBox.Focus();
                MessageBox.Show("Please select a radio button", "Input Error");
            }
            return(theTruth);
        }
示例#6
0
 private void update(RepositoryBase repo)
 {
     flowLayoutPanel1.Controls.Clear();
     foreach (Doctor doc in repo.FindAll <Doctor>())
     {
         GroupBox box = new GroupBox();
         #region Card Creation
         box.Size = new Size(280, 120);
         Label name = new Label
         {
             Font     = new Font(FontFamily.GenericSansSerif, 24.0f, FontStyle.Bold),
             AutoSize = true,
             Location = new Point(5, 15),
             Text     = doc.name
         };
         box.Controls.Add(name);
         Font  smallFont = new Font(FontFamily.GenericSansSerif, 14.0f);
         Label mylabel1  = new Label
         {
             Font     = smallFont,
             AutoSize = true,
             Location = new Point(5, 55),
             Text     = "speciality:"
         };
         box.Controls.Add(mylabel1);
         Label speciality = new Label
         {
             Font     = smallFont,
             AutoSize = true,
             Location = new Point(100, 55),
             Text     = doc.speciality
         };
         box.Controls.Add(speciality);
         Label mylabel2 = new Label
         {
             Location = new Point(5, 90),
             AutoSize = true,
             Font     = smallFont,
             Text     = "hospital"
         };
         box.Controls.Add(mylabel2);
         Label hospital = new Label
         {
             Font     = smallFont,
             AutoSize = true,
             Location = new Point(100, 90),
             Text     = doc.hospital
         };
         box.Controls.Add(hospital);
         MenuItem item = new MenuItem("Delete");
         item.Click += ContextMenu1_Click;
         item.Tag    = doc.id;
         ContextMenu cm = new ContextMenu();
         cm.MenuItems.Add(item);
         box.ContextMenu = cm;
         box.Click      += new EventHandler(delegate(Object o, EventArgs a) { box.Focus(); box.BackColor = Color.AliceBlue; fill(doc.id.ToString()); });
         //box.GotFocus += new EventHandler(delegate (Object o, EventArgs a) { });
         box.LostFocus += new EventHandler(delegate(Object o, EventArgs a) { box.BackColor = Color.Empty; });
         #endregion
         flowLayoutPanel1.Controls.Add(box);
     }
 }