Hello I use the FillClosedCurve method to draw shapes by points.

Dim BM As New Bitmap(1000, 1000) Dim G As Graphics = Graphics.FromImage(BM) G.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias G.FillClosedCurve(Brushes.Black, points_array) PictureBox1.BackgroundImage = BM 

To get points I use the following principle: I put a picture on the background of the form and when I click on the form X and Y, the cursor is added to the list of points. I need to draw a treble clef, please tell me how it is more convenient to get a list of points to build, how can I get them from a png file?

    1 answer 1

    Found a solution. In the cycle I checked all the pixels of the png file, on alpha! = 0 (I have an image with no background), got a list of opaque pixels (750 x, y), and filled them in black with a cycle

      Dim gr As Graphics = PictureBox2.CreateGraphics Dim bmp As Bitmap = PictureBox1.Image Dim spoints as as string /* получаем точки изображения из PictureBox1 */ For i = 0 To bmp.Size.Height - 1 For j = 0 To bmp.Size.Width - 1 If bmp.GetPixel(j, i).A <> 0 Then gr.FillRectangle(Brushes.Black, j, i, 1, 1) spoints &= j & " " & i & " " End If Next Next /* рисуем по точкам */ spoints = spoints.trim() Dim gr As Graphics = PictureBox3.CreateGraphics Dim points_array() As String = spoints.Text.Split For i = 0 To points_array.Count - 2 Step 2 gr.FillRectangle(Brushes.Black, CSng(points_array(i)), CSng(points_array(i + 1)), 1, 1) Next