我如何在画框中绘制在边上标记的多边形 [英] How can i draw in picturebox a polygon which is marked on the edges

查看:90
本文介绍了我如何在画框中绘制在边上标记的多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以这种方式尝试过,但没有得到所需的结果:

i tried in that way but i didnt get the needed results:

System.Drawing.Point[] p = new System.Drawing.Point[6];
p[0].X = 0;
p[0].Y = 0;
p[1].X = 53;
p[1].Y = 111;
p[2].X = 114;
p[2].Y = 86;
p[3].X = 34;
p[3].Y = 34;
p[4].X = 165;
p[4].Y = 7;
g = PictureBox1.CreateGraphics();
g.DrawPolygon(pen1, p);

我想做的是在图片框中绘制一个多边形,该多边形用不同的颜色并根据比率(角的数量和边缘的坐标)来定义

what i want to do is to draw a polygon in picturebox which is defined with diffrent colors and according to the rates (the number of corner and coordinates of the edges )

推荐答案

创建一个xOffset变量,将其设置为30,然后将其添加到每个X值中. 让yOffset等于50并将其添加到所有Y中.

Create an xOffset variable, set it to be 30, and add that to every X value. Let yOffset equal 50 and add it to all your Ys.

这篇关于我如何在画框中绘制在边上标记的多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