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


C# RenderTarget.DrawLine方法代码示例

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


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

示例1: Draw

 protected internal override void Draw(RenderTarget renderTarget)
 {
     if (StrokeStyle != null)
         renderTarget.DrawLine(point0, point1, PenBrush, StrokeWidth, StrokeStyle);
     else
         renderTarget.DrawLine(point0, point1, PenBrush, StrokeWidth);
 }
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:7,代码来源:LineShape.cs

示例2: Render

 public void Render(RenderTarget target)
 {
     target.FillRectangle(KeyboardGradient, new RectangleF(0, KeyboardY, target.Size.Width, KEY_HEIGHT));
     target.DrawLine(DefaultBrushes[1], 0, KeyboardY, target.Size.Width, KeyboardY, 1f);
     for (int i = 0; i < 128; i++)
     {
         float keyX = i * KeyWidth;
         if (IsBlack[i % 12])
         {
             if (KeyPressed[i] > 0)
             {
                 target.FillRectangle(DefaultBrushes[4], new RectangleF(keyX, KeyboardY, KeyWidth, BLACK_KEY_HEIGHT));
             }
             else
             {
                 target.FillRectangle(DefaultBrushes[2], new RectangleF(keyX, KeyboardY, KeyWidth, BLACK_KEY_HEIGHT));
                 target.FillRectangle(DefaultBrushes[1], new RectangleF(keyX, KeyboardY + BLACK_KEY_HEIGHT * 4f / 5, KeyWidth, BLACK_KEY_HEIGHT / 5f));
             }
         }
         else
         {
             if (KeyPressed[i] > 0)
             {
                 target.FillRectangle(DefaultBrushes[3], new RectangleF(keyX, KeyboardY, KeyWidth, KEY_HEIGHT));
                 if (IsBlack[(i + 1) % 12])
                     target.FillRectangle(DefaultBrushes[3], new RectangleF(keyX + KeyWidth, KeyboardY + BLACK_KEY_HEIGHT, KeyWidth / 2, KEY_HEIGHT - BLACK_KEY_HEIGHT));
                 if (IsBlack[(i + 11) % 12])
                     target.FillRectangle(DefaultBrushes[3], new RectangleF(keyX - KeyWidth / 2, KeyboardY + BLACK_KEY_HEIGHT, KeyWidth / 2, KEY_HEIGHT - BLACK_KEY_HEIGHT));
             }
             else
             {
                 target.FillRectangle(DefaultBrushes[2], new RectangleF(keyX, KeyboardY + KEY_HEIGHT * 7f / 8, KeyWidth, KEY_HEIGHT / 8f));
                 if (IsBlack[(i + 1) % 12])
                     target.FillRectangle(DefaultBrushes[2], new RectangleF(keyX + KeyWidth, KeyboardY + KEY_HEIGHT * 7f / 8, KeyWidth, KEY_HEIGHT / 8f));
                 if (IsBlack[(i + 11) % 12])
                     target.FillRectangle(DefaultBrushes[2], new RectangleF(keyX - KeyWidth / 2, KeyboardY + KEY_HEIGHT * 7f / 8, KeyWidth, KEY_HEIGHT / 8f));
             }
         }
         if (IsBlack[i % 12])
             target.DrawLine(DefaultBrushes[1], keyX + KeyWidth / 2, KeyboardY + BLACK_KEY_HEIGHT, i * KeyWidth + KeyWidth / 2, target.Size.Height, 1f);
         else if (!IsBlack[(i + 11) % 12])
             target.DrawLine(DefaultBrushes[1], keyX, KeyboardY, keyX, target.Size.Height, 1f);
     }
 }
开发者ID:HuYang719,项目名称:MIDITrailer,代码行数:44,代码来源:MIDIKeyboard.cs

