Exemplo n.º 1
0
		public void DrawAt(IGraphPort graphPort, int x, int y, Rectangle updateRect)
		{
			int centerX = updateRect.Width/2;
			int centerY = updateRect.Height/2;
			int Radius = (updateRect.Height / 2) - 5;
			int N = 36;
			double theta = 3.14159 * 2 / N;

            GDIPen aPen = new GDIPen(PenType.Cosmetic, PenStyle.Solid, PenJoinStyle.Round, PenEndCap.Round, RGBColor.Red, 1, Guid.NewGuid());

            for (int p = 0; p < N; p++)
			{
				byte num = (byte)(((double)p / (double)N) * 254.0);
				byte r = (byte)rnd.Next(0, num);
				byte g = (byte)rnd.Next(0, num);
				byte b = (byte)rnd.Next(0, num);
				uint color = RGBColor.RGB(r, g, b);
				//graphPort.PenColor = color;

				for (int q = 0; q < p; q++)
				{
					graphPort.DrawLine(aPen, new Point((int)(centerX + Radius * Math.Sin(p * theta)),
										(int)(centerY + Radius * Math.Cos(p * theta))),
										new Point((int)(centerX + Radius * Math.Sin(q * theta)),
										(int)(centerY + Radius * Math.Cos(q * theta))));
				}
			}
		}
Exemplo n.º 2
0
        public virtual void DrawLine(IGraphPort aPort, int x1, int y1, int x2, int y2, int border_width)
		{
            // Vertical line
			if (x1 == x2)
			{
				for (int n=0; n<BorderWidth; n++) 
					aPort.DrawLine(fShadowPen, new Point2I(x1-n, y1+n), new Point2I(x1-n, y2-n));  // left part
	    
				for (int n=1; n<BorderWidth; n++) 
					aPort.DrawLine(fHighlightPen, new Point2I(x1+n, y1+n), new Point2I(x1+n, y2-n));  // right part
			} 
			else if (y1 == y2)  // Horizontal line
			{
				for (int n=0; n<BorderWidth; n++) 
					aPort.DrawLine(fShadowPen, new Point2I(x1+n, y1-n), new Point2I(x2-n, y1-n));  // top part

				for (int n=1; n<BorderWidth; n++) 
					aPort.DrawLine(fHighlightPen, new Point2I(x1+n, y1+n), new Point2I(x2-n, y1+n));  // bottom part
			}
		}
Exemplo n.º 3
0
		public virtual void  DrawFrame(IGraphPort aPort, int x, int y, int w, int h, FrameStyle style)
		{
			int n;

			switch (style)
			{
				case FrameStyle.Sunken:
					for (n=0; n<BorderWidth; n++)
					{
						aPort.DrawLine(fHighlightPen, new Point2I(x+n, y+h-n), new Point2I(x+w-n, y+h-n));    // bottom shadow
                        aPort.DrawLine(fHighlightPen, new Point2I(x + w - n, y + n), new Point2I(x + w - n, y + h));	    // right shadow
					}

					for (n=0; n<BorderWidth; n++)
					{
						aPort.DrawLine(fShadowPen, new Point2I(x+n, y+n), new Point2I(x+w-n, y+n));	    // top edge
						aPort.DrawLine(fShadowPen, new Point2I(x+n, y+n), new Point2I(x+n, y+h-n));	    // left edge
					}				
				break;

				case FrameStyle.Raised:	
					for (n=0; n<BorderWidth; n++)
					{
						aPort.DrawLine(fShadowPen, new Point2I(x+n, y+h-n), new Point2I(x+w-n, y+h-n));      // bottom shadow
						aPort.DrawLine(fShadowPen, new Point2I(x+w-n, y+n), new Point2I(x+w-n, y+h));	    // right shadow
					}
	
					if (BorderWidth > 0)
					{
						n = BorderWidth - 1;
/*
						aPort.DrawingColor = fBottomShadowTopLiner;
						aPort.DrawLine(x+n, y+h-n, x+w-n, y+h-n);		// bottom shadow
						aPort.DrawLine(x+w-n, y+n, x+w-n, y+h);			// right shadow
*/						
                        aPort.DrawLine(fBottomShadowBottomLinerPen, new Point2I(x, y + h), new Point2I(x + w, y + h));				// bottom shadow
                        aPort.DrawLine(fBottomShadowBottomLinerPen, new Point2I(x + w, y), new Point2I(x + w, y + h));				// right shadow
					}

					for (n=0; n<BorderWidth; n++)
					{
						aPort.DrawLine(fHighlightPen, new Point2I(x+n,y+n), new Point2I(x+w-n, y+n));	    // top edge
						aPort.DrawLine(fHighlightPen, new Point2I(x+n, y+n), new Point2I(x+n, y+h-n));	    // left edge
					}
				break;
			}

		}