internal protected virtual void OnPaintScrollBarArrow( PaintScrollBarArrowEventArgs e) { Graphics g = e.Graphics; Rectangle rect = e.ArrowRectangle; ControlState controlState = e.ControlState; ArrowDirection direction = e.ArrowDirection; bool bHorizontal = e.Orientation == Orientation.Horizontal; bool bEnabled = e.Enabled; Color backColor = BackNormal; Color baseColor = Base; Color borderColor = Border; Color innerBorderColor = InnerBorder; Color foreColor = Fore; bool changeColor = false; if (bEnabled) { switch (controlState) { case ControlState.Hover: baseColor = BackHover; break; case ControlState.Pressed: baseColor = BackPressed; changeColor = true; break; default: baseColor = Base; break; } } else { backColor = GetGray(backColor); baseColor = GetGray(Base); borderColor = GetGray(borderColor); foreColor = GetGray(foreColor); } using (SmoothingModeGraphics sg = new SmoothingModeGraphics(g)) { ControlPaintEx.DrawScrollBarArraw( g, rect, baseColor, backColor, borderColor, innerBorderColor, foreColor, e.Orientation, direction, changeColor); } }
private void DrawScrollBar( IntPtr maskHWnd, Rectangle bounds, Rectangle trackRect, Rectangle topLeftArrowRect, Rectangle bottomRightArrowRect, Rectangle thumbRect, ControlState topLeftArrowState, ControlState bottomRightArrowState, ControlState thumbState, Orientation direction) { bool bHorizontal = direction == Orientation.Horizontal; ArrowDirection arrowDirection; bool bEnabled = _owner.Enabled; IScrollBarPaint paint = _owner as IScrollBarPaint; if (paint == null) { return; } ImageDc tempDc = new ImageDc(bounds.Width, bounds.Height); IntPtr hdc = NativeMethods.GetDC(maskHWnd); try { using (Graphics g = Graphics.FromHdc(tempDc.Hdc)) { using (PaintScrollBarTrackEventArgs te = new PaintScrollBarTrackEventArgs( g, trackRect, direction, bEnabled)) { Graphics ge = te.Graphics; Rectangle rect = te.TrackRectangle; Color baseColor = GetGray(Color.Blue); ControlPaintEx.DrawScrollBarTrack( ge, rect, baseColor, Color.White, te.Orientation); //paint.OnPaintScrollBarTrack(te); } arrowDirection = bHorizontal ? ArrowDirection.Left : ArrowDirection.Up; using (PaintScrollBarArrowEventArgs te = new PaintScrollBarArrowEventArgs( g, topLeftArrowRect, topLeftArrowState, arrowDirection, direction, bEnabled)) { paint.OnPaintScrollBarArrow(te); } arrowDirection = bHorizontal ? ArrowDirection.Right : ArrowDirection.Down; using (PaintScrollBarArrowEventArgs te = new PaintScrollBarArrowEventArgs( g, bottomRightArrowRect, bottomRightArrowState, arrowDirection, direction, bEnabled)) { paint.OnPaintScrollBarArrow(te); } using (PaintScrollBarThumbEventArgs te = new PaintScrollBarThumbEventArgs( g, thumbRect, thumbState, direction, bEnabled)) { paint.OnPaintScrollBarThumb(te); } } NativeMethods.BitBlt( hdc, 0, 0, bounds.Width, bounds.Height, tempDc.Hdc, 0, 0, TernaryRasterOperations.SRCCOPY); } finally { NativeMethods.ReleaseDC(maskHWnd, hdc); tempDc.Dispose(); } }
protected internal virtual void OnPaintScrollBarArrow( PaintScrollBarArrowEventArgs e) { Graphics g = e.Graphics; Rectangle rect = e.ArrowRectangle; ControlState controlState = e.ControlState; ArrowDirection direction = e.ArrowDirection; bool bHorizontal = e.Orientation == Orientation.Horizontal; bool bEnabled = e.Enabled; Color backColor = BackNormal; Color baseColor = Base; Color borderColor = Border; Color innerBorderColor = InnerBorder; Color foreColor = Fore; bool changeColor = false; if (bEnabled) { switch (controlState) { case ControlState.Hover: baseColor = BackHover; break; case ControlState.Pressed: baseColor = BackPressed; changeColor = true; break; default: baseColor = Base; break; } } else { backColor = GetGray(backColor); baseColor = GetGray(Base); borderColor = GetGray(borderColor); foreColor = GetGray(foreColor); } using (SmoothingModeGraphics sg = new SmoothingModeGraphics(g)) { ControlPaintEx.DrawScrollBarArraw( g, rect, baseColor, backColor, borderColor, innerBorderColor, foreColor, e.Orientation, direction, changeColor); } }
void IScrollBarPaint.OnPaintScrollBarArrow(PaintScrollBarArrowEventArgs e) { OnPaintScrollBarArrow(e); }
void IScrollBarPaint.OnPaintScrollBarArrow(PaintScrollBarArrowEventArgs e) { OnPaintScrollBarArrow(e); }
protected internal virtual void OnPaintScrollBarArrow(PaintScrollBarArrowEventArgs e) { Graphics g = e.Graphics; Rectangle rect = e.ArrowRectangle; ControlState controlState = e.ControlState; ArrowDirection direction = e.ArrowDirection; Orientation orientation = e.Orientation; bool bEnabled = e.Enabled; Color backColor = this.BackNormal; Color baseColor = this.Base; Color borderColor = this.Border; Color innerBorderColor = this.InnerBorder; Color foreColor = this.Fore; bool changeColor = false; if (bEnabled) { switch (controlState) { case ControlState.Hover: baseColor = this.BackHover; goto Label_00BD; case ControlState.Pressed: baseColor = this.BackPressed; changeColor = true; goto Label_00BD; } baseColor = this.Base; } else { backColor = this.GetGray(backColor); baseColor = this.GetGray(this.Base); borderColor = this.GetGray(borderColor); foreColor = this.GetGray(foreColor); } Label_00BD: using (new SmoothingModeGraphics(g)) { CCWin.SkinControl.ControlPaintEx.DrawScrollBarArraw(g, rect, baseColor, backColor, borderColor, innerBorderColor, foreColor, e.Orientation, direction, changeColor); } }
private void DrawScrollBar(IntPtr maskHWnd, Rectangle bounds, Rectangle trackRect, Rectangle topLeftArrowRect, Rectangle bottomRightArrowRect, Rectangle thumbRect, ControlState topLeftArrowState, ControlState bottomRightArrowState, ControlState thumbState, Orientation direction) { bool bHorizontal = direction == Orientation.Horizontal; bool bEnabled = this._owner.Enabled; IScrollBarPaint paint = this._owner as IScrollBarPaint; if (paint != null) { ImageDc tempDc = new ImageDc(bounds.Width, bounds.Height); IntPtr hdc = CCWin.Win32.NativeMethods.GetDC(maskHWnd); try { using (Graphics g = Graphics.FromHdc(tempDc.Hdc)) { using (PaintScrollBarTrackEventArgs te = new PaintScrollBarTrackEventArgs(g, trackRect, direction, bEnabled)) { paint.OnPaintScrollBarTrack(te); } ArrowDirection arrowDirection = bHorizontal ? ArrowDirection.Left : ArrowDirection.Up; using (PaintScrollBarArrowEventArgs te = new PaintScrollBarArrowEventArgs(g, topLeftArrowRect, topLeftArrowState, arrowDirection, direction, bEnabled)) { paint.OnPaintScrollBarArrow(te); } arrowDirection = bHorizontal ? ArrowDirection.Right : ArrowDirection.Down; using (PaintScrollBarArrowEventArgs te = new PaintScrollBarArrowEventArgs(g, bottomRightArrowRect, bottomRightArrowState, arrowDirection, direction, bEnabled)) { paint.OnPaintScrollBarArrow(te); } using (PaintScrollBarThumbEventArgs te = new PaintScrollBarThumbEventArgs(g, thumbRect, thumbState, direction, bEnabled)) { paint.OnPaintScrollBarThumb(te); } } CCWin.Win32.NativeMethods.BitBlt(hdc, 0, 0, bounds.Width, bounds.Height, tempDc.Hdc, 0, 0, 0xcc0020); } finally { CCWin.Win32.NativeMethods.ReleaseDC(maskHWnd, hdc); tempDc.Dispose(); } } }