protected override bool OnExposeEvent(Gdk.EventExpose ev) { bool r = base.OnExposeEvent(ev); //this.Style.DarkGC (Gtk.StateType.Normal) // GdkWindow.DrawRectangle (Style.MidGC (Gtk.StateType.Normal), true, 0, 0, 1000, 1000); Gdk.Rectangle rect = child.Allocation; /* rect.Inflate (selectionBorder, selectionBorder); * GdkWindow.DrawRectangle (Style.BlackGC, false, rect.X, rect.Y, rect.Width, rect.Height); */ Pixbuf sh = Shadow.AddShadow(rect.Width, rect.Height); GdkWindow.DrawPixbuf(this.Style.BackgroundGC(StateType.Normal), sh, 0, 0, rect.X - 5, rect.Y - 5, sh.Width, sh.Height, RgbDither.None, 0, 0); return(r); }
protected override bool OnExposeEvent(Gdk.EventExpose ev) { bool r = base.OnExposeEvent(ev); //FIXME Disabled checkerboard background because it's very inefficient and makes the control *very* slow to resize // It should take the EventExpose area into account, invalidate more selectively during resizes (GTK viewport // code would probably be a good start), and take advantage of the flat block color the parent is rendering. /* * int size = 8; * bool squareColor = true; * bool startsquareColor = true; * int x1 = 0; * int x2 = Allocation.Width; * int y1 = 0; * int y2 = Allocation.Height; * for (int y = y1; y < y2; y += size) { * squareColor = startsquareColor; * startsquareColor = !startsquareColor; * for (int x = x1; x < x2; x += size) { * GdkWindow.DrawRectangle (squareColor ? Style.DarkGC (StateType.Normal) : Style.DarkGC (StateType.Active), true, x, y, size, size); * squareColor = !squareColor; * } * } * * foreach (Widget cw in Children) * PropagateExpose (cw, ev);*/ Gdk.Rectangle rect = child.Allocation; if (Stetic.Metacity.Preview.ThemeError) { GdkWindow.DrawRectangle(this.Style.BackgroundGC(StateType.Normal), true, rect.X, rect.Y, rect.Width, rect.Height); } Pixbuf sh = Shadow.AddShadow(rect.Width, rect.Height); GdkWindow.DrawPixbuf(this.Style.BackgroundGC(StateType.Normal), sh, 0, 0, rect.X - 5, rect.Y - 5, sh.Width, sh.Height, RgbDither.None, 0, 0); return(r); }
private void WinForm_Load(object sender, EventArgs e) { this.Resize += new EventHandler(WinForm_Resize); #region Top Panel pnlTop.Size = new Size(560, 30); pnlTop.Dock = DockStyle.Top; pnlTop.Paint += new PaintEventHandler(pnlTop_Paint); AddDrag(pnlTop); //this.Controls.Add(pnlTop); #endregion #region Minimaze Button btnMinimaze.ForeColor = ForeColor; btnMinimaze.BackColor = pnlTop.BackColor; btnMinimaze.FlatStyle = FlatStyle.Flat; btnMinimaze.FlatAppearance.BorderSize = 0; btnMinimaze.FlatAppearance.MouseDownBackColor = Color.FromArgb(44, 44, 44); btnMinimaze.FlatAppearance.MouseOverBackColor = Color.FromArgb(66, 66, 66); btnMinimaze.Size = new Size(52, 30); btnMinimaze.Dock = DockStyle.Right; btnMinimaze.Cursor = Cursors.Hand; btnMinimaze.Font = new Font("Segoe UI Symbol", 9f); btnMinimaze.Text = "─"; btnMinimaze.Click += new EventHandler(Minimaze); pnlTop.Controls.Add(btnMinimaze); #endregion #region Maximize Button btnMaximize.ForeColor = ForeColor; btnMaximize.BackColor = pnlTop.BackColor; btnMaximize.FlatStyle = FlatStyle.Flat; btnMaximize.FlatAppearance.BorderSize = 0; btnMaximize.FlatAppearance.MouseDownBackColor = Color.FromArgb(44, 44, 44); btnMaximize.FlatAppearance.MouseOverBackColor = Color.FromArgb(66, 66, 66); btnMaximize.Size = new Size(52, 30); btnMaximize.Dock = DockStyle.Right; btnMaximize.Cursor = Cursors.Hand; btnMaximize.Font = new Font("Segoe UI Symbol", 9f); btnMaximize.Text = "◻"; btnMaximize.Click += new EventHandler(Maximize); pnlTop.Controls.Add(btnMaximize); #endregion #region Close Button btnClose.ForeColor = ForeColor; btnClose.BackColor = pnlTop.BackColor; btnClose.FlatStyle = FlatStyle.Flat; btnClose.FlatAppearance.BorderSize = 0; btnClose.FlatAppearance.MouseDownBackColor = Color.DarkRed; btnClose.FlatAppearance.MouseOverBackColor = Color.Red; btnClose.Size = new Size(52, 30); btnClose.Dock = DockStyle.Right; btnClose.Cursor = Cursors.Hand; btnClose.Font = new Font("Segoe UI Symbol", 9f); btnClose.Text = "✕"; btnClose.Click += new EventHandler(Close); pnlTop.Controls.Add(btnClose); #endregion #region Program (Picturebox for Icon) pbProgram.SizeMode = PictureBoxSizeMode.Zoom; pbProgram.Location = new Point(4, 2); pbProgram.Size = new Size(24, 24); pbProgram.Image = this.Icon.ToBitmap(); AddDrag(pbProgram); pnlTop.Controls.Add(pbProgram); #endregion //#region Program (Label -> Title) //if (this.Icon != null && ShowControlBarIcon) //{ // lblProgram.Location = new Point(33, 8); //} //else //{ // lblProgram.Location = new Point(5, 8); //} //lblProgram.ForeColor = ForeColor; //AddDrag(lblProgram); //pnlTop.Controls.Add(lblProgram); //#endregion #region ResizeGrip (Picturebox) pbResize.MouseDown += SizerMouseDown; pbResize.MouseMove += SizerMouseMove; pbResize.MouseUp += SizerMouseUp; pbResize.Size = new Size(ResizeGripSize, ResizeGripSize); pbResize.BackColor = Color.Transparent; pbResize.Location = new Point(this.Width - pbResize.Size.Width, this.Height - pbResize.Size.Height); //pbResize.Cursor = Cursors.SizeNWSE; this.Controls.Add(pbResize); pbResize.BringToFront(); #endregion #region Extra Aero.ChangeAccent(Handle, new Enums.AccentPolicy { GradientColor = 0xFD70000, AccentState = FormAccent }); if (ExtraDropShadow) { Shadow.AddShadow(Handle); } #endregion }