Example #1
0
        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);
        }
Example #2
0
        void B_fontColor_Click(object sender, EventArgs e)
        {
            Color       prevColor = ColorTranslator.FromHtml(Properties.Settings.Default.UI_Color);
            ColorDialog CD        = new ColorDialog();

            CD.AllowFullOpen = true;
            DialogResult DR = CD.ShowDialog();

            if (DR == DialogResult.OK && CD.Color != Color.White)
            {
                Properties.Settings.Default.UI_Color    = ColorTranslator.ToHtml(CD.Color);
                Controls["LBL_fontColor"].ForeColor     = Main.GetColor();
                Controls["LBL_fontStyle"].ForeColor     = Main.GetColor();
                Controls["LBL_select"].ForeColor        = Main.GetColor();
                Controls["B_fontColor"].BackColor       = Main.GetColor();
                Controls["B_fonts"].BackColor           = Main.GetColor();
                Controls["PB_triangle"].BackgroundImage = new Bitmap(ChangeImageColor_GetPixel("triangle"));
                Controls["PB_triangle"].BackgroundImage.RotateFlip(RotateFlipType.Rotate180FlipNone);

                ((Button)sender).BackColor = Main.GetColor();

                if (Database_Connector.Update.Settings("UI_Color", ColorTranslator.ToHtml(CD.Color).ToString()) == 0)
                {
                    Database_Connector.Insert.Settings("UI_Color", ColorTranslator.ToHtml(CD.Color).ToString());
                }

                UpdateColors();
            }

            Main.RefreshForms();
        }
Example #3
0
        // 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);
            }
        }
Example #4
0
        private Label CreateLabel(Button sender)
        {
            Label LBL = new Label();

            LBL.Name = "LBL" + sender.Name.Substring(1);

            if (sender.Name == "B_lang")
            {
                LBL.Text = Main.resManager.GetString("User_Settings_Hover_Lang", Main.culInfo);
            }
            else if (sender.Name == "B_fonts")
            {
                LBL.Text = Main.resManager.GetString("User_Settings_Hover_Fonts", Main.culInfo);
            }
            else
            {
                LBL.Text = Main.resManager.GetString("User_Settings_Hover_Password", Main.culInfo);
            }

            LBL.Font      = new Font(Main.GetFont(), 11, FontStyle.Bold);
            LBL.TextAlign = ContentAlignment.MiddleCenter;
            LBL.BackColor = Main.GetColor();
            LBL.ForeColor = Color.White;

            LBL.Height = 28;
            LBL.Width  = sender.Width;
            int pX = sender.Location.X;
            int pY = sender.Location.Y + sender.Height - LBL.Height;

            LBL.Location = new Point(pX, pY);

            return(LBL);
        }
Example #5
0
        private void bt_MouseLeave(object send, EventArgs e)
        {
            Button sender = (Button)send;

            sender.Image = Main.Img_ToColor(sender.Name.Substring(3), false);
            sender.FlatAppearance.MouseOverBackColor = Color.White;
            sender.ForeColor = Main.GetColor();
        }
Example #6
0
        private void bt_Finish_MouseLeave(object send, EventArgs e)
        {
            Button sender = (Button)send;

            sender.Image = Main.Img_ToColor(Modify ? "EditUser" : "AddUser", false);
            sender.FlatAppearance.MouseOverBackColor = Color.White;
            sender.ForeColor = Main.GetColor();
        }
Example #7
0
 void UpdateColors()
 {
     foreach (Control c in this.Controls)
     {
         if (c is Button)
         {
             ((Button)c).FlatAppearance.MouseDownBackColor = Main.GetColor();
             ((Button)c).FlatAppearance.MouseOverBackColor = Main.GetColor();
         }
     }
 }
Example #8
0
        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);
            }
        }
Example #9
0
        private Label Fonts_CreateLabel(string name, int X, int Y)
        {
            Label LBL = new Label();

            LBL.Name      = "LBL_" + name;
            LBL.Location  = new Point(X, Y);
            LBL.BackColor = Color.White;
            LBL.ForeColor = Main.GetColor();
            LBL.Font      = new Font(Main.GetFont(), 14);
            LBL.AutoSize  = true;

            return(LBL);
        }
Example #10
0
        private Label Lang_CreateLabel()
        {
            Label LBL = new Label();

            LBL.Name      = "LBL_LanguageSelection";
            LBL.Font      = new Font(Main.GetFont(), 12, FontStyle.Bold);
            LBL.TextAlign = ContentAlignment.MiddleCenter;
            LBL.ForeColor = Main.GetColor();
            LBL.BackColor = Color.White;
            LBL.Width     = this.Width - B_lang.Width;

            int pX = B_lang.Width;

            LBL.Location = new Point(pX, 40);

            return(LBL);
        }
Example #11
0
        // 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);
        }
Example #12
0
        private Button Fonts_CreateButton()
        {
            Button B = new Button();

            B.Name      = "B_fontColor";
            B.BackColor = Main.GetColor();
            B.FlatStyle = FlatStyle.Flat;
            B.FlatAppearance.BorderSize = 0;
            B.Cursor = Cursors.Hand;

            int pX = Controls["LBL_fontColor"].Location.X + Controls["LBL_fontColor"].Width + 10;

            B.Location = new Point(pX, Controls["LBL_fontColor"].Location.Y);
            B.Size     = new Size(60, 25);
            B.Click   += B_fontColor_Click;

            return(B);
        }
