C# 用C在Win窗体中绘制图形线(由图形组成的线)#

C# 用C在Win窗体中绘制图形线(由图形组成的线)#,c#,winforms,gdi+,C#,Winforms,Gdi+,我希望使用GDI+和C#能够在WinForms中绘制由图像组成的线条。请注意,这不是在图像上绘制简单的线条,而是绘制由图像组成的线条,如******************************************(每个*都是特定的图像) 例如,我有一个imageA,该行类似于ImageAimageAimageAimageAimageAimageAimageAimageAimageAimageAimageAimageA 你有什么例子或建议吗?我想你想要的是以下几点 以星星的点为线。在绘制

我希望使用GDI+和C#能够在WinForms中绘制由图像组成的线条。请注意,这不是在图像上绘制简单的线条,而是绘制由图像组成的线条,如******************************************(每个*都是特定的图像)

例如,我有一个imageA,该行类似于ImageAimageAimageAimageAimageAimageAimageAimageAimageAimageAimageAimageA


你有什么例子或建议吗?

我想你想要的是以下几点

以星星的点为线。在绘制事件中使用以下函数

void Draw(Graphics g)
{
   g.DrawImage(ImageObject, ptOrgin);
   DrawLine(objPen, StartPoint, EndPoint);//draw all line of the star
}

每条线都有一个起点和终点。GDI+绘制线功能需要两点1。要绘制的线和笔的起点和终点。星星是线条的组合


ImageObject是位图。

您可以使用它在图像上绘制:

public void DrawLineOnImage(Image image, Color lineColor, float lineWeight,
                            System.Drawing.Point lineStart, System.Drawing.Point lineEnd)
{
   // This methods draws a line on the image given as parameter

   try
   {
      // Check the parameters
      if (image == null || lineColor == null || lineStart == null || lineWeight == null || lineWeight <= 0) { MessageBox.Show("Invalid parameters!"); return; }

      // Draw a line on the image
      using (Graphics g = Graphics.FromImage(image))
      using (Pen pen = new Pen(lineColor, lineWeight))
      {
         // Draw the line
         g.DrawLine(pen, lineStart, lineEnd);
      }
   }

   catch (Exception ex) { MessageBox.Show(ex.Message); }
}
public void DrawLineOnImage(图像图像、颜色线条颜色、浮动线宽、,
System.Drawing.Point线条起点、System.Drawing.Point线条终点)
{
//此方法在作为参数给定的图像上绘制一条线
尝试
{
//检查参数

如果(image==null | | | lineColor==null | | | lineStart==null | | lineWeight==null | | lineWeight这个问题可以在几分钟内通过谷歌的爱找到。尽量不要问那些几乎肯定已经被回答了一百遍的简单问题

我在谷歌上搜索了
c#draw line on image
,第一个链接是对你问题的清晰回答

甚至DrawLine的MSDN方法描述也有一个例子


请添加一个可用的代码示例,或解释如何使用
起点
终点
。每条线都有一个起点和终点。GDI+绘制线功能需要两个点1.线的起点和终点以及要绘制的笔。星形是线的组合…..谢谢。为了提高质量在你的回答中,你能提供这些信息吗?很抱歉,我没有正确解释这个问题。这不是在图像上画线,而是在图像上画线,比如************************************************,其中线由许多*组成。