P
P
phpshka2019-03-04 18:59:28
C++ / C#
phpshka, 2019-03-04 18:59:28

How to make a shape from an image?

Good afternoon!
Can you please tell me how to make the outline of the application form based on the image?
That is, so that the shape is not rectangular or round, but would look like in the image?
For example, to draw a shape as an ellipse, the following code is used:

GraphicsPath path = new GraphicsPath();
path.AddEllipse(0, 0, this.Width, this.Height);
Region region = new Region(path);
this.Region = region;

But this is primitive i.e. in the form of an ellipse or a circle, or it will turn out to round the shape, but how to make a completely non-standard shape?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mshak, 2019-03-14
@mshak

Two eternal questions: how to put an icon in the tray and how to make a non-rectangular shape :)
About the shape... we did this:
* load the image into a Bitmap
* run through all the pixels, form an array of lines (more precisely, the coordinates of points)
* further GraphicsPath.AddLines (Point[])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question