当前位置: 首页>>代码示例>>C#>>正文


C# Context.RelMoveTo方法代码示例

本文整理汇总了C#中Cairo.Context.RelMoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# Context.RelMoveTo方法的具体用法?C# Context.RelMoveTo怎么用?C# Context.RelMoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cairo.Context的用法示例。


在下文中一共展示了Context.RelMoveTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawTriangle

			void DrawTriangle (Context ctx)
			{
				var halfSide = arrowPadding;
				var verticalModifier = arrowPosition == Xwt.Popover.Position.Top ? -1 : 1;
				// Move to the left
				ctx.RelMoveTo (-halfSide, 0);
				ctx.RelLineTo (halfSide, verticalModifier * arrowPadding);
				ctx.RelLineTo (halfSide, verticalModifier * -arrowPadding);
			}
开发者ID:silasary,项目名称:xwt,代码行数:9,代码来源:PopoverBackend.cs

示例2: DrawText

 public static void DrawText(Context cr, string family, double fontSize, string text, Pango.Alignment alignment)
 {
     //   return;
       lock (FontCache) {
     //   LogError("DrawText {0}", text);
     Profiler p = new Profiler ("DrawText");
     double w,h;
     Pango.Layout layout = GetLayout (cr, family, QuantizeFontSize(fontSize));
     layout.SetText (text);
     layout.Alignment = alignment;
     layout.GetExtents(out pe, out le);
     p.Time ("GetExtents {0}", pe);
     w = (double)le.Width / (double)Pango.Scale.PangoScale;
     h = (double)le.Height / (double)Pango.Scale.PangoScale;
     if (alignment == Pango.Alignment.Right) {
       cr.RelMoveTo (-w, 0);
     } else if (alignment == Pango.Alignment.Center) {
       cr.RelMoveTo (-w/2, 0);
     }
     Pango.CairoHelper.ShowLayout (cr, layout);
     p.Time ("ShowLayout");
     if (ShowTextExtents) {
       cr.Save ();
     PointD pt = cr.CurrentPoint;
     cr.MoveTo (pt.X, pt.Y);
     cr.RelLineTo(w, 0);
     cr.RelLineTo(0, h);
     cr.Operator = Operator.Over;
     cr.Color = new Color (1,0.5,1,0.5);
     cr.LineWidth = 0.5;
     cr.Stroke ();
     cr.MoveTo (pt.X, pt.Y);
       cr.Restore ();
     }
     cr.RelMoveTo (w, 0);
       }
 }
开发者ID:kig,项目名称:filezoo,代码行数:37,代码来源:helpers.cs

示例3: Text

 public void Text(Context context,  string txt, HorizontalTextAlignment horizontal = HorizontalTextAlignment.Center, VerticalTextAlignment vertical = VerticalTextAlignment.Middle)
 {
     context.SelectFontFace ("Sans", FontSlant.Normal, FontWeight.Normal);
     //context.SetFontSize (_surface.Height / 10);
     context.SetFontSize (14);
     var extends = context.TextExtents (txt);
     double x, y;
     x = -(((double)horizontal) / 2 * extends.Width + extends.XBearing);
     y = -(((double)vertical) / 2 * extends.Height + extends.YBearing);
     context.RelMoveTo (x, y);
     context.ShowText (txt);
 }
开发者ID:codingcave,项目名称:CoupledOdeViewer,代码行数:12,代码来源:AxisProperties.cs

示例4: ClickSortBar

 /** FAST */
 bool ClickSortBar(Context cr, double x, double y)
 {
     cr.NewPath ();
     cr.MoveTo (0.0, 0.0);
     TextExtents te;
     cr.Color = ActiveColor;
     cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * 0.4 );
     Helpers.DrawText (cr, ToolbarTitleFontFamily, ToolbarTitleFontSize, SortLabel);
     cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * -0.4 );
     foreach (SortHandler sf in SortFields) {
       cr.Color = (SortField == sf) ? ActiveColor : InActiveColor;
       te = Helpers.GetTextExtents (
     cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
       if (Helpers.CheckTextExtents(cr, te, x, y)) {
     SortField = sf;
     ResetZoom ();
     UpdateLayout ();
     return true;
       }
       Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
       Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, " ");
     }
     return false;
 }
开发者ID:kig,项目名称:filezoo,代码行数:25,代码来源:filezoo.cs

示例5: ClickBreadcrumb

 /** FAST */
 bool ClickBreadcrumb(Context cr, uint width, double x, double y)
 {
     if (CurrentDirPath == Helpers.RootDir) return false;
     TextExtents te1 = Helpers.GetTextExtents (cr, BreadcrumbFontFamily, BreadcrumbFontSize, String.Join(dirSep, CurrentDirPath.Split(Helpers.DirSepC)) + dirSep);
     cr.Save ();
       double areaWidth = width-BreadcrumbMarginLeft-BreadcrumbMarginRight;
       cr.Rectangle (0,0,areaWidth, te1.Height);
       cr.Clip ();
       cr.Translate (Math.Min(0,areaWidth-te1.Width), -BreadcrumbMarginTop);
       if (areaWidth - te1.Width >= 0)
     cr.Translate(-(BreadcrumbMarginLeft+1), 0);
       cr.MoveTo (0.0, 0.0);
       int hitIndex = 0;
       string[] segments = CurrentDirPath.Split(Helpers.DirSepC);
       foreach (string s in segments) {
     string name = (s == "") ? rootChar : s+dirSep;
     TextExtents te = Helpers.GetTextExtents (cr, BreadcrumbFontFamily, BreadcrumbFontSize, name);
     te.Height += BreadcrumbMarginTop;
     if (s == "" && (areaWidth - te1.Width >= 0))
       te.Width += BreadcrumbMarginLeft+1;
     if (Helpers.CheckTextExtents(cr, te, x, y)) {
       string newDir = String.Join(Helpers.DirSepS, segments, 0, hitIndex+1);
       if (newDir == "") newDir = Helpers.RootDir;
       if (newDir != CurrentDirPath) {
         SetCurrentDir (newDir);
       } else {
         ResetZoom ();
         UpdateLayout ();
       }
       cr.Restore ();
       return true;
     }
     cr.RelMoveTo( te.Width, 0 );
     hitIndex += 1;
       }
       cr.IdentityMatrix ();
       cr.Rectangle (0,-1,width,2);
       if (cr.InFill(x,y)) {
     ResetZoom ();
     UpdateLayout ();
       }
     cr.Restore ();
     return false;
 }
开发者ID:kig,项目名称:filezoo,代码行数:45,代码来源:filezoo.cs

示例6: DrawSortBar

 /** FAST */
 void DrawSortBar(Context cr)
 {
     cr.NewPath ();
     cr.MoveTo (0.0, 0.0);
     cr.Color = ActiveColor;
     cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * 0.4 );
     Helpers.DrawText (cr, ToolbarTitleFontFamily, ToolbarTitleFontSize, SortLabel);
     cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * -0.4 );
     foreach (SortHandler sf in SortFields) {
       cr.Color = (SortField == sf) ? ActiveColor : InActiveColor;
       Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
       Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, " ");
     }
 }
开发者ID:kig,项目名称:filezoo,代码行数:15,代码来源:filezoo.cs


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