Пример #1
0
        private Panel CreateIdentityPanel(string name)
        {
            Panel panel = new IdentityPanel();

            panel.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            panel.BackColor = SystemColors.Window;
            panel.Height = 60;
            panel.BorderStyle = BorderStyle.Fixed3D;

            Label labelname = new Label();

            panel.Controls.Add(labelname);

            labelname.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            labelname.AutoEllipsis = true;
            labelname.BackColor = labelname.Parent.BackColor;
            labelname.Font = new Font(labelname.Font, FontStyle.Bold);
            labelname.Height = 16;
            labelname.Name = "labelName";
            labelname.Text = name;
            labelname.TextAlign = ContentAlignment.TopCenter;
            labelname.Top = 10;
            labelname.UseMnemonic = false;
            labelname.Width =
                labelname.Parent.ClientRectangle.Width
                - labelname.Parent.Padding.Left
                - labelname.Parent.Padding.Right;

            TextBox textotp = new TextBox();

            panel.Controls.Add(textotp);

            textotp.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            textotp.BackColor = textotp.Parent.BackColor;       // .NET Forms bug: setting ForeColor doesn't work unless BackColor is also set
            textotp.BorderStyle = BorderStyle.None;
            textotp.Font = new Font("Arial", 18.0F);
            textotp.ForeColor = SystemColors.WindowText;
            textotp.Multiline = false;
            textotp.Name = "textOtp";
            textotp.ReadOnly = true;
            textotp.TabStop = false;
            textotp.TextAlign = HorizontalAlignment.Center;
            textotp.Top = labelname.Bottom;
            textotp.Width =
                textotp.Parent.ClientRectangle.Width
                - textotp.Parent.Padding.Left
                - textotp.Parent.Padding.Right;

            PictureBox picturedel = new PictureBox();

            panel.Controls.Add(picturedel);
            picturedel.BringToFront();

            picturedel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            picturedel.Image = GAuthClient.Properties.Resources.iconDelete.ToBitmap();
            picturedel.Click += new EventHandler(this.pictureDelete_Click);
            picturedel.Name = "pictureDelete";
            picturedel.Size = new Size(8, 8);
            picturedel.Left = picturedel.Parent.ClientRectangle.Width - picturedel.Width - picturedel.Margin.Right;
            picturedel.Top = picturedel.Margin.Top;

            return panel;
        }
Пример #2
0
        private Panel CreateIdentityPanel(string name)
        {
            Panel panel = new IdentityPanel();

            panel.Anchor      = AnchorStyles.Left | AnchorStyles.Right;
            panel.BackColor   = SystemColors.Window;
            panel.Height      = 60;
            panel.BorderStyle = BorderStyle.Fixed3D;

            Label labelname = new Label();

            panel.Controls.Add(labelname);

            labelname.Anchor       = AnchorStyles.Left | AnchorStyles.Right;
            labelname.AutoEllipsis = true;
            labelname.BackColor    = labelname.Parent.BackColor;
            labelname.Font         = new Font(labelname.Font, FontStyle.Bold);
            labelname.Height       = 16;
            labelname.Name         = "labelName";
            labelname.Text         = name;
            labelname.TextAlign    = ContentAlignment.TopCenter;
            labelname.Top          = 10;
            labelname.UseMnemonic  = false;
            labelname.Width        =
                labelname.Parent.ClientRectangle.Width
                - labelname.Parent.Padding.Left
                - labelname.Parent.Padding.Right;

            TextBox textotp = new TextBox();

            panel.Controls.Add(textotp);

            textotp.Anchor      = AnchorStyles.Left | AnchorStyles.Right;
            textotp.BackColor   = textotp.Parent.BackColor;     // .NET Forms bug: setting ForeColor doesn't work unless BackColor is also set
            textotp.BorderStyle = BorderStyle.None;
            textotp.Font        = new Font("Arial", 18.0F);
            textotp.ForeColor   = SystemColors.WindowText;
            textotp.Multiline   = false;
            textotp.Name        = "textOtp";
            textotp.ReadOnly    = true;
            textotp.TabStop     = false;
            textotp.TextAlign   = HorizontalAlignment.Center;
            textotp.Top         = labelname.Bottom;
            textotp.Width       =
                textotp.Parent.ClientRectangle.Width
                - textotp.Parent.Padding.Left
                - textotp.Parent.Padding.Right;

            PictureBox picturedel = new PictureBox();

            panel.Controls.Add(picturedel);
            picturedel.BringToFront();

            picturedel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            picturedel.Image  = GAuthClient.Properties.Resources.iconDelete.ToBitmap();
            picturedel.Click += new EventHandler(this.pictureDelete_Click);
            picturedel.Name   = "pictureDelete";
            picturedel.Size   = new Size(8, 8);
            picturedel.Left   = picturedel.Parent.ClientRectangle.Width - picturedel.Width - picturedel.Margin.Right;
            picturedel.Top    = picturedel.Margin.Top;

            return(panel);
        }