AnimatGuiCtrls.Controls.TimeRuler.DrawTimeScale C# (CSharp) Méthode

DrawTimeScale() private méthode

private DrawTimeScale ( Graphics g ) : void
g System.Drawing.Graphics
Résultat void
		private void DrawTimeScale(Graphics g)
		{
			StringFormat format = new StringFormat(StringFormatFlags.MeasureTrailingSpaces);
			if (_VerticalNumbers)
				format.FormatFlags |= StringFormatFlags.DirectionVertical;

			int iSpaceAvailable;
			//Debug.WriteLine("Scale: " +  _Scale.ToString());
			if (this.Orientation == enumOrientation.orHorizontal)
				iSpaceAvailable = (int) (_Scale*2/3)-2;
			else
				iSpaceAvailable = _Bitmap.Width - _iHeaderOffset - 2;

			string strText = _TimeScale.ToString();
			SizeF size = g.MeasureString(strText, this.Font);
			
			if(size.Width > iSpaceAvailable || 
				this.Orientation == enumOrientation.orVertical)
			{
				strText = GetTimeScaleAbbreviation(_TimeScale);
				size = g.MeasureString(strText, this.Font);
			}

			Point drawingPoint = new Point(0, 0);
			int iX = 0;
			int iY = 0;

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

				drawingPoint = new Point(iX, iY);
				//g.DrawString(strText, this.Font, new SolidBrush(this.ForeColor), drawingPoint, format);
			}
			else
			{
				switch(_RulerAlignment)
				{
					case enumRulerAlignment.raBottomOrRight:
					{
						iX = _iHeaderOffset + 2;
						iY = 7;
						break;
					}
					case enumRulerAlignment.raMiddle:
					{
						iX = _iHeaderOffset + 2;
						iY = 7;
						break;
					}
					case enumRulerAlignment.raTopOrLeft:
					{
						iX = Width - 2 - (int)size.Width;
						iY = 7;
						break;
					}
				}

				drawingPoint = new Point(iX, iY);
			}

			// The drawstring function is common to all operations
			g.DrawString(strText, this.Font, new SolidBrush(this.ForeColor), drawingPoint, format);
		}