如何在C#中绘制三角形 [英] How to draw a triangle in C#

查看:253
本文介绍了如何在C#中绘制三角形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i需要能够为用户提供通过鼠标移动绘制三角形的选项

(鼠标向上,鼠标按下和鼠标移动)


i使用位图而非图像创建了一个绘图项目。



感谢您的帮助...

Hey
i need to be able to give to the user the option to draw a triangle by movement of the mouse
(mouse up, mouse down, and mouse move)

i created a paint project using a bitmap not image.

Thank's for the help...

推荐答案

这是什么 Google 返回给我。



前两个与你的问题密切相关。

如何划线?

如何绘制多边形?



这里的人不喜欢被视为理所当然。做你的家庭作业/研究,你会在这个过程中学到一些东西。你会惊讶地发现自己可以做多少事情,只需要知识就可以了。

如果你遇到困难请求帮助。



PS

我发现这个代码项目。
This is what Google has returned to me.

First two are closely related to your problem.
How draw a line?
How to draw a polygon?

People here don't like to be treated for granted. Do your homework/research first, you'll learn something in the process. You'll be surprised how much you can do on your own, you just have to reach for knowledge.
If you get stuck ask for help.

P.S.
I've found this here at code project.


这取决于你希望用户如何能够做到这一点:问题是三角形需要三个点,除非你修复两个边和一个角,所以做鼠标向下...拖动...鼠标向上方法适用于矩形并不真正适用于三角形。由于矩形可以通过两个对角相对的点完全描述,因此非常简单,但对于三角形,您需要三个,除非它总是一个直角三角形,这是非常有限的。



关于我现在可以建议的最好的方法是你做一个三次点击方法,而不是看一下拖动 - 忽略你的两个事件!
It depends on exactly how you want the user to be able to do it: the problem is that a Triangle needs three points, unless you fix two of the sides and one of the angles, so doing the "mouse down...drag...mouse up" method that works with rectangles doesn't really work with triangles. Since rectangles can be completely described by two diagonally opposite points it is pretty simple, but for a triangle you do need three unless it is always an right-angle triangle, which is very limiting.

About the best I can suggest at this point is that you do a three click method rather than looking at a drag at all - ignoring two of your events!


首先关闭如果它的WinForms或WPF,你不要告诉我们,并且它不是一个真正的问题,更多的是请求,所以请在发布问题之前阅读指南。



其次网络上有noumeros来源描述了你可以做什么,这里有一个情侣 [ ^ ]我确定你也会找到其他人。 :-)



祝你好运; - )
First off you don ttell us if its WinForms or WPF, and secoundly it isnt really a question, more of a request, so please read the guidelines before posting the question.

Secondly there are noumeros sources on the web that describe what you could do, here is a couple[^] for WinForm and Im sure you'd find others too. :-)

Good luck to you ;-)


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

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