创建行并在C#中对它们进行排序 [英] create lines and sort them in C#

查看:81
本文介绍了创建行并在C#中对它们进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我想在C#中创建一些行并比较它们的高度,然后根据它们的高度对其进行排序?
有可能吗?
请帮助我

OP的解决方案移至他的问题

我想以图形方式分析4种排序算法,我的意思是我有几行,这4种排序算法以多线程模式对它们进行排序,并显示哪一种更快 [/编辑]

从OP更新:
我需要这样的东西:
http://www.4shared.com/file/23XuRzWr/2011-05- 25_6-04-38_PM.html [ ^ ]
这是一部有关我需要的电影

Hi I want create some lines in C# and compare their heights, then sort them according to their heights?
Is it possible?
please help me

OP''s solution moved to his question

I want to analyze 4 sorting algorithms in graphic mode, I mean I have some lines, and these 4 sorting algorithms sort them in multithread mode and show which one is faster
[/Edit]

UPDATE from OP:
I need something like this:
http://www.4shared.com/file/23XuRzWr/2011-05-25_6-04-38_PM.html[^]
this is a film about what I need

推荐答案

是的.

(我添加此内容是因为内容太短,但我不想在答案中添加任何内容;请参阅我对问题的评论.)

—SA
Yes.

(I''m adding this because the content is too short, but I don''t want to add anything to the answer; see my comments to the question.)

—SA


最简单的方法是仅绘制垂直线.可以使用窗体的Paint事件中的Graphics.DrawLine方法来完成此操作.不要创建Graphics对象.请改用e.Graphics.

然后,您需要跟踪CollectionDictionary中线段的端点和长度.
在长度上使用排序算法,然后重绘所有升序或降序的行.

注意:我没有看到视频.您文件名的扩展名为exe,对于视频来说似乎很奇怪.
Simplest way would be to draw vertical lines only. This can be done using Graphics.DrawLine method in the Paint event of the form. Do not create Graphics object. Use e.Graphics instead.

Then, you need to track the endpoints and length of the line segments in a Collection or a Dictionary.

Use your sorting algorithms on the lengths and then redraw all the lines sorted ascending or descending.

Note: I did not saw the video. Your filename has extension exe which seems weird for a video.


这篇关于创建行并在C#中对它们进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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