internal void Draw(Graphics e) { if (_scrollEffect == false) { _scrollY = (int)_count * Height; } int diff1, diff2; diff1 = 10 * Height - _scrollY; diff2 = Height - diff1; if (diff1 <= Height && diff1 >= 0) { // Console.WriteLine(" XXscrollY = " + _scrollY + " diff1=" + diff1 + " diff2=" + diff2 + " Height=" + Height); e.DrawImage(_map, new Rectangle(_x, _y, _width, diff1), new Rectangle(0, _scrollY, _width, diff1), GraphicsUnit.Pixel); e.DrawImage(_map, new Rectangle(_x, diff1 + _y, _width, diff2), new Rectangle(0, 0, _width, diff2), GraphicsUnit.Pixel); } else { // Console.WriteLine("YYscrollY = " + _scrollY + " diff1=" + diff1 + " diff2=" + diff2 + " Height=" + Height); e.DrawImage(_map, new Rectangle(_x, _y, _width, _height), new Rectangle(0, _scrollY, _width, _height), GraphicsUnit.Pixel); } Border.Border b = new Border.Inner3D(); Rectangle drawRect = RectangleHelper.Shrink(new Rectangle(_x, _y, _width, _height), 3); b.DrawBorder(e, new GRectangle(drawRect).GetGraphicsPath()); }
public void Draw(Graphics e) { Rectangle r1 = RectangleHelper.Shrink(_clientRect, 10); r1.Height = r1.Width; _center = new PointF((float)(r1.Left + r1.Width / 2), (float)(r1.Top + r1.Height / 2)); GraphicsPath s1 = new GraphicsPath(); s1.AddEllipse(r1); /* PathGradientBrush pb = new PathGradientBrush(s1); * pb.CenterColor = Color.White; * pb.SurroundColors = new Color[] { Color.Gray }; * pb.CenterPoint = new PointF(-2f, -2f); * e.FillEllipse(pb,r1);*/ e.DrawEllipse(new Pen(Color.Black), r1); Rectangle r2 = RectangleHelper.Shrink(r1, 10); //the knob handle LinearGradientBrush b = new LinearGradientBrush(r2, Color.Silver, Color.White, 180f); e.FillEllipse(b, r2); e.DrawEllipse(new Pen(Color.DarkSlateBlue), r2); GraphicsPath p = new GraphicsPath(); p.AddEllipse(r2); //The pointer GraphicsPath ptr = new GraphicsPath(); ptr.AddEllipse(new Rectangle(r2.Left + r2.Width / 2 - 5, r2.Top, 10, 10)); PathGradientBrush pbptr = new PathGradientBrush(ptr); pbptr.CenterColor = Color.LightGray; // pbptr.CenterPoint = new PointF(0, -0.5f); pbptr.SurroundColors = new Color[] { Color.Black }; DrawMarking(e, r1, r2); GraphicsState state = e.Save(); Matrix m = new Matrix(); m.RotateAt(_currentAngle, _center); e.Transform = m; e.FillPath(pbptr, ptr); e.SetClip(p); if (_knobHandleImage != null) { e.DrawImage(_knobHandleImage, r2); } e.ResetClip(); p.Dispose(); e.Restore(state); ptr.Dispose(); pbptr.Dispose(); //end }