怎么调用带PaintEventArgs e的方法 10
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Da...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//怎么在form1的panel1上显示我要画的线 大哥大姐教下我 谢谢啦
}
private void DrawLineFloat(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 100);
// Create coordinates of points that define line.
float x1 = 100.0F;
float y1 = 100.0F;
float x2 = 500.0F;
float y2 = 100.0F;
// Draw line to screen.
e.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
}
}
} 展开
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//怎么在form1的panel1上显示我要画的线 大哥大姐教下我 谢谢啦
}
private void DrawLineFloat(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 100);
// Create coordinates of points that define line.
float x1 = 100.0F;
float y1 = 100.0F;
float x2 = 500.0F;
float y2 = 100.0F;
// Draw line to screen.
e.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
}
}
} 展开
展开全部
先把private void DrawLineFloat(PaintEventArgs e)改成公共访问类型private void DrawLineFloat(PaintEventArgs e) 然后在 Paint事件里面写个DrawLineFloat(null)就行了。很奇怪,你那个方法怎么少一个object sender参数的...如果加上去的话,对应的调用方法应该是DrawLineFloat(this,null)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询