AnimatGuiCtrls.Controls.TimeRuler.DrawValue C# (CSharp) 메소드

DrawValue() 개인적인 메소드

private DrawValue ( Graphics g, int iValue, int iPosition, int iSpaceAvailable ) : void
g System.Drawing.Graphics
iValue int
iPosition int
iSpaceAvailable int
리턴 void
		private void DrawValue(Graphics g, int iValue, int iPosition, int iSpaceAvailable)
		{

			// The sizing operation is common to all options
			StringFormat format = new StringFormat(StringFormatFlags.MeasureTrailingSpaces);
			if (_VerticalNumbers)
				format.FormatFlags |= StringFormatFlags.DirectionVertical;
			
			SizeF size = g.MeasureString((iValue).ToString(), this.Font, iSpaceAvailable, format);

			Point drawingPoint;
			int iX = 0;
			int iY = 0;

			if (this.Orientation == enumOrientation.orHorizontal)
			{
				switch(_RulerAlignment)
				{
					case enumRulerAlignment.raBottomOrRight:
					{
						iX = iPosition + iSpaceAvailable - (int)size.Width - 2;
						iY = _iHeaderOffset + 2;
						break;
					}
					case enumRulerAlignment.raMiddle:
					{
						iX = iPosition + iSpaceAvailable - (int)size.Width/2;
						iY = _iHeaderOffset + (Height - _iHeaderOffset - (int)size.Height)/2 - 2;
						break;
					}
					case enumRulerAlignment.raTopOrLeft:
					{
						iX = iPosition + iSpaceAvailable - (int)size.Width - 2;
						iY = Height - (int)size.Height - 2;
						break;
					}
				}

				drawingPoint = new Point(iX, iY);
			}
			else
			{
				switch(_RulerAlignment)
				{
					case enumRulerAlignment.raBottomOrRight:
					{
						iX = _iHeaderOffset + 2;
						iY = iPosition + iSpaceAvailable - (int)size.Height - 2;
						break;
					}
					case enumRulerAlignment.raMiddle:
					{
						iX = _iHeaderOffset + (Width - _iHeaderOffset - (int)size.Width)/2 - 2;
						iY = iPosition + iSpaceAvailable - (int)size.Height/2;
						break;
					}
					case enumRulerAlignment.raTopOrLeft:
					{
						iX = Width - (_iHeaderOffset + 2) - (int)size.Width;
						iY = iPosition + iSpaceAvailable - (int)size.Height - 2;
						break;
					}
				}

				drawingPoint = new Point(iX, iY);
			}

			// The drawstring function is common to all operations

			g.DrawString(iValue.ToString(), this.Font, new SolidBrush(this.ForeColor), drawingPoint, format);
		}