• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Pango.Layout类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Pango.Layout的典型用法代码示例。如果您正苦于以下问题:C# Pango.Layout类的具体用法?C# Pango.Layout怎么用?C# Pango.Layout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Pango.Layout类属于命名空间,在下文中一共展示了Pango.Layout类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BigList

 public BigList(IListModel provider)
 {
     this.provider = provider;
       RefAccessible ().Role = Atk.Role.List;
       hAdjustment = new Gtk.Adjustment (0, 0, currentWidth, 1, 1, 1);
       hAdjustment.ValueChanged += new EventHandler (HAdjustmentValueChangedHandler);
       vAdjustment = new Gtk.Adjustment (0, 0, provider.Rows, 1, 1, 1);
       vAdjustment.ValueChanged += new EventHandler (VAdjustmentValueChangedHandler);
       layout = new Pango.Layout (PangoContext);
       ExposeEvent += new ExposeEventHandler (ExposeHandler);
       ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEventHandler);
       ButtonReleaseEvent += new ButtonReleaseEventHandler (ButtonReleaseEventHandler);
       KeyPressEvent += new KeyPressEventHandler (KeyHandler);
       Realized += new EventHandler (RealizeHandler);
       Unrealized += new EventHandler (UnrealizeHandler);
       ScrollEvent += new ScrollEventHandler (ScrollHandler);
         SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler);
       MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEventHandler);
       AddEvents ((int) EventMask.ButtonPressMask | (int) EventMask.ButtonReleaseMask | (int) EventMask.KeyPressMask | (int) EventMask.PointerMotionMask);
       CanFocus = true;
       style_widget = new EventBox ();
       style_widget.StyleSet += new StyleSetHandler (StyleHandler);
       layout.SetMarkup (ellipsis);
       layout.GetPixelSize (out ellipsis_width, out line_height);
       layout.SetMarkup ("n");
       layout.GetPixelSize (out en_width, out line_height);
       layout.SetMarkup ("W");
       layout.GetPixelSize (out en_width, out line_height);
       old_width = Allocation.Width;
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:30,代码来源:list.cs


