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


C# IGraphicsContext.DrawString方法代码示例

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


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

示例1: Draw

 public override void Draw(IGraphicsContext GC)
 {
     base.Draw (GC);
     string s = _PortName;
     using (Brush brush = new System.Drawing.SolidBrush (Color.Black))
     {
         GC.DrawString (s, brush, 10, new Point (Bounds.Right + 10, Bounds.Top), false);
     }
 }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:9,代码来源:OperationPortGlyph.cs

示例2: Draw

 public override void Draw(IGraphicsContext GC)
 {
     using (GC.PushGraphicsState ())
     {
         string name = Name;
         if (IsNotEmptyString (name))
         {
             GC.Color = Color.Orange;
         }
         else
         {
             name = "NoName";
             GC.Color = Color.Red;
         }
         base.Draw (GC);
         using (Brush brush = new SolidBrush (GC.Color))
         {
             Rectangle bounds = Bounds;
             Point centre = new Point (bounds.X + bounds.Width / 2, bounds.Y + bounds.Height / 2);
             GC.DrawString (name, brush, 10, centre, true);
         }
     }
 }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:23,代码来源:StateTransitionPortGlyph.cs

示例3: Draw

        public override void Draw(IGraphicsContext GC)
        {
            Color oldColor = GC.Color;
            Color primary = Color.Orchid;
            if (!IsNotEmptyString (FromPortName) || !IsNotEmptyString (ToPortName) /* || !IsNotEmptyString (Interface) */)
            {
                primary = Color.Red;
            }

            GC.Color = primary;
            if (Selected)
            {
                GC.Thickness = 5;
            }
            else
            {
                GC.Thickness = 2;
            }
            GC.DrawLine (_From, _To);
            foreach (IPortLinkContactPointGlyph contact in ContactPoints)
            {
                switch (contact.WhichEnd)
                {
                    case TransitionContactEnd.From: GC.Thickness = 3; break;
                    case TransitionContactEnd.To: GC.Thickness = 5; break;
                    default: throw new NotSupportedException ("Unknown TransitionContactEnd: " + contact.WhichEnd.ToString ());
                }
                IComponentGlyph component = contact.Parent as IComponentGlyph;
                if (component != null)
                {
                    GC.Color = component.ComponentColor;
                    contact.Draw (GC);
                }
                else
                {
                    GC.Color = primary;
                    contact.Draw (GC);
                }
            }
            string s = DisplayText ();
            using (Brush brush = new System.Drawing.SolidBrush (Color.Black))
            {
                GC.DrawString (s, brush, 10, new Point ((_To.X + _From.X) / 2, (_To.Y + _From.Y) / 2), true);
            }
            GC.Color = oldColor;
        }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:46,代码来源:PortLinkGlyph.cs

示例4: DrawComponent

		protected void DrawComponent (IGraphicsContext g, int x_left, int y_top, int width, int height, int radius, int thickness, Color color)
		{
			GraphicsPath path = new GraphicsPath ();
			path.StartFigure ();
			path.AddRectangle (Bounds);
			if (Selected)
			{
				path.AddLine (x_left + 5 + thickness, y_top + height / 2, x_left + 5 + thickness, y_top + radius);
				path.AddLine (x_left + 5 + thickness, y_top + 5 + thickness, x_left + 5 + thickness + width / 2, y_top + 5 + thickness);
				path.AddLine (x_left + 5 + thickness + width / 2, y_top + 5 + thickness, x_left + 5 + thickness, y_top + 5 + thickness);
			}
			path.CloseFigure ();

			using (Brush brush = new System.Drawing.SolidBrush (color))
			{
				using (Pen pen = new Pen (brush, thickness))
				{
					g.DrawPath (pen, path);
					if (Name != null && Name.Trim () != "")
					{
						g.DrawString (Name, brush, radius, new Point (x_left + radius, y_top + 1), false);
					}
				}
			}
		}
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:25,代码来源:OperationGlyph.cs

