曲线绘制不正确C# [英] Curve is not drawing properly c#

查看:106
本文介绍了曲线绘制不正确C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我正在尝试制作一个涉及向目标射击箭头的小型游戏,并且我正在尝试实现第一部分(射击箭头),我已经编写了一些相对简单的代码

well, i''m trying to make a small game involving shooting arrows at targets, and i''m trying to implement the first part (shooting the arrow) I''ve made some relatively simple code

Bitmap bit = new Bitmap(this.Width, this.Height);
                Graphics g = Graphics.FromImage(bit);
                Graphics form = this.CreateGraphics();
                pntPoints[0] = this.pictureBox1.Location;
             
                pntPoints[1] = new Point(100,300);
                pntPoints[2] = new Point(200, 150);
                g.DrawCurve(p, pntPoints);
          
            form.DrawImage(bit, 0, 0);
                bit.Dispose();
                g.Dispose();



使用位图并将其绘制为表单(以便以后可以删除),并使用随机数演示曲线,从我可以收集的数据来看,第一个点应该是我的图片框所在的位置,第二个点应位于(100,300 )和第三个点(200,150),这意味着我应该先向上然后向下弯曲一条曲线,但是我要得到一条仅向上弯曲的曲线.谁能解释为什么?谢谢:)



using a bitmap and drawing it to the form (so it can be erased later) and using the random numbers to demonstrate a curve, and from what i can gather, the first point should be where my picturebox is, the second point at (100,300) and the third point at (200,150), meaning I should get a curve going up and then down, however i''m getting a curve that only goes up. Can anyone explain why? thanks :)

推荐答案

我相信这是因为垂直尺寸在向下方向上增加.这意味着pntPoints [1](垂直300)的垂直位置比pntPoints [2](垂直150)低.这会导致曲线向上弯曲.
I believe it is because vertical measure increases in a downward direction. This means that pntPoints[1](vertical 300) has a lower vertical position than pntPoints[2](vertical 150). This would cause your curve to swoop upwards.


这篇关于曲线绘制不正确C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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