public PaintScrollBarThumbEventArgs(System.Drawing.Graphics graphics, Rectangle thumbRect, CCWin.SkinClass.ControlState controlState, System.Windows.Forms.Orientation orientation, bool enabled) { this._graphics = graphics; this._thumbRect = thumbRect; this._controlState = controlState; this._orientation = orientation; this._enabled = enabled; }
public PaintScrollBarArrowEventArgs(System.Drawing.Graphics graphics, Rectangle arrowRect, CCWin.SkinClass.ControlState controlState, System.Windows.Forms.ArrowDirection arrowDirection, System.Windows.Forms.Orientation orientation, bool enabled) { this._graphics = graphics; this._arrowRect = arrowRect; this._controlState = controlState; this._arrowDirection = arrowDirection; this._orientation = orientation; this._enabled = enabled; }
protected override void OnMouseUp(MouseEventArgs e) { this._controlState = CCWin.SkinClass.ControlState.Hover; base.Invalidate(); base.OnMouseUp(e); }
protected override void OnMouseLeave(EventArgs e) { this._controlState = CCWin.SkinClass.ControlState.Normal; base.Invalidate(); base.OnMouseLeave(e); }
protected override void OnMouseDown(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this._controlState = CCWin.SkinClass.ControlState.Pressed; base.Invalidate(); } base.OnMouseDown(e); }
protected override void OnPaint(PaintEventArgs e) { Rectangle imageRect; Rectangle textRect; Color baseColor; Color borderColor; base.OnPaint(e); base.OnPaintBackground(e); Graphics g = e.Graphics; Rectangle rc = base.ClientRectangle; this.CalculateRect(out imageRect, out textRect); g.SmoothingMode = SmoothingMode.AntiAlias; Color innerBorderColor = Color.FromArgb(200, 0xff, 0xff, 0xff); Bitmap btm = null; int Tx = 0; switch (this._controlState) { case CCWin.SkinClass.ControlState.Hover: btm = (Bitmap) this.MouseBack; baseColor = this.GetColor(this._baseColor, 0, -13, -8, -3); borderColor = this._baseColor; break; case CCWin.SkinClass.ControlState.Pressed: btm = (Bitmap) this.DownBack; baseColor = this.GetColor(this._baseColor, 0, -35, -24, -9); borderColor = this._baseColor; Tx = 1; break; default: btm = (Bitmap) this.NormlBack; baseColor = this._baseColor; borderColor = this._baseColor; break; } if (!base.Enabled) { baseColor = SystemColors.ControlDark; borderColor = SystemColors.ControlDark; } if ((btm != null) && (this.DrawType == DrawStyle.Img)) { UpdateForm.CreateRegion(this, rc, this.Radius, this.RoundStyle); if (this.Create && (this._controlState != this.states)) { UpdateForm.CreateControlRegion(this, btm, 1); } if (this.Palace) { CCWin.ImageDrawRect.DrawRect(g, btm, new Rectangle(rc.X, rc.Y, rc.Width, rc.Height), Rectangle.FromLTRB(this.BackRectangle.X, this.BackRectangle.Y, this.BackRectangle.Width, this.BackRectangle.Height), 1, 1); } else { g.DrawImage(btm, 0, 0, base.Width, base.Height); } } else if (this.DrawType == DrawStyle.Draw) { this.RenderBackgroundInternal(g, rc, baseColor, borderColor, innerBorderColor, this.RoundStyle, this.Radius, 0.35f, true, true, LinearGradientMode.Vertical); } Image img = null; Size imgs = Size.Empty; if (base.Image != null) { if (string.IsNullOrEmpty(this.Text)) { img = base.Image; imgs = new Size(img.Width, img.Height); rc.Inflate(-4, -4); if ((imgs.Width * imgs.Height) != 0) { Rectangle imgr = rc; imgr = CCWin.ImageDrawRect.HAlignWithin(imgs, imgr, base.ImageAlign); imgr = CCWin.ImageDrawRect.VAlignWithin(imgs, imgr, base.ImageAlign); if (!base.Enabled) { ControlPaint.DrawImageDisabled(g, img, imgr.Left, imgr.Top, this.BackColor); } else { g.DrawImage(img, imgr.Left + Tx, imgr.Top + Tx, img.Width, img.Height); } } } else { g.InterpolationMode = InterpolationMode.HighQualityBilinear; g.DrawImage(base.Image, imageRect, -Tx, -Tx, base.Image.Width, base.Image.Height, GraphicsUnit.Pixel); } } else if ((base.ImageList != null) && (base.ImageIndex != -1)) { img = base.ImageList.Images[base.ImageIndex]; } Color txtColor = base.Enabled ? this.ForeColor : SystemColors.ControlDark; TextRenderer.DrawText(g, this.Text, this.Font, textRect, txtColor, GetTextFormatFlags(this.TextAlign, this.RightToLeft == RightToLeft.Yes)); this.states = this._controlState; }
protected override void OnMouseUp(MouseEventArgs e) { if ((e.Button & MouseButtons.Left) == MouseButtons.Left) { this._controlState = CCWin.SkinClass.ControlState.Hover; base.Invalidate(); } base.OnMouseUp(e); }