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


C# IGraphicsContext.PushGraphicsState方法代码示例

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


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

示例1: 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

示例2: 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

示例3: Draw

        public override void Draw(IGraphicsContext gc)
        {
            using (gc.PushGraphicsState ())
            {
                int depth = CountParentDepth ();
                Color color = _Colors [depth]; // CountParentDepth is expensive - so don't call StateColor here...
                Color contactColor = color;
                if (Name == null || Name.Trim () == "")
                {
                    color = Color.Red;
                }

                gc.Color = color;
                DrawState (gc, _Bounds.Left, _Bounds.Top, _Bounds.Width, _Bounds.Height, 20, 2+depth, color, false);
                gc.Color = contactColor;
                gc.Thickness = 2 + depth;
                if (Selected)
                {
                    foreach (IGlyph contact in ContactPoints)
                    {
                        contact.Draw (gc);
                    }
                }
            }
        }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:25,代码来源:StateGlyph.cs


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