Example #13
0
        /// <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);
        }
Example #14
0
        private void Button_Click(object send, EventArgs e)
        {
            Button sender = (Button)send;

            if (!bClicked)
            {
                CreateSubForm(sender);
            }
            else
            {
                DeleteSubForm(sender);
                if (sender.Name == "B_fonts")
                {
                    Controls["LBL_fonts"].BackColor = Main.GetColor();
                }
            }

            bClicked = !bClicked;
        }
Example #15
0
        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);
        }
Example #16
0
 public static void UpdateFonts(Form form)
 {
     foreach (Control c in form.Controls)
     {
         if (c is TextBox || c is DataGridView || c is ListBox)
         {
             c.Font      = new Font(Properties.Settings.Default.Fonts[0], c.Font.Size);
             c.ForeColor = Color.Black;
         }
         else
         {
             c.Font = new Font(Main.GetFont(), c.Font.Size);
             if (c.Name != "bt_Exit" && c.Name != "bt_Back" && c.Name != "bt_Logout")
             {
                 c.ForeColor = Main.GetColor();
             }
         }
     }
     form.Update();
     form.Refresh();
 }
Example #17
0
        private RadioButton Lang_CreateRadioButton(string lang)
        {
            RadioButton RB = new RadioButton();

            RB.Name       = "RB_" + lang.ToLower();
            RB.Text       = lang.ToUpper();
            RB.Font       = new Font(Main.GetFont(), 24, FontStyle.Bold);
            RB.TextAlign  = ContentAlignment.MiddleCenter;
            RB.Size       = new Size(85, 85);
            RB.Appearance = Appearance.Button;
            RB.FlatStyle  = FlatStyle.Flat;

            RB.FlatAppearance.CheckedBackColor = Main.GetColor();
            RB.BackColor = Color.White;
            if (lang.ToLower() == Main.culInfo.Name.Substring(0, 2))
            {
                RB.Checked   = true;
                RB.ForeColor = Color.White;
                RB.FlatAppearance.MouseOverBackColor = Main.GetColor();
            }
            else
            {
                RB.ForeColor = Main.GetColor();
                RB.FlatAppearance.MouseOverBackColor = DefaultBackColor;
            }

            RB.Cursor = Cursors.Hand;
            RB.FlatAppearance.BorderSize = 0;
            RB.Click += Lang_RadioButton_Click;

            int offset = lang == "fr" ? -RB.Width / 2 : RB.Width / 2;
            int pX     = this.Width / 2 + offset;
            int pY     = this.Height / 2 - RB.Height / 2;

            RB.Location = new Point(pX, pY);

            return(RB);
        }
Example #18
0
        private Button Pass_CreateButton(Button sender, string name)
        {
            Button B = new Button();

            B.Name      = "B_" + name.ToLower();
            B.TextAlign = ContentAlignment.MiddleCenter;
            B.Font      = new Font(Main.GetFont(), 14);
            B.Width     = 192;
            B.Height    = 42;
            B.BackColor = Main.GetColor();
            B.ForeColor = Color.White;
            B.FlatStyle = FlatStyle.Flat;
            B.FlatAppearance.BorderSize = 0;
            B.Cursor = Cursors.Hand;
            B.Click += B_confirm_Click;

            int pX = (this.Width - sender.Width) / 2;
            int pY = Controls["TB_newPassword"].Location.Y + Controls["TB_newPassword"].Height + 12;

            B.Location = new Point(pX, pY);

            return(B);
        }
Example #19
0
 public static void RefreshColors(Form form)
 {
     foreach (Control c in form.Controls)
     {
         if (c is Button)
         {
             Button sender = (Button)c;
             if (sender.Name != "bt_Exit" && sender.Name != "bt_Logout" && sender.Name != "bt_Back" && sender.Name != "btn_AddCopies")
             {
                 sender.FlatAppearance.MouseDownBackColor = Main.GetColor();
                 sender.Image = Main.Img_ToColor(c.Name.Substring(3), true);
             }
             else if (sender.Name == "bt_Logout")
             {
                 sender.ForeColor = Color.Black;
             }
             else if (sender.Name == "bt_Exit")
             {
                 sender.FlatAppearance.MouseDownBackColor = Color.FromArgb(137, 34, 34);
             }
         }
     }
 }
Example #20
0
        private void Lang_RadioButton_Click(object sender, EventArgs e)
        {
            foreach (Control c in this.Controls)
            {
                if (c is RadioButton)
                {
                    RadioButton RB = (RadioButton)c;
                    RB.ForeColor = Main.GetColor();

                    if (RB.Checked)
                    {
                        RB.ForeColor = Color.White;
                        RB.FlatAppearance.MouseOverBackColor = Main.GetColor();
                    }
                    else
                    {
                        RB.ForeColor = Main.GetColor();
                        RB.FlatAppearance.MouseOverBackColor = DefaultBackColor;
                    }
                }
            }

            UpdateLanguage((RadioButton)sender);
        }