/// <summary> /// Chọn hình /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Pic_Avatar_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Filter = "JPG (*.jpg)|*.jpg| PNG (*.png)|*.png"; if (open.ShowDialog() == DialogResult.OK) { CirclePictureBox cp = sender as CirclePictureBox; cp.Image = Image.FromFile(open.FileName); User.UserAvaPath = open.FileName; } }
public fMain() { InitializeComponent(); lbl_Name.Text = User.UserName; #region Set Rounded Border for pic_Avatar CirclePictureBox pic_Avatar = new CirclePictureBox(); try { pic_Avatar.Image = Image.FromFile(User.UserAvaPath); } catch { pic_Avatar.Image = global::PTLEnglish.Properties.Resources.avatar_default; } pic_Avatar.Location = new Point(22, 6); pic_Avatar.Size = new Size(100, 100); pic_Avatar.SizeMode = PictureBoxSizeMode.Zoom; pnl_Info_Content.Controls.Add(pic_Avatar); pic_Avatar.Click += Pic_Avatar_Click; #endregion #region Hide ScrollBar fpnl_Course_Content.AutoScroll = false; fpnl_Course_Content.HorizontalScroll.Enabled = false; fpnl_Course_Content.HorizontalScroll.Visible = false; fpnl_Course_Content.HorizontalScroll.Maximum = 0; fpnl_Course_Content.VerticalScroll.Enabled = false; fpnl_Course_Content.VerticalScroll.Visible = false; fpnl_Course_Content.VerticalScroll.Maximum = 0; fpnl_Course_Content.AutoScroll = true; #endregion }