예제 #1
0
		private void DrawVLine (DrawingContext dc)
		{
			var activeArea = GetArea (Region.Selection.SelectedToken, Region);
			if (activeArea == null)
				return;

			var width = Region.Selection.Type == SelectionType.Left ? -2 : activeArea.Width + 2;

			if (Region.Selection.SelectedToken is TextToken) {
				var textToken = Region.Selection.SelectedToken as TextToken;

				if (!string.IsNullOrEmpty (textToken.Text) && Region.Selection.Position != 0) {
					var ft = new FormattedText (textToken.Text.Substring (0, Region.Selection.Position), textToken.FontFamily, textToken.FontSize, Colors.Black);

					width = ft.Width + 2;
				} else
					width = 0;
			}

			var startPoint = activeArea.PointToScreen (new Point (width, -2));
			startPoint = Region.PointFromScreen (startPoint);

			var endPoint = activeArea.PointToScreen (new Point (width, activeArea.Height + 2));
			endPoint = Region.PointFromScreen (endPoint);

			dc.DrawLine (new Pen (Colors.Red, 1.5), startPoint, endPoint);
		}
		public override void DrawText (FormattedText formattedText, Point origin)
		{
			cr.Color = new Cairo.Color (formattedText.Foreground.R, formattedText.Foreground.G, formattedText.Foreground.B, formattedText.Foreground.Alfa);	
			cr.MoveTo (origin.X, origin.Y + formattedText.Height);
			
			cr.SelectFontFace (formattedText.FontFamily, Cairo.FontSlant.Normal, Cairo.FontWeight.Normal);
			cr.SetFontSize (formattedText.FontSize);
			
			cr.ShowText (formattedText.Text);
		}
		public abstract void DrawText (FormattedText formattedText, Point origin);
		protected override Size MeasureOverride (Size availableSize)
		{
			var formatedText = new FormattedText (Text, FontFamily, FontSize, Foreground);

			return new Size (formatedText.Width, formatedText.Extent);
		}		
 public abstract void DrawText(FormattedText formattedText, Point origin);