private void DeleteSubForm(Button sender) { Controls["LBL" + sender.Name.Substring(1)].Visible = true; Controls["PNL_SettingsForm"].Dispose(); Controls["PB_triangle"].Dispose(); sender.BackColor = Color.White; sender.BackgroundImage = Main.GetImage(sender.Name.Substring(2) + "_hover"); sender.Width = 200; int pX = sender.Name == "B_lang" ? 0 : sender.Name == "B_password" ? 200 : 400; sender.Location = new Point(pX, sender.Location.Y); if (sender.Name == "B_lang") { Form_Lang(); } else if (sender.Name == "B_password") { Form_Password(sender); } else { Form_Fonts(sender); } }
// Actions sur les sous-forms private void CreateSubForm(Button sender) { Controls["LBL" + sender.Name.Substring(1)].Visible = false; sender.BackColor = Main.GetColor(); sender.BackgroundImage = Main.GetImage(sender.Name.Substring(2) + "_small"); sender.Width = 101; if (sender.Location.X < this.Width / 2) { sender.Location = new Point(0, 0); } else { sender.Location = new Point(this.Width - (sender.Width + 16), 0); } AddPanel(sender); if (sender.Name == "B_lang") { Form_Lang(); } else if (sender.Name == "B_password") { Form_Password(sender); } else { Form_Fonts(sender); } }
public static Image Img_ToColor(string imgName, bool start) { Bitmap img = new Bitmap(Main.GetImage(imgName)); if (imgName[0] != '_') { for (int i = 0; i < img.Width; i++) { for (int j = 0; j < img.Height; j++) { Color pixel = img.GetPixel(i, j); if ((start && (pixel.R > Main.BLUE.R * 0.9 || pixel.G > Main.BLUE.G * 0.9 || pixel.B > Main.BLUE.B * 0.9)) || (pixel.R > Main.previousColor.R * 0.9 || pixel.G > Main.previousColor.G * 0.9 || pixel.B > Main.previousColor.B * 0.9)) { Color newColor = Main.GetColor(); pixel = Color.FromArgb(pixel.A, newColor.R, newColor.G, newColor.B); img.SetPixel(i, j, pixel); } } } Main.previousColor = Main.GetColor(); } return(img); }
private void Button_Leave(object send, EventArgs e) { if (!bClicked) { Button sender = (Button)send; sender.BackColor = Color.White; sender.BackgroundImage = Main.GetImage(sender.Name.Substring(2)); Controls.Remove(Controls["LBL" + sender.Name.Substring(1)]); } }
private void Button_Enter(object send, EventArgs e) { if (!bClicked) { Button sender = (Button)send; sender.BackColor = Main.GetColor(); sender.FlatAppearance.MouseOverBackColor = Main.GetColor(); sender.BackgroundImage = Main.GetImage(sender.Name.Substring(2) + "_hover"); AddLabel(sender); } }
// OPÉRATIONS SUR LES IMAGES public static Image Img_ToWhite(string imgName) { Bitmap img = new Bitmap(Main.GetImage(imgName)); for (int i = 0; i < img.Width; i++) { for (int j = 0; j < img.Height; j++) { Color pixel = img.GetPixel(i, j); if ((pixel.R > Main.GetColor().R * 0.9 || pixel.G > Main.GetColor().G * 0.9 || pixel.B > Main.GetColor().B * 0.9)) { pixel = Color.FromArgb(pixel.A, Color.White.R, Color.White.G, Color.White.B); img.SetPixel(i, j, pixel); } } } return(img); }
/// <summary> /// Enter Modification Mode. /// </summary> /// <param name="id"></param> /// <param name="username"></param> /// <param name="name"></param> /// <param name="lastName"></param> public UserCU(int id, string username, string name, string lastName) : this() { userId = id; tb_Username.Text = username; tb_Name.Text = name; tb_LastName.Text = lastName; lb_ResetPassword.Visible = true; lb_ResetPassword.Show(); Modify = true; bt_AddUser.Image = Main.GetImage("EditUser"); Text = Main.resManager.GetString("UserCU_Header_Modify", Main.culInfo); Main.UpdateFonts(this); bt_AddUser.FlatAppearance.MouseDownBackColor = Main.GetColor(); bt_AddUser.Image = Main.Img_ToColor("EditUser", true); }
private Bitmap ChangeImageColor_GetPixel(string imgName) { Bitmap img = new Bitmap(Main.GetImage(imgName)); for (int i = 0; i < img.Width; i++) { for (int j = 0; j < img.Height; j++) { Color pixel = img.GetPixel(i, j); if ((pixel.R > 30 || pixel.G > 100 || pixel.B > 150)) { Color newColor = Main.GetColor(); pixel = Color.FromArgb(pixel.A, newColor.R, newColor.G, newColor.B); img.SetPixel(i, j, pixel); } } } return(img); }
private void bt_Logout_MouseLeave(object sender, EventArgs e) { ((Button)sender).Image = Main.GetImage("Unlocked_Blue_small"); }
private void bt_Logout_MouseEnter(object sender, EventArgs e) { ((Button)sender).Image = Main.GetImage("Locked_Blue_small"); ((Button)sender).FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; }
private void bt_Back_MouseLeave(object sender, EventArgs e) { ((Button)sender).BackColor = Color.White; ((Button)sender).ForeColor = Color.Black; ((Button)sender).Image = Main.GetImage(((Button)sender).Name.Substring(3)); }
private void bt_Back_MouseEnter(object sender, EventArgs e) { ((Button)sender).BackColor = Color.FromArgb(82, 82, 82); ((Button)sender).ForeColor = Color.White; ((Button)sender).Image = Main.GetImage(((Button)sender).Name.Substring(3) + "_White"); }