Пример #1
0
 //Form kapatılıyor ve tüm işlemler sıfırlanıyor
 private void btnClose_Click(object sender, EventArgs e)
 {
     teammember = null;
     this.Close();
 }
Пример #2
0
        private void AddTeamMemberToPanel(TeamMember tm)
        {
            Panel newmember = new Panel();

            newmember.Width  = 237;
            newmember.Height = 100;


            //convert rgb to Color
            string colorcode = tm.ColorCode;
            int    r         = Convert.ToInt32(colorcode.Split(',')[0]);
            int    g         = Convert.ToInt32(colorcode.Split(',')[1]);
            int    b         = Convert.ToInt32(colorcode.Split(',')[2]);
            Color  tmColor   = Color.FromArgb(r, g, b);



            newmember.BackColor   = tmColor;
            newmember.Dock        = DockStyle.Top;
            newmember.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;

            PictureBox pic = new PictureBox();

            pic.Name   = "pic_" + tm.MemberID.ToString();
            pic.Width  = 82;
            pic.Height = 86;

            if (tm.ImagePath == "")
            {
                pic.BackgroundImage = Properties.Resources.member;
            }
            else
            {
                pic.BackgroundImage = Image.FromFile(@"MemberImages\" + tm.ImagePath);
            }


            pic.Left = 5;
            pic.Top  = 5;
            pic.BackgroundImageLayout = ImageLayout.Stretch;
            newmember.Controls.Add(pic);
            pic.Click += team_Member_Details_Click;

            Label name = new Label();

            name.Text      = tm.Name + " " + tm.Surname;
            name.AutoSize  = false;
            name.Width     = 134;
            name.Height    = 40;
            name.BackColor = System.Drawing.Color.White;
            name.Left      = 93;
            name.Top       = 5;
            name.TextAlign = ContentAlignment.MiddleCenter;
            newmember.Controls.Add(name);

            Label title = new Label();

            title.Text      = tm.Title;
            title.AutoSize  = false;
            title.Width     = 134;
            title.Height    = 40;
            title.BackColor = System.Drawing.Color.White;
            title.Left      = 93;
            title.Top       = 50;
            title.TextAlign = ContentAlignment.MiddleCenter;
            newmember.Controls.Add(title);


            pnlTeamMembers.Controls.Add(newmember);
        }