Example #1
0
        public LeftPanel(AppWindow owner)
        {
            this.BackColor = owner.DarkColor;
            this.Dock      = DockStyle.Left;
            this.Width     = 300;

            Label lblLogo = new Label()
            {
                AutoSize = false,
                Dock     = DockStyle.Top,
                Height   = 150
            };

            lblLogo.BackgroundImage       = Properties.Resources.LogoWhite;
            lblLogo.BackgroundImageLayout = ImageLayout.Zoom;
            this.Controls.Add(lblLogo);

            Label lblName = new Label()
            {
                AutoSize  = false,
                Font      = new Font(this.Font.FontFamily, 13.0f, FontStyle.Bold),
                ForeColor = owner.LightColor,
                Location  = new Point(0, lblLogo.Bottom + 10),
                Size      = new Size(300, 30),
                Text      = owner.Text,
                TextAlign = ContentAlignment.MiddleCenter
            };

            this.Controls.Add(lblName);

            //registration
            LeftPanelButton btnReg = new LeftPanelButton(owner)
            {
                Text = "Registration"
            };

            btnReg.Location = new Point(this.Width - btnReg.Width, lblName.Bottom + 10);
            btnReg.Click   += delegate
            {
                if (regForm == null)
                {
                    regForm = new RegistrationForm(owner);
                }
                owner.Body.Controls.Clear();
                owner.Body.Controls.Add(regForm);
                owner.Text = "Registration - IDPs Biometric Enumeration";
            };
            this.Controls.Add(btnReg);
            //verification
            LeftPanelButton btnVeri = new LeftPanelButton(owner)
            {
                Text = "Verification"
            };

            btnVeri.Location = new Point(btnReg.Left, btnReg.Bottom + 10);
            btnVeri.Click   += delegate
            {
                if (veriForm == null)
                {
                    veriForm = new VerificationForm(owner);
                }
                owner.Body.Controls.Clear();
                owner.Body.Controls.Add(veriForm);
                owner.Text = "Verification - IDPs Biometric Enumeration";
            };
            this.Controls.Add(btnVeri);
            //sync

            //
            btnReg.Siblings.Add(btnVeri);
            btnVeri.Siblings.Add(btnReg);

            owner.RegisterToMoveWindow(this);
            owner.RegisterToMoveWindow(lblLogo);
            owner.RegisterToMoveWindow(lblName);
        }
Example #2
0
        public TitleBar(AppWindow owner)
        {
            this.owner = owner;

            this.BackColor = owner.LightColor;//this.BackColor = owner.DarkColor;
            this.Dock      = DockStyle.Top;
            this.ForeColor = owner.DarkColor;
            this.Height    = sz;

            ToolTip tooltip = new ToolTip();

            //customControls
            customControls = new List <Control>();

            //btnMinimize
            btnMinimize = new Label()
            {
                BackgroundImage       = Properties.Resources.Minimize,
                BackgroundImageLayout = ImageLayout.Stretch,
                Size = new Size(smSz, smSz)
            };
            btnMinimize.MouseEnter += delegate { btnMinimize.BackgroundImage = Properties.Resources.Minimize2; };
            btnMinimize.MouseLeave += delegate { btnMinimize.BackgroundImage = Properties.Resources.Minimize; };
            btnMinimize.Click      += delegate { owner.WindowState = FormWindowState.Minimized; };

            if (owner.Maximized)
            {
                MaximizeImageNormal = Properties.Resources.Restore;
                MaximizeImageFocus  = Properties.Resources.Restore2;
            }
            else
            {
                MaximizeImageNormal = Properties.Resources.Maximize;
                MaximizeImageFocus  = Properties.Resources.Maximize2;
            }
            //btnMaximize
            btnMaximize = new Label()
            {
                BackgroundImage       = MaximizeImageNormal,
                BackgroundImageLayout = ImageLayout.Stretch,
                Size = new Size(smSz, smSz)
            };
            btnMaximize.MouseEnter += delegate { btnMaximize.BackgroundImage = MaximizeImageFocus; };
            btnMaximize.MouseLeave += delegate { btnMaximize.BackgroundImage = MaximizeImageNormal; };
            btnMaximize.Click      += delegate { owner.Maximized = !owner.Maximized; };

            //btnClose
            btnClose = new Label()
            {
                BackgroundImage       = Properties.Resources.Close,
                BackgroundImageLayout = ImageLayout.Stretch,
                Size = new Size(smSz, smSz)
            };
            btnClose.MouseEnter += delegate { btnClose.BackgroundImage = Properties.Resources.Close2; };
            btnClose.MouseLeave += delegate { btnClose.BackgroundImage = Properties.Resources.Close; };
            btnClose.Click      += delegate { owner.Close(); };

            //dynamicPanel
            dynamicPanel = new Panel()
            {
                Height = 30,
                Width  = 0
            };
            this.Controls.Add(dynamicPanel);

            //btnIconBox
            btnIconBox = new Label()
            {
                BackgroundImage       = Properties.Resources.IconImage,
                BackgroundImageLayout = ImageLayout.Stretch,
                Location = new Point(offset, offset),
                Size     = new Size(smSz, smSz)
            };
            owner.RegisterToMoveWindow(btnIconBox);
            this.Controls.Add(btnIconBox);

            //lblAppName
            lblAppName = new Label()
            {
                AutoEllipsis = true,
                Font         = new System.Drawing.Font(this.Font.FontFamily, 11.0F),
                Height       = smSz,
                Text         = owner.Text,
                TextAlign    = ContentAlignment.BottomLeft
            };
            lblAppName.Location = new Point(btnIconBox.Location.X + btnIconBox.Width + offset, offset);
            this.Controls.Add(lblAppName);
            owner.RegisterToMoveWindow(lblAppName);
            owner.SizeChanged += delegate { lblAppName.Width = owner.Width / 2; };
            owner.TextChanged += delegate { lblAppName.Text = owner.Text; };

            owner.MaximizedChanged += owner_MaximizedChanged;

            this.SizeChanged += TitleBar_SizeChanged;

            RefreshTitleBar(true, true, true);
        }