/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			// Operator + is 3x3 pixels.
			// Measure child elements.
			this.Left.MeasureElement(e);
			this.Right.MeasureElement(e);
			
			// Calculate maximal upper half and downer part
			// (important for fraction calculations).
			int topPart = Math.Max(
				3,
				Math.Max(this.Left.RenderBounds.TopPart, this.Right.RenderBounds.TopPart)
			);
			
			int bottomPart = Math.Max(
				3,
				Math.Max(this.Left.RenderBounds.BottomPart, this.Right.RenderBounds.BottomPart)
			);
			
			// Set own size.
			this.RenderBounds = new NuGenCenteredSize(
				// Width is sum of all widths.
				this.Left.RenderBounds.Width + 8 + this.Right.RenderBounds.Width,
				// Height is sum of the maximal parts.
				topPart + bottomPart,
				// Mid is position of operator.
				this.Left.RenderBounds.Width + 4, topPart
			);
		}
Exemple #2
0
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			//measure child element
			this.Element.MeasureElement(e);
			//set own size
			this.RenderBounds = new NuGenCenteredSize(
				this.Element.RenderBounds.Width + 8, this.Element.RenderBounds.Height + 2,
				this.Element.RenderBounds.LeftPart + 3, this.Element.RenderBounds.TopPart + 2);
		}
Exemple #3
0
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			//measure child
			this.Element.MeasureElement(e);
			//calculate "sin" size
			Size funcsize = Size.Round(e.Graphics.MeasureString("log", e.Font));
			//set own size
			this.RenderBounds = new NuGenCenteredSize(
				this.Element.RenderBounds.Width + 6 + funcsize.Width,
				Math.Max(this.Element.RenderBounds.Height, funcsize.Height));
		}
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			//measure child elements
			this.Left.MeasureElement(e);
			this.Right.MeasureElement(e);
			//calculate height
			int height = Math.Max(this.Right.RenderBounds.Height / 2, this.Right.RenderBounds.Height / 4 + this.Left.RenderBounds.TopPart) + 1;
			//set own size
			this.RenderBounds = new NuGenCenteredSize(
				//width is sum of all widths
				this.Left.RenderBounds.Width + this.Right.RenderBounds.Width / 2,
				//height is sum of all heights
				this.Left.RenderBounds.BottomPart + height,
				//mid is position of operator
				this.Left.RenderBounds.Width, height);
		}
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			//operator is a fraction line
			//measure child elements
			this.Left.MeasureElement(e);
			this.Right.MeasureElement(e);
			//width is max of all widths +4
			int width = Math.Max(this.Left.RenderBounds.Width, this.Right.RenderBounds.Width) + 4;
			//set own size
			this.RenderBounds = new NuGenCenteredSize(
				width,
				//height is sum of all heights
				this.Left.RenderBounds.Height + this.Right.RenderBounds.Height,
				//mid is position of operator
				width / 2, this.Left.RenderBounds.Height);
		}
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			//operator * is 1x1 pixels
			//measure child elements
			this.Left.MeasureElement(e);
			this.Right.MeasureElement(e);
			//calculate maximal upper half and downer half
			//(important for fraction calculations)
			int tophalf =
				Math.Max(this.Left.RenderBounds.TopPart, this.Right.RenderBounds.TopPart),
				bottomhalf =
				Math.Max(this.Left.RenderBounds.BottomPart, this.Right.RenderBounds.BottomPart);
			//set own size
			this.RenderBounds = new NuGenCenteredSize(
				//width is sum of all widths
				this.Left.RenderBounds.Width + 4 + this.Right.RenderBounds.Width,
				//height is sum of the maximal halfs
				tophalf + bottomhalf,
				//mid is position of operator
				this.Left.RenderBounds.Width + 2, tophalf);
		}
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			Size opsize = Size.Round(e.Graphics.MeasureString("mod", e.Font));
			int ophalf = opsize.Height / 2;
			//measure child elements
			this.Left.MeasureElement(e);
			this.Right.MeasureElement(e);
			//calculate maximal upper half and downer half
			//(important for fraction calculations)
			int tophalf =
				Math.Max(ophalf, Math.Max(this.Left.RenderBounds.TopPart, this.Right.RenderBounds.TopPart)),
				bottomhalf =
				Math.Max(ophalf, Math.Max(this.Left.RenderBounds.BottomPart, this.Right.RenderBounds.BottomPart));
			//set own size
			this.RenderBounds = new NuGenCenteredSize(
				//width is sum of all widths
				this.Left.RenderBounds.Width + opsize.Width + 2 + this.Right.RenderBounds.Width,
				//height is sum of the maximal halfs
				tophalf + bottomhalf,
				//mid is position of operator
				this.Left.RenderBounds.Width + 1, tophalf);
		}
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		public abstract void MeasureElement(NuGenMeasureElementArgs e);
Exemple #9
0
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			this.Element.MeasureElement(e);
			this.RenderBounds = new NuGenCenteredSize(
				this.Element.RenderBounds.Width + 4, this.Element.RenderBounds.Height + 6);
		}
		/// <summary>
		/// Measures the element and its subitems with the speicifed <see cref="NuGenMeasureElementArgs"/>.
		/// </summary>
		/// <param name="e"></param>
		public override void MeasureElement(NuGenMeasureElementArgs e)
		{
			this.RenderBounds = new NuGenCenteredSize(
				Size.Round(e.Graphics.MeasureString(this.ToString(), e.Font))
			);
		}