双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

Graphics DrawLine

ouyang4683 ouyang4683 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Pen p = new Pen(Color.Red, 1);
Point p1=...;
Point p2=...;
Graphics gr;
gr.DrawLine(p,p1,p2);

为什么总提示:使用了未赋值的局部变量“gr”


我用了gr=this.CreateGraphics();

但会要求创建:

private Graphics CreateGraphics()
{
throw new Exception("The method or operation is not implemented.");
}


难道因为我重写了redraw?

我现在就想画这个线,怎么画?
...全文
评论 26
收藏 已收藏
分享
返回顶部
ouyang4683
C# 111,129 成员 642,540 内容