示例3: Render

 public override void Render(RenderTarget target, int[] KeyPressed)
 {
     target.FillRectangle(GFXResources.DefaultBrushes[0],
         new RectangleF
         (
             0,
             GFXResources.KeyboardY,
             target.Size.Width,
             GFXResources.KeyHeight
         )
     );
     target.DrawLine(GFXResources.DefaultBrushes[1], 0, GFXResources.KeyboardY, target.Size.Width, GFXResources.KeyboardY, 1f);
     for (int i = GFXResources.NoteOffset; i < GFXResources.NoteOffset + GFXResources.NoteCount; i++)
     {
         float keyX = i * GFXResources.KeyWidth - GFXResources.NoteOffset * GFXResources.KeyWidth;
         if (GFXResources.IsBlack[i % 12])
         {
             if (KeyPressed[i] > 0)                      /* Black key which is pressed */
             {
                 target.FillRectangle
                 (
                     // Fill the inside red
                     GFXResources.DefaultBrushes[4],
                     new RectangleF
                     (
                         keyX,
                         GFXResources.KeyboardY,
                         GFXResources.KeyWidth,
                         GFXResources.BlackKeyHeight
                     )
                 );
             }
             else                                        /* Black key which is not pressed */
             {
                 // Fill the top gray
                 target.FillRectangle
                 (
                     GFXResources.DefaultBrushes[2],
                     new RectangleF
                     (
                         keyX,
                         GFXResources.KeyboardY,
                         GFXResources.KeyWidth,
                         GFXResources.BlackKeyHeight
                     )
                 );
             }
         }
         else
         {
             if (KeyPressed[i] > 0)                      /* White key which is pressed */
             {
                 // Fill the middle white part red
                 target.FillRectangle
                 (
                     GFXResources.DefaultBrushes[3],
                     new RectangleF
                     (
                         keyX,
                         GFXResources.KeyboardY,
                         GFXResources.KeyWidth,
                         GFXResources.KeyHeight
                     )
                 );
                 if (GFXResources.IsBlack[(i + 1) % 12])
                 {
                     // Fill the next half section red if the next note is black
                     target.FillRectangle
                     (
                         GFXResources.DefaultBrushes[3],
                         new RectangleF
                         (
                             keyX + GFXResources.KeyWidth,
                             GFXResources.KeyboardY + GFXResources.BlackKeyHeight,
                             GFXResources.KeyWidth / 2,
                             GFXResources.KeyHeight - GFXResources.BlackKeyHeight
                         )
                     );
                 }
                 if (GFXResources.IsBlack[(i + 11) % 12])
                 {
                     // Fill the previous half section red if the previous note is black 
                     target.FillRectangle
                     (
                         GFXResources.DefaultBrushes[3],
                         new RectangleF
                         (
                             keyX - GFXResources.KeyWidth / 2,
                             GFXResources.KeyboardY + GFXResources.BlackKeyHeight,
                             GFXResources.KeyWidth / 2,
                             GFXResources.KeyHeight - GFXResources.BlackKeyHeight
                         )
                     );
                 }
             }
         }
         // Draw note separator lines
         if (GFXResources.IsBlack[i % 12])
         {
             target.DrawLine
//.........这里部分代码省略.........
开发者ID:Netdex,项目名称:Kazedan,代码行数:101,代码来源:FastKeyRenderer.cs

示例4: UserDrawingDelegate

        private void UserDrawingDelegate(RenderTarget target)
        {
            if (showLiveRectangleFlag)
            {

                target.DrawRectangle(new RectF(liveRectangleOrigin.X, liveRectangleOrigin.Y, liveRectangleOrigin.X + liveRectangleSize.Width, liveRectangleOrigin.Y + liveRectangleSize.Height), target.CreateSolidColorBrush(new ColorF(Color.Red.ToArgb())), 1);
            }
            if (sampleColor)
            {
                int dif = 5;
                Microsoft.WindowsAPICodePack.DirectX.Direct2D1.Brush brush = target.CreateSolidColorBrush(new ColorF(Color.Red.ToArgb()));
                Microsoft.WindowsAPICodePack.DirectX.Direct2D1.Point2F p1 = new Microsoft.WindowsAPICodePack.DirectX.Direct2D1.Point2F(sampleLocation.X - dif, sampleLocation.Y);
                Microsoft.WindowsAPICodePack.DirectX.Direct2D1.Point2F p2 = new Microsoft.WindowsAPICodePack.DirectX.Direct2D1.Point2F(sampleLocation.X + dif, sampleLocation.Y);
                target.DrawLine(p1, p2, brush, 1);
                p1 = new Microsoft.WindowsAPICodePack.DirectX.Direct2D1.Point2F(sampleLocation.X, sampleLocation.Y - dif);
                p2 = new Microsoft.WindowsAPICodePack.DirectX.Direct2D1.Point2F(sampleLocation.X, sampleLocation.Y + dif);
                target.DrawLine(p1, p2, brush, 1);
            }
        }
开发者ID:xmuhcd,项目名称:Image-Cropper-For-Computer-Vision,代码行数:19,代码来源:ImageCropper.cs


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