首页新闻找找看学习计划

c# 画图 链表

0
悬赏园豆:20 [待解决问题]

我想在c#中画图,程序如下

for (int i = 110; i <= 170; i += 20)
            {
                Graphics g = e.Graphics;
                Pen pen = new Pen(Color.Black, 5);
                g.DrawRectangle(pen, 55, i, 220, 20);
                g.DrawRectangle(pen, 385, i, 220, 20);
                g.DrawRectangle(pen, 715, i, 220, 20);
                SolidBrush brush = new SolidBrush(Color.Red);
                g.FillRectangle(brush, 55, i, 220, 20);
                g.FillRectangle(brush, 385, i, 220, 20);
                g.FillRectangle(brush, 715, i, 220, 20);
            }
            for (int i = 190; i <= 250; i += 20)
            {
                Graphics g = e.Graphics;
                Pen pen = new Pen(Color.Black, 5);
                g.DrawRectangle(pen, 55, i, 220, 20);
                g.DrawRectangle(pen, 385, i, 220, 20);
                g.DrawRectangle(pen, 715, i, 220, 20);
                SolidBrush brush = new SolidBrush(Color.Orange);
                g.FillRectangle(brush, 55, i, 220, 20);
                g.FillRectangle(brush, 385, i, 220, 20);
                g.FillRectangle(brush, 715, i, 220, 20);
            }
            for (int i = 270; i <= 330; i += 20)
            {
                Graphics g = e.Graphics;
                Pen pen = new Pen(Color.Black, 5);
                g.DrawRectangle(pen, 55, i, 220, 20);
                g.DrawRectangle(pen, 385, i, 220, 20);
                g.DrawRectangle(pen, 715, i, 220, 20);
                SolidBrush brush = new SolidBrush(Color.Yellow);
                g.FillRectangle(brush, 55, i, 220, 20);
                g.FillRectangle(brush, 385, i, 220, 20);
                g.FillRectangle(brush, 715, i, 220, 20);
            }

画完是3列矩形,想通过链表实现如下功能:能够自由拖拽各个小矩形,实现每列前后可以自由插入比如将第一列5号插入到2号前,列之间可以自由插入,比如将第一列的2号插入到第二列的2号前,怎么编程呀~~~小弟刚学c#不久,对链表不太明白,最好有注释,代码发到邮箱windyk508@163.com,谢谢啦~~

问题补充:

是在panel控件中画的~~~

巴索罗缪库玛的主页 巴索罗缪库玛 | 初学一级 | 园豆:48
提问于:2012-04-20 08:59
< >
分享
所有回答(1)
0
1.方形。
private void Form1_Paint(object sender, PaintEventArgs e) { System.Drawing.Graphics graphicsObj; graphicsObj = this.CreateGraphics(); Pen myPen = new Pen(System.Drawing.Color.Red, 5); Rectangle myRectangle = new Rectangle(20, 20, 250, 200); graphicsObj.DrawRectangle(myPen, myRectangle); }
2.圆形。   
private void Form1_Paint(object sender, PaintEventArgs e) { System.Drawing.Graphics graphicsObj; graphicsObj = this.CreateGraphics(); Pen myPen = new Pen(System.Drawing.Color.Green, 5); Rectangle myRectangle = new Rectangle(20, 20, 250, 200); graphicsObj.DrawEllipse(myPen, myRectangle); }

这个地方有更复杂的功能

再见2019 | 园豆:11616 (专家六级) | 2012-04-20 09:15

panel控件也好使吗?

支持(0) 反对(0) 巴索罗缪库玛 | 园豆:48 (初学一级) | 2012-04-20 09:45

@巴索罗缪库玛: 可以啊。

支持(0) 反对(0) 再见2019 | 园豆:11616 (专家六级) | 2012-04-20 09:46

@荒野的呼唤: 就把form_paint换成panel_paint就可以了吧

支持(0) 反对(0) 巴索罗缪库玛 | 园豆:48 (初学一级) | 2012-04-20 09:49

@荒野的呼唤: 不好使呀~~能把完整的程序发到我邮箱吗?谢谢啊~~

支持(0) 反对(0) 巴索罗缪库玛 | 园豆:48 (初学一级) | 2012-04-20 09:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册