コード例 #1
0
ファイル: Node.cs プロジェクト: drzo/opensim4opencog
		/// <summary>
		/// Draw the border of the node.
		/// </summary>
		/// <param name="graphics">The grpahics object we render to.</param>
		/// <param name="boundingBox">The untransformed bounding box of the node.</param>
		/// <param name="pen">The pen we use.</param>
		protected virtual void DrawShapeBorder(Graphics graphics, RectangleF boundingBox, Pen pen)
		{
			switch(_shape)
			{
				case(NodeShape.Rectangle):
					graphics.DrawRectangle(pen, boundingBox.X, boundingBox.Y, boundingBox.Width, boundingBox.Height);
				break;

				case(NodeShape.Ellipse):
					graphics.DrawEllipse(pen, boundingBox);
				break;

				case(NodeShape.Capsule):
				case(NodeShape.RoundedRectangle):
					float radius= _shape ==NodeShape.RoundedRectangle ? 10.0f: boundingBox.Height;

					System.Drawing.Extended.ExtendedGraphics extended= new System.Drawing.Extended.ExtendedGraphics(graphics);

					extended.DrawRoundRectangle(pen, boundingBox.X, boundingBox.Y, boundingBox.Width, boundingBox.Height, radius);
				break;

				default: throw new Exception(Resources.ExceptionUnhandledNodeShape);
			}
		}
コード例 #2
0
ファイル: Node.cs プロジェクト: drzo/opensim4opencog
		/// <summary>
		/// Draws the background and shape of the node
		/// </summary>
		/// <param name="graphics">The grpahics object we render to.</param>
		/// <param name="boundingBox">The untransformed bounding box of the node.</param>
		/// <param name="brush">The brush used for the background.</param>
		public virtual void DrawShapeBackground(Graphics graphics, RectangleF boundingBox, Brush brush)
		{
			switch(_shape)
			{
				case(NodeShape.Rectangle):
					graphics.FillRectangle(brush, boundingBox);
				break;

				case(NodeShape.Ellipse):
					graphics.FillEllipse(brush, boundingBox);
				break;

				case(NodeShape.Capsule):
				case(NodeShape.RoundedRectangle):
					float radius= _shape ==NodeShape.RoundedRectangle ? 10.0f: boundingBox.Height;

					System.Drawing.Extended.ExtendedGraphics extended= new System.Drawing.Extended.ExtendedGraphics(graphics);

					extended.FillRoundRectangle(brush, boundingBox.X, boundingBox.Y, boundingBox.Width, boundingBox.Height, radius);
				break;

				default: throw new Exception(Resources.ExceptionUnhandledNodeShape);
			}
		}