解决方案 »
- 缺return,却不报错误,如何设置使它报错“并非所有的代码路径都返回值”?
- .net如何抓取源文件中的信息
- showModalDialog弹窗页面里的Uploadify插件在IE中报IO Error,求解!
- C#中图书管理系统都是实现什么功能啊?具体点,谢谢!!
- 怎样将sqlreader的一行数据转换成string格式
- System.Data.SqlClient.SqlException: 用户 'XIELIN\ASPNET' 登录失败。
- 一个问题
- 水晶报表刷新的问题
- 请问这个例子怎么运行不了?
- 怎样用C#在设备管理器中禁用某设备
- 请教达人:C#抓包模拟网站登录问题
- 未将对象引用设置到对象的实例。
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace wangshang
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int a = 0;
private void button1_Click(object sender, EventArgs e)
{
a = 1;
//Invalidate();
} private void button2_Click(object sender, EventArgs e)
{
a = 0;
Invalidate();
} private void Form1_Paint_1(object sender, PaintEventArgs e)
{
if (a == 1)
{
Graphics g = this.CreateGraphics();
Pen pen1 = new Pen(Color.Blue, 2);
float y = 150, y1, x1, x2;
for (int x = 10; x < 1100; x++)
{
x1 = (float)x;
x2 = (float)(x + 1);
y1 = (float)(150 - 50 * Math.Sin((3.14159 / 180.0) * (x - 9)));
g.DrawLine(pen1, x1, y, x2, y1);
y = y1;
}
System.Drawing.Drawing2D.AdjustableArrowCap linecap = new System.Drawing.Drawing2D.AdjustableArrowCap(6, 6, false);
Pen pen2 = new Pen(Color.Blue, 3); pen2.CustomEndCap = linecap;
g.DrawLine(pen2, 10, 300, 10, 0);
g.DrawLine(pen2, 10, 150, 1120, 150);
}
}
}
}