本文整理汇总了C#中Pango.Layout.GetPixelExtents方法的典型用法代码示例。如果您正苦于以下问题:C# Pango.Layout.GetPixelExtents方法的具体用法?C# Pango.Layout.GetPixelExtents怎么用?C# Pango.Layout.GetPixelExtents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pango.Layout
的用法示例。
在下文中一共展示了Pango.Layout.GetPixelExtents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
{
using (var cr = Gdk.CairoHelper.Create (window)) {
Pango.Rectangle ink, logical;
using (var layout = new Pango.Layout (Context)) {
layout.FontDescription = font;
layout.SetMarkup (GetFileMarkup ((flags & CellRendererState.Selected) != 0));
layout.GetPixelExtents (out ink, out logical);
var width = widget.Allocation.Width;
cr.Translate (width - logical.Width - 10, cell_area.Y);
cr.ShowLayout (layout);
cr.IdentityMatrix ();
layout.SetMarkup (GetMethodMarkup ((flags & CellRendererState.Selected) != 0));
layout.Width = (int)((width - logical.Width - 35) * Pango.Scale.PangoScale);
layout.Ellipsize = Pango.EllipsizeMode.Middle;
cr.Translate (cell_area.X + 10, cell_area.Y);
cr.ShowLayout (layout);
}
}
}
示例2: GetSize
public override void GetSize (Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
using (var layout = new Pango.Layout (Context)) {
Pango.Rectangle ink, logical;
layout.FontDescription = font;
layout.SetMarkup (GetMethodMarkup (false));
layout.GetPixelExtents (out ink, out logical);
height = logical.Height;
width = 0;
x_offset = 0;
y_offset = 0;
}
}
示例3: Render
protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
{
using (var cr = Gdk.CairoHelper.Create (window)) {
using (var layout = new Pango.Layout (Context)) {
Pango.Rectangle ink, logical;
layout.Width = (int) (MaxMarkupWidth * Pango.Scale.PangoScale);
layout.SetMarkup (GetMarkup ((flags & CellRendererState.Selected) != 0));
layout.GetPixelExtents (out ink, out logical);
RenderLineNumberIcon (widget, cr, cell_area, logical.Height, ink.Y);
cr.Rectangle (expose_area.X, expose_area.Y, expose_area.Width, expose_area.Height);
cr.Clip ();
cr.Translate (cell_area.X + Padding + RoundedRectangleWidth + Padding + Padding, cell_area.Y + Padding);
cr.ShowLayout (layout);
}
}
}
示例4: GetSize
public override void GetSize (Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
using (var layout = new Pango.Layout (Context)) {
Pango.Rectangle ink, logical;
layout.Width = (int) (MaxMarkupWidth * Pango.Scale.PangoScale);
layout.SetMarkup (GetMarkup (false));
layout.GetPixelExtents (out ink, out logical);
width = Padding + RoundedRectangleWidth + Padding + Padding + logical.Width + Padding;
height = Padding + Math.Max (RoundedRectangleHeight, logical.Height) + Padding;
x_offset = 0;
y_offset = 0;
}
}