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


C# DashStyle.ToString方法代码示例

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


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

示例1: GetDashStyleImage

        private Image GetDashStyleImage(DashStyle dashStyle)
        {
            string nameFormat = "Images.DashStyleButton.{0}.png";
            string name = string.Format(nameFormat, dashStyle.ToString());
            ImageResource imageResource = PdnResources.GetImageResource(name);

            Image returnImage;

            if (UI.GetXScaleFactor() == 1.0f && UI.GetYScaleFactor() == 1.0f)
            {
                returnImage = imageResource.Reference;
            }
            else
            {
                returnImage = new Bitmap(imageResource.Reference, UI.ScaleSize(imageResource.Reference.Size));
            }

            return returnImage;
        }
开发者ID:Yaro77,项目名称:paint.net,代码行数:19,代码来源:ToolConfigStrip.cs

示例2: PaintLine

 /// <summary>
 /// Paints one color button
 /// </summary>
 /// <param name="graphics"></param>
 /// <param name="color"></param>
 /// <param name="hotTrack"></param>
 /// <param name="selected"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 private Rectangle PaintLine(Graphics graphics, DashStyle style, bool hotTrack, bool selected, int x, int y)
 {            
     // Button inside rectangle
     RectangleF mainRec = new RectangleF(x + 3, y + 3, 100, 1.5F);
     // Button border rectangle 
     Rectangle borderRec = new Rectangle(x, y, 102, 10);
     // Check if the button is selected and HotTrack ( no the same color)
     bool selectedAndHotTrack = selected && hotTrack;
     // Paints the button using the brushes needed
     
     using (Brush hotTrackBrush = new SolidBrush(ArtPalette.ButtonHoverLight))
     using (Brush selectedBrush = new SolidBrush(ArtPalette.ButtonHoverDark))
     using (Brush selectedHotTrackBrush = new SolidBrush(ArtPalette.SelectedAndHover))
     using (Pen selectedPen = new Pen(ArtPalette.SelectedBorder))
     using (Pen linePen = new Pen(Color.DimGray, 2F))
     using (Pen borderPen = new Pen(ArtPalette.ButtonBorder))
     {
         linePen.DashStyle = style;
         // Paints the rectangle with the Track/Selected color
         // if this color is selected/hottrack
         if (selectedAndHotTrack)
         {
             graphics.FillRectangle(selectedHotTrackBrush, borderRec);
             graphics.DrawRectangle(selectedPen, borderRec);
         }
         else if (hotTrack)
         {
             graphics.FillRectangle(hotTrackBrush, borderRec);
             graphics.DrawRectangle(selectedPen, borderRec);
         }
         else if (selected)
         {
             graphics.FillRectangle(selectedBrush, borderRec);
             graphics.DrawRectangle(selectedPen, borderRec);
         }
         // Fills the rectangle with the current color, paints
         // the background.    
         graphics.DrawLine(linePen, x+2, y+4, x+100, y+4);
         graphics.DrawString(style.ToString(), this.Font, Brushes.DimGray, x + 104, y - 1);
         //graphics.FillRectangle(Brushes.DimGray, mainRec);
         //graphics.DrawRectangle(borderPen, Rectangle.Round( mainRec));
     }
     return borderRec;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:54,代码来源:OfficeLineStylePicker.cs


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