示例2: FormattedTextImpl

        public FormattedTextImpl(
            Pango.Context context,
            string text,
            string fontFamily,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            Contract.Requires<ArgumentNullException>(context != null);
            Contract.Requires<ArgumentNullException>(text != null);
            Layout = new Pango.Layout(context);
            _text = text;
            Layout.SetText(text);
            Layout.FontDescription = new Pango.FontDescription
            {
                Family = fontFamily,
                Size = Pango.Units.FromDouble(CorrectScale(fontSize)),
                Style = (Pango.Style)fontStyle,
                Weight = fontWeight.ToCairo()
            };

            Layout.Alignment = textAlignment.ToCairo();
            Layout.Attributes = new Pango.AttrList();
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:25,代码来源:FormattedTextImpl.cs


示例3: RenderPlaceholderText

		internal static void RenderPlaceholderText (Gtk.Entry entry, Gtk.ExposeEventArgs args, string placeHolderText, ref Pango.Layout layout)
		{
			// The Entry's GdkWindow is the top level window onto which
			// the frame is drawn; the actual text entry is drawn into a
			// separate window, so we can ensure that for themes that don't
			// respect HasFrame, we never ever allow the base frame drawing
			// to happen
			if (args.Event.Window == entry.GdkWindow)
				return;

			if (entry.Text.Length > 0)
				return;

			if (layout == null) {
				layout = new Pango.Layout (entry.PangoContext);
				layout.FontDescription = entry.PangoContext.FontDescription.Copy ();
			}

			int wh, ww;
			args.Event.Window.GetSize (out ww, out wh);

			int width, height;
			layout.SetText (placeHolderText);
			layout.GetPixelSize (out width, out height);
			using (var gc = new Gdk.GC (args.Event.Window)) {
				gc.Copy (entry.Style.TextGC (Gtk.StateType.Normal));
				Color color_a = entry.Style.Base (Gtk.StateType.Normal).ToXwtValue ();
				Color color_b = entry.Style.Text (Gtk.StateType.Normal).ToXwtValue ();
				gc.RgbFgColor = color_b.BlendWith (color_a, 0.5).ToGtkValue ();

				args.Event.Window.DrawLayout (gc, 2, (wh - height) / 2 + 1, layout);
			}
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:33,代码来源:TextEntryBackendGtk2.cs


示例4: Paint

        public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect)
        {
            int one_width = (int) textArea.TextView.GetWidth ('w');

            using (Gdk.GC gc = new Gdk.GC (wnd)) {
            using (Pango.Layout ly = new Pango.Layout (TextArea.PangoContext)) {
                ly.FontDescription = FontContainer.DefaultFont;
                ly.Width = drawingPosition.Width;
                ly.Alignment = Pango.Alignment.Right;

                HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");

                gc.RgbBgColor = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
                gc.RgbFgColor = TextArea.Style.White;
                wnd.DrawRectangle (gc, true, drawingPosition);

                gc.RgbFgColor = new Gdk.Color (lineNumberPainterColor.Color);
                gc.SetLineAttributes (1, LineStyle.OnOffDash, CapStyle.NotLast, JoinStyle.Miter);
                wnd.DrawLine (gc, drawingPosition.X + drawingPosition.Width, drawingPosition.Y, drawingPosition.X + drawingPosition.Width, drawingPosition.Height);

                //FIXME: This doesnt allow different fonts and what not
                int fontHeight = TextArea.TextView.FontHeight;

                for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / fontHeight + 1; ++y) {
                    int ypos = drawingPosition.Y + fontHeight * y  - textArea.TextView.VisibleLineDrawingRemainder;

                    int curLine = y + textArea.TextView.FirstVisibleLine;
                    if (curLine < textArea.Document.TotalNumberOfLines) {
                        ly.SetText ((curLine + 1).ToString ());
                        wnd.DrawLayout (gc, drawingPosition.X + drawingPosition.Width - one_width, ypos, ly);
                    }
                }
            }}
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:34,代码来源:GutterMargin.cs


示例5: OnDrawn

        protected override bool OnDrawn(Cairo.Context cr)
        {
            double step_width = Allocation.Width / (double)steps;
            double step_height = Allocation.Height / (double)steps;
            double h = 1.0;
            double s = 0.0;

            for (int xi = 0, i = 0; xi < steps; xi++) {
                for (int yi = 0; yi < steps; yi++, i++) {
                    double bg_b = (double)(i / 255.0);
                    double fg_b = 1.0 - bg_b;

                    double x = xi * step_width;
                    double y = yi * step_height;

                    cr.Rectangle (x, y, step_width, step_height);
                    cr.Color = CairoExtensions.ColorFromHsb (h, s, bg_b);
                    cr.Fill ();

                    int tw, th;
                    Pango.Layout layout = new Pango.Layout (PangoContext);
                    layout.SetText (((int)(bg_b * 255.0)).ToString ());
                    layout.GetPixelSize (out tw, out th);

                    cr.Translate (0.5, 0.5);
                    cr.MoveTo (x + (step_width - tw) / 2.0, y + (step_height - th) / 2.0);
                    cr.Color = CairoExtensions.ColorFromHsb (h, s, fg_b);
                    PangoCairoHelper.ShowLayout (cr, layout);
                    cr.Translate (-0.5, -0.5);
                }
            }

            return true;
        }
开发者ID:knocte,项目名称:hyena,代码行数:34,代码来源:ShadingTestWindow.cs


示例6: Render

        public override void Render(Drawable window,
                                     Widget widget,
                                     Rectangle cell_area,
                                     Rectangle expose_area,
                                     StateType cell_state,
                                     IPhoto photo)
        {
            string text = GetRenderText (photo);

            var layout = new Pango.Layout (widget.PangoContext);
            layout.SetText (text);

            Rectangle layout_bounds;
            layout.GetPixelSize (out layout_bounds.Width, out layout_bounds.Height);

            layout_bounds.Y = cell_area.Y;
            layout_bounds.X = cell_area.X + (cell_area.Width - layout_bounds.Width) / 2;

            if (layout_bounds.IntersectsWith (expose_area)) {
                Style.PaintLayout (widget.Style, window, cell_state,
                                   true, expose_area, widget, "IconView",
                                   layout_bounds.X, layout_bounds.Y,
                                   layout);
            }
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:25,代码来源:ThumbnailTextCaptionRenderer.cs


示例7: Render

		protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
		{
			base.Render (window, widget, background_area, cell_area, expose_area, flags);

			if (PackageSourceViewModel == null)
				return;
				
			using (var layout = new Pango.Layout (widget.PangoContext)) {
				layout.Alignment = Pango.Alignment.Left;
				layout.SetMarkup (GetPackageSourceNameMarkup ());
				int packageSourceNameWidth = GetLayoutWidth (layout);
				StateType state = GetState (widget, flags);

				layout.SetMarkup (GetPackageSourceDescriptionMarkup ());

				window.DrawLayout (widget.Style.TextGC (state), cell_area.X + textSpacing, cell_area.Y + textTopSpacing, layout);

				if (!PackageSourceViewModel.IsValid) {
					using (var ctx = Gdk.CairoHelper.Create (window)) {
						ctx.DrawImage (widget, warningImage, cell_area.X + textSpacing + packageSourceNameWidth + imageSpacing, cell_area.Y + textTopSpacing);
					}

					layout.SetMarkup (GetPackageSourceErrorMarkup ());
					int packageSourceErrorTextX = cell_area.X + textSpacing + packageSourceNameWidth + (int)warningImage.Width + (2 * imageSpacing);
					window.DrawLayout (widget.Style.TextGC (state), packageSourceErrorTextX, cell_area.Y + textTopSpacing, layout);
				}
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:28,代码来源:PackageSourceCellRenderer.cs


示例8: CodeSegmentPreviewWindow

		public CodeSegmentPreviewWindow (TextEditor editor, bool hideCodeSegmentPreviewInformString, ISegment segment, int width, int height) : base (Gtk.WindowType.Popup)
		{
			this.HideCodeSegmentPreviewInformString = hideCodeSegmentPreviewInformString;
			this.editor = editor;
			this.AppPaintable = true;
			layout = PangoUtil.CreateLayout (this);
			informLayout = PangoUtil.CreateLayout (this);
			informLayout.SetText (CodeSegmentPreviewInformString);
			
			fontDescription = Pango.FontDescription.FromString (editor.Options.FontName);
			fontDescription.Size = (int)(fontDescription.Size * 0.8f);
			layout.FontDescription = fontDescription;
			layout.Ellipsize = Pango.EllipsizeMode.End;
			// setting a max size for the segment (40 lines should be enough), 
			// no need to markup thousands of lines for a preview window
			int startLine = editor.Document.OffsetToLineNumber (segment.Offset);
			int endLine = editor.Document.OffsetToLineNumber (segment.EndOffset);
			const int maxLines = 40;
			bool pushedLineLimit = endLine - startLine > maxLines;
			if (pushedLineLimit)
				segment = new Segment (segment.Offset, editor.Document.GetLine (startLine + maxLines).Offset - segment.Offset);
			layout.Ellipsize = Pango.EllipsizeMode.End;
			layout.SetMarkup (editor.Document.SyntaxMode.GetMarkup (editor.Document,
			                                                        editor.Options,
			                                                        editor.ColorStyle,
			                                                        segment.Offset,
			                                                        segment.Length,
			                                                        true) + (pushedLineLimit ? Environment.NewLine + "..." : ""));
			CalculateSize ();
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:30,代码来源:CodeSegmentPreviewWindow.cs


示例9: InitCell

		public void InitCell (Widget container, bool diffMode, string[] lines, TreePath path)
		{
			if (isDisposed)
				return;
			this.lines = lines;
			this.diffMode = diffMode;
			this.path = path;
			
			if (diffMode) {
				if (lines != null && lines.Length > 0) {
					int maxlen = -1;
					int maxlin = -1;
					for (int n=0; n<lines.Length; n++) {
						if (lines [n].Length > maxlen) {
							maxlen = lines [n].Length;
							maxlin = n;
						}
					}
					DisposeLayout ();
					layout = CreateLayout (container, lines [maxlin]);
					layout.GetPixelSize (out width, out lineHeight);
					height = lineHeight * lines.Length;
				}
				else
					width = height = 0;
			}
			else {
				DisposeLayout ();
				layout = CreateLayout (container, string.Join (Environment.NewLine, lines));
				layout.GetPixelSize (out width, out height);
			}
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:32,代码来源:CellRendererDiff.cs


示例10: FoldMarkerMargin

		public FoldMarkerMargin (TextEditor editor)
		{
			this.editor = editor;
			layout = PangoUtil.CreateLayout (editor);
			editor.Caret.PositionChanged += HandleEditorCaretPositionChanged;
			editor.Document.FoldTreeUpdated += HandleEditorDocumentFoldTreeUpdated;
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:7,代码来源:FoldMarkerMargin.cs


示例11: RenderLine

		protected override LayoutWrapper RenderLine (long line)
		{
			Pango.Layout layout = new Pango.Layout (Editor.PangoContext);
			layout.FontDescription = Editor.Options.Font;
			layout.SetText (string.Format ("{0:X}", line * Editor.BytesInRow));
			return new LayoutWrapper (layout);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:GutterMargin.cs


示例12: DisposeLayout

		void DisposeLayout ()
		{
			if (layout != null) {
				layout.Dispose ();
				layout = null;
			}
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:7,代码来源:CellRendererDiff.cs


示例13: RenderCairo

        public RenderCairo(Cairo.Context g, float scale)
        {
            this.g = g;
            this.layout = Pango.CairoHelper.CreateLayout(g);
			
            dpiX *= scale;
            dpiY *= scale;
        }
开发者ID:myersBR,项目名称:My-FyiReporting,代码行数:8,代码来源:RenderCairo.cs


示例14: Label

 public Label()
     : base(0)
 {
     layout = new Pango.Layout(Gdk.PangoHelper.ContextGet());
     horizAlignment = Alignment.Left;
     vertAlignment = Alignment.Top;
     markup = "";
 }
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:8,代码来源:Label.cs


示例15: Board

 public Board(ArrayList pos)
     : base()
 {
     figure = new Figure ();
     position = new Position (pos);
     info = new MoveInfo ();
     layout = new Pango.Layout (PangoContext);
 }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:8,代码来源:Board.cs


示例16: DocView

 public DocView(DocTree tree)
 {
     this.tree = tree;
     CanFocus = true;
     Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.ExposureMask | EventMask.KeyPressMask | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask;
     layout = CreatePangoLayout (String.Empty);
     tree.NodeSelected += new NodeSelectedEventHandler (OnNodeSelected);
 }
开发者ID:mono,项目名称:monodoc-widgets,代码行数:8,代码来源:DocView.cs


示例17: TextEngine

        public TextEngine()
        {
            lines = new List<string> ();

            layout = new Pango.Layout (PintaCore.Chrome.Canvas.PangoContext);
            imContext = new Gtk.IMMulticontext ();
            imContext.Commit += OnCommit;
        }
开发者ID:jobernolte,项目名称:Pinta,代码行数:8,代码来源:TextEngine.cs


示例18: ItemButton

 public ItemButton()
     : base()
 {
     HeightRequest = 32;
     PangoText = new Pango.Layout(this.PangoContext);
     PangoTag = new Pango.Layout(this.PangoContext);
     Relief = ReliefStyle.None;
 }
开发者ID:QualitySolution,项目名称:CarGlass,代码行数:8,代码来源:ItemButton.cs


示例19: FoldMarkerMargin

		public FoldMarkerMargin (TextEditor editor)
		{
			this.editor = editor;
			layout = PangoUtil.CreateLayout (editor);
			delayTimer = new Timer (150);
			delayTimer.AutoReset = false;
			delayTimer.Elapsed += DelayTimerElapsed;
			editor.Caret.PositionChanged += HandleEditorCaretPositionChanged;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:9,代码来源:FoldMarkerMargin.cs


示例20: LayoutProxy

			public LayoutProxy (LayoutCache layoutCache, Pango.Layout layout)
			{
				if (layoutCache == null)
					throw new ArgumentNullException ("layoutCache");
				if (layout == null)
					throw new ArgumentNullException ("layout");
				this.layoutCache = layoutCache;
				this.layout = layout;
			}
开发者ID:kdubau,项目名称:monodevelop,代码行数:9,代码来源:LayoutCache.cs



注:本文中的Pango.Layout类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Paragraph类代码示例发布时间:2022-05-24
下一篇:
C# Pango.FontDescription类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap