C# - 坐标系,绘图 [英] C#- coordinate system, drawing

查看:110
本文介绍了C# - 坐标系,绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我想关注

0,0(900毫米,900毫米)

---- ----------------------------------

| ....... ............................. |

| ........... ......................... |

| ............... .......................

| ................... ................. |

| ....................... ............. |

| ........................... ......... |

| ............................... .......

| ................................... 。|

-------------------------------------- 0, 0(900毫米,900毫米)


Zeropoint应该是definwe

legt,右(顶部或底部)


我需要的点作为十字架,如文字P1


列表

点X,Y,


1, 10,10

2,20,20

3,30,40

4,70,42

.......

.......

a)我该怎么做?

b)我怎么画小组与p提示和文字?


有一个例子吗?


祝你好运,佩特拉

Hello,

I want to ake following
0,0 (900mm,900mm)
--------------------------------------
|....................................|
|....................................|
|....................................|
|....................................|
|....................................|
|....................................|
|....................................|
|....................................|
--------------------------------------0,0(900mm,900mm)

Zeropoint should be definwe
legt,right (top or bottom)

The points I needed as crosses, as text P1

List
Point X,Y,

1, 10,10
2, 20,20
3, 30,40
4, 70,42
.......
.......
a) how can I make that?
b) how can I draw the panel with points and text?

Have you a example?

Best regards, Petra

推荐答案

Petra Rohmer写道:
Petra Rohmer wrote:

[...]

我需要的点作为十字架,作为文本P1


清单

X点,Y,

1,10,10

2,20,20

3,30,40

4,70,42

.......

.......


a)我怎么能做到这一点?

b)我怎样才能用点和文本?
[...]
The points I needed as crosses, as text P1

List
Point X,Y,

1, 10,10
2, 20,20
3, 30,40
4, 70,42
.......
.......
a) how can I make that?
b) how can I draw the panel with points and text?



你想在什么情况下画这个?它应该是一个新的Control

级吗?你只是想绘制一个表格吗?


一般来说,你绘制一个处理Paint方法的

控件实例(可以是一个控件)由表单或表单包含

本身),或者你实现一个继承Control的类,并且你在其中使用
覆盖OnPaint方法(这对于绘制<特别方便表格中有
,因为你通常会创建一个新的派生类。


在Paint方法中,你可以从

PaintEventArgs参数并使用该实例进行绘制。图形

类有多种方法可用于绘图,包括

DrawLine,DrawLines,FillRectangle,FillEllipse和DrawString(名称
$ b) $ ba对你所描述的内容很有帮助。


就坐标系而言,默认情况下坐标系

有Control的客户区左上角的原点。但是,

您可以通过创建转换矩阵并在绘制之前将其应用到Graphics实例来更改此值(请参阅Matrix类和

Graphics.Transform属性)。使用它,你可以做各种各样的事情,包括将原点移动到任何其他位置并改变轴的方向。

当然,在很多情况下,只需要考虑

默认坐标系统并应用你可能需要的任何转换




您应该查看上面的MSDN文档,并尝试实现您需要的
。一旦你这样做了,如果你有更具体的

问题,请随时问这些。


Pete

In what context do you want to draw this? Should it be a new Control
class? Do you just want to draw into a Form?

Generally speaking, you draw either handling the Paint method for a
Control instance (which can be a control contained by a form or a form
itself), or you implement a class that inherits Control and in which you
override the OnPaint method (this is particularly convenient for drawing
into forms, since you''re usually creating a new derived class anyway).

In the Paint method, you can get a Graphics instance from the
PaintEventArgs parameter and use that instance to draw. The Graphics
class has a variety of methods on it useful for drawing, including
DrawLine, DrawLines, FillRectangle, FillEllipse, and DrawString (to name
a few that could be useful for what you''re describing).

As far as the coordinate system goes, by default the coordinate system
has the origin at the top-left of the Control''s client area. However,
you can change this by creating a transformation matrix and applying it
to the Graphics instance before drawing (see the Matrix class and the
Graphics.Transform property). Using this, you can do a variety of
things, including moving the origin to any other position and changing
the direction of the axes.

Of course, in many cases it suffices to simply take into account the
default coordinate system and apply whatever conversion you might need
explicitly.

You should take a look at the MSDN docs for the above and try to
implement what you need. Once you''ve done so, if you have more specific
questions, please feel free to ask those as well.

Pete


你好,

> [...]
分数我需要作为十字架,如文字P1

列点X,Y,
1 / 10,10
2,20,20 3,30,40
4,70,42
.......
.......

a)我该如何制作那个?
b)我怎样才能用点和文字绘制面板?
>[...]
The points I needed as crosses, as text P1

List
Point X,Y,

1, 10,10
2, 20,20
3, 30,40
4, 70,42
.......
.......
a) how can I make that?
b) how can I draw the panel with points and text?



你想在什么情况下画这个?它应该是一个新的Control

级吗?你只想画一张表格吗?


In what context do you want to draw this? Should it be a new Control
class? Do you just want to draw into a Form?



表格中的是。

yes into a form.


>
>



如果工作,下一步是我想实现最短路。

我可以到达每一点。

示例1到4是可能的

2到4是可能的。


你有一个例子吗?

问候Petra

if working, the next step is I want to implement the shortest way.
I can arrive every point.
Example 1 to 4 is possible
2 to 4 is alo possible.

Do you have a example?
Regards Petra


Petra Rohmer写道:
Petra Rohmer wrote:

[...]

如果工作,下一步是我想实现最短路。

我可以到达每一点。

示例1到4是可能的

2至4也是可能的。
[...]
if working, the next step is I want to implement the shortest way.
I can arrive every point.
Example 1 to 4 is possible
2 to 4 is alo possible.



我不明白你的意思。什么到达每一点是什么意思?

按最短的方式,你的意思是代码最少吗?最快的

代码?自己做最少量的实际编程?某种与你的数据相关的
计算?


你为我写的内容有太多可能的解释

能够搞清楚。请更具体(如果可能的话,

或许可以让某人帮你翻译...我尽量不要给b $ b麻烦人们他们的英语技能,但是这种情况似乎可以创造一个真正的沟通障碍。


Pete

I don''t understand what you mean. What does "arrive every point" mean?
By "shortest way", do you mean the least amount of code? The fastest
code? Doing the least amount of actual programming yourself? Some sort
of calculation related to your data?

There are too many possible interpretations of what you wrote for me to
be able to figure it out. Please be more specific (and if possible,
perhaps get someone to help you with the translation...I try not to
hassle people about their English skills, but in this case it seems to
be creating a genuine communication barrier).

Pete


这篇关于C# - 坐标系,绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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