C#题目编程,急急急!!!

来源:百度知道 编辑:UC知道 时间:2024/07/07 21:37:12
1, 使用SqlConnection,SqlCommand,SqlDataReader和SqlParameter,写一个方法从数据库中读数据。
2, 定义一个泛型集合类。要求:实现Ienumerable<T>接口,T是值类型,并T取2个类型分别测试。
3,在Graphics绘图面中心绘制一个1/4大小的红色矩形,在矩形内中心位置填充一个适当大小的蓝色椭圆,在椭圆内中心位置写上红色文字“我的绘图画”,并在矩形的4个角各绘制一个蓝色小圆。

3
Graphics g = e.Graphics;
Rectangle rect = e.ClipRectangle;
int wd = rect.Width / 2;
int x = wd / 2;
int ht = rect.Height / 2;
int y = ht / 2;
rect = new Rectangle(x, y, wd, ht);
Rectangle innerRect;
int wd2 = rect.Width *3/ 4;
int ht2 = rect.Height *3/ 4;
int y2 = (rect.Top + rect.Bottom) / 2 - ht2 / 2;
int x2 = (rect.Left + rect.Right) / 2 - wd2 / 2;
innerRect = new Rectangle(x2, y2, wd2, ht2);

Pen myPen = new Pen(Color.Red, 1);
g.DrawRectangle(myPen, rect);
Brush myBrush = new SolidBrush(Color.Blue);
g.FillEllipse(myBrush, innerRect);

int radius = (rect.Width < rect.Height ? rect.Width : rect.Height) / 8;
Pen bluePen = new Pen(Color.Blue, 1);