示例5: DrawHeading

 protected void DrawHeading(IGraphicsContext gc)
 {
     string s = string.Format ("{0}.{1} ver. {2} @ {3}", this.Model.Header.NameSpace, this.Model.Header.Name, this.Model.Header.StateMachineVersion, DateTime.Now.ToString ("s"));
     using (Brush brush = new SolidBrush (Color.Black))
     {
         gc.DrawString (s, brush, 10, new Point (5, 5), false);
     }
 }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:8,代码来源:TestStateGlyphControl.cs

示例6: Draw

        public override void Draw(IGraphicsContext GC)
        {
            using (GC.PushGraphicsState ())
            {
                bool isOk;
                bool usePrimary;
                Color primary;
                DashStyle dashStyle;
                usePrimary = PrimaryInformation (out isOk, out primary, out dashStyle);
                GC.Color = primary;
                int thickness = 2;
                if (Selected)
                {
                    thickness = 5;
                }

                Color fromColor;
                Color toColor;
                DrawContactPoints (GC, isOk, usePrimary, primary, out fromColor, out toColor);

                GC.Thickness = thickness;
                GC.DrawLine (_From, _To, fromColor, toColor, dashStyle);

                ArrayList contextList = GetDisplayTextAsContextList (GC);
                int startX = (_To.X + _From.X) / 2;
                int startY = (_To.Y + _From.Y) / 2;
                bool isMoreHorizontal = Math.Abs (_To.X - _From.X) > Math.Abs (_To.Y - _From.Y);
                bool positiveWidthAdjust;
                bool positiveHeightAdjust;
                if (isMoreHorizontal)
                {
                    positiveWidthAdjust = false;
                    positiveHeightAdjust = true;
                }
                else
                {
                    positiveWidthAdjust = false;
                    positiveHeightAdjust = false;
                }
                GC.DrawString (contextList, new Point (startX, startY), positiveWidthAdjust, positiveHeightAdjust, true);

            }
        }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:43,代码来源:TransitionGlyph.cs

示例7: Draw

        public override void Draw(IGraphicsContext GC)
        {
            Color oldColor = GC.Color;
            Color primary = Color.Orchid;
            if (Interface == null || Interface.Trim () == "")
            {
                primary = Color.Red;
            }

            GC.Color = primary;
            if (Selected)
            {
                GC.Thickness = 5;
            }
            else
            {
                GC.Thickness = 2;
            }
            GC.DrawLine (_From, _To);
            foreach (OperationPortLinkContactPointGlyph contact in ContactPoints)
            {
                switch (contact.WhichEnd)
                {
                    case TransitionContactEnd.From: GC.Thickness = 3; break;
                    case TransitionContactEnd.To: GC.Thickness = 5; break;
                    default: throw new NotSupportedException ("Unknown TransitionContactEnd: " + contact.WhichEnd.ToString ());
                }
                IOperationGlyph operation = contact.Parent as IOperationGlyph;
                if (operation != null)
                {
                    GC.Color = primary; // FIXUP: operation.OperationColor;
                    contact.Draw (GC);
                }
                else
                {
                    GC.Color = primary;
                    contact.Draw (GC);
                }
            }
            string s = DisplayText ();
            using (Brush brush = new System.Drawing.SolidBrush (Color.Black))
            {
                GC.DrawString (s, brush, 10, new Point ((_To.X + _From.X) / 2, (_To.Y + _From.Y) / 2), true);
            }
            GC.Color = oldColor;
        }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:46,代码来源:OperationPortLinkGlyph.cs

示例8: DrawString

 protected void DrawString(IGraphicsContext g, string s, Brush brush, int thickness, Point point, FontStyle fontStyle)
 {
     IDrawStringContext context = new DrawStringContext (s, thickness, StateColor, fontStyle);
     g.DrawString (context, brush, point, false);
 }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:5,代码来源:StateGlyph.cs


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