public static void frmApply(Form frm, UIXHeader hdr, Icon icon, uixStyle style) { frm.FormBorderStyle = FormBorderStyle.None; frm.AutoScaleMode = AutoScaleMode.None; frm.Text = hdr.Title; frm.BackColor = style.FormColor.BackColor; frm.MinimizeBox = hdr.btnMin.Visible; frm.Icon = icon; applyMargin(frm, style); uixHeader.hdrApply(frm, hdr, style); }
public static void hdrApply(Form frm, UIXHeader hdr, uixStyle style) { int maxX = frm.Width; int maxY = frm.Height; //Apply header bar Style hdr.Size = new Size(maxX, style.HeaderButtonSize + (style.HeaderButtonSpace * 2)); hdr.Location = new Point(0, 0); hdr.BackColor = style.FormColor.DarkColor; //Apply header title style hdr.lbl.BringToFront(); uixLabel.lblApply(hdr.lbl, style.FormColor, style.BoldFont); hdr.lbl.Font = uixFont.alterFont(hdr.lbl.Font, 12.5f); hdr.lbl.BackColor = style.FormColor.DarkColor; hdr.lbl.Location = new Point((style.HeaderButtonSpace * 2) + style.HeaderButtonSize, 0); hdr.pic.Location = new Point(style.HeaderButtonSpace, style.HeaderButtonSpace); hdr.pic.Size = new Size(style.HeaderButtonSize, style.HeaderButtonSize); hdr.pic.BackColor = style.FormColor.DarkColor; hdr.pic.SizeMode = PictureBoxSizeMode.Zoom; hdr.pic.BringToFront(); //Calculate buttons int nextButtonX = maxX; //Close button if (hdr.btnClo != null) { nextButtonX = nextButtonX - style.HeaderButtonSize - style.HeaderButtonSpace; hdr.btnClo.Location = new Point(nextButtonX, style.HeaderButtonSpace); hdr.btnClo.BringToFront(); uixButton.btnStyleClose(hdr.btnClo, style.HeaderButtonSize, style.ButtonWarningColor); } //Minimize button if (hdr.btnMin != null) { nextButtonX = nextButtonX - style.HeaderButtonSize - style.HeaderButtonSpace; hdr.btnMin.Location = new Point(nextButtonX, style.HeaderButtonSpace); hdr.btnMin.BringToFront(); uixButton.btnStyleMinimize(hdr.btnMin, style.HeaderButtonSize, style.ButtonColor); } uixUtil.defineSizeForWidht(hdr.lbl, nextButtonX - 10); }
public static void applyMargin(Form frm, uixStyle style) { int MARGIN_SIZE = 5; frm.Height = frm.Height + MARGIN_SIZE; frm.Width = frm.Width + (MARGIN_SIZE * 2); foreach (Control control in frm.Controls) { control.Location = new Point(control.Location.X + MARGIN_SIZE, control.Location.Y); } Panel pnlLeft = new Panel { Size = new System.Drawing.Size(MARGIN_SIZE, frm.Height), Location = new System.Drawing.Point(0, 0), BackColor = style.FormColor.DarkColor }; Panel pnlRight = new Panel { Size = new System.Drawing.Size(MARGIN_SIZE, frm.Height), Location = new System.Drawing.Point(frm.Width - MARGIN_SIZE, 0), BackColor = style.FormColor.DarkColor }; Panel pnlBottom = new Panel { Size = new System.Drawing.Size(frm.Width, MARGIN_SIZE), Location = new System.Drawing.Point(0, frm.Height - MARGIN_SIZE), BackColor = style.FormColor.DarkColor }; frm.Controls.Add(pnlLeft); frm.Controls.Add(pnlRight); frm.Controls.Add(pnlBottom); pnlRight.BringToFront(); pnlLeft.BringToFront(); pnlBottom.BringToFront(); }