Exemplo n.º 1
0
        private void FrmSelectImage_Load(object sender, EventArgs e)
        {
            string[] nameList = System.Enum.GetNames(typeof(Scada.Controls.FontIcons));
            var      lst      = nameList.ToList();

            lst.Sort();
            foreach (var item in lst)
            {
                Scada.Controls.FontIcons icon = (Scada.Controls.FontIcons)Enum.Parse(typeof(Scada.Controls.FontIcons), item);
                Label lbl = new Label();
                lbl.AutoSize     = false;
                lbl.Size         = new System.Drawing.Size(300, 35);
                lbl.ForeColor    = Color.FromArgb(255, 77, 59);
                lbl.TextAlign    = ContentAlignment.MiddleLeft;
                lbl.Margin       = new System.Windows.Forms.Padding(5);
                lbl.DoubleClick += lbl_DoubleClick;
                string s = char.ConvertFromUtf32((int)icon);
                lbl.Text       = "       " + item;
                lbl.Image      = Scada.Controls.FontImages.GetImage(icon, 32, Color.FromArgb(255, 77, 59));
                lbl.ImageAlign = ContentAlignment.MiddleLeft;
                lbl.Font       = new Font("微软雅黑", 12);
                lbl.Tag        = icon;
                if (item.StartsWith("A_"))
                {
                    flowLayoutPanel1.Controls.Add(lbl);
                }
                else
                {
                    flowLayoutPanel2.Controls.Add(lbl);
                }
            }
            this.ActiveControl = this.flowLayoutPanel1;
        }
Exemplo n.º 2
0
        void lbl_DoubleClick(object sender, EventArgs e)
        {
            Label lbl = sender as Label;

            Scada.Controls.FontIcons icon = (Scada.Controls.FontIcons)lbl.Tag;
            int intSize = ucTextBoxEx1.InputText.ToInt();

            if (intSize <= 0)
            {
                intSize = 32;
            }
            SelectImage       = Scada.Controls.FontImages.GetImage(icon, intSize, txtForeColor.BackColor, txtBackcolor.BackColor == Color.White ? Color.Empty : txtBackcolor.BackColor);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }