鼠标坐标在屏幕上画一点 参考:http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=8772 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我放点吧,只好看,不好用。using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;namespace WindowsApplication6{ /// <summary> /// Form1 的摘要说明。 /// </summary> public class Form1 : System.Windows.Forms.Form { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; Point p1; Point p2; public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(648, 341); this.Name = "Form1"; this.Text = "Form1"; this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SetP1); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SetP2); } #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void SetP1(object sender, System.Windows.Forms.MouseEventArgs e) { p1.X=e.X; p1.Y=e.Y; } private void SetP2(object sender, System.Windows.Forms.MouseEventArgs e) { p2.X=e.X; p2.Y=e.Y; ddl(); } private void ddl() { Random r=new Random(); Color asd=Color.FromArgb(r.Next (255),r.Next (255),r.Next (255),r.Next (255)); Pen p=new Pen (asd,r.Next (30)); p.SetLineCap(System.Drawing.Drawing2D.LineCap.RoundAnchor,System.Drawing.Drawing2D.LineCap.ArrowAnchor,System.Drawing.Drawing2D.DashCap.Flat); Graphics g=this.CreateGraphics(); g.SmoothingMode=System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.DrawLine (p,p1,p2); g.Dispose (); p.Dispose(); } private void S1(object sender, System.Windows.Forms.MouseEventArgs e) { p1.X=e.X; p1.Y=e.Y; } private void S2(object sender, System.Windows.Forms.MouseEventArgs e) { p2.X=e.X; p2.Y=e.Y; ddl(); } }} C# 获取DataRow[] 中某一列的所有数据 怎样做收件箱和发件箱程序? 【请教】C#写的C/S关于socket断开时的问题 可不可以给我以个c#的完整的例子 最好是一个有多个类的程序源码 问题: 谁做过OA,在框架中弹出仿MSN的信息窗口,怎么做的??? 加急!!!!!!!!!!! C#一个很重要的技术难题(DBF数据),请大虾们进来共同商讨解决 在线急等!!数组的问题,(我连题目都读得不是很懂)请指教!! 小问题:还是窗体之间的切换问题? 考完试了!!!散分!!(三) vb AND C# 托盘问题 为什么在别人的机器上程序出错???
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace WindowsApplication6
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; Point p1;
Point p2; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(648, 341);
this.Name = "Form1";
this.Text = "Form1";
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SetP1);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SetP2); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void SetP1(object sender, System.Windows.Forms.MouseEventArgs e)
{
p1.X=e.X;
p1.Y=e.Y;
} private void SetP2(object sender, System.Windows.Forms.MouseEventArgs e)
{
p2.X=e.X;
p2.Y=e.Y;
ddl();
}
private void ddl()
{
Random r=new Random();
Color asd=Color.FromArgb(r.Next (255),r.Next (255),r.Next (255),r.Next (255));
Pen p=new Pen (asd,r.Next (30));
p.SetLineCap(System.Drawing.Drawing2D.LineCap.RoundAnchor,System.Drawing.Drawing2D.LineCap.ArrowAnchor,System.Drawing.Drawing2D.DashCap.Flat);
Graphics g=this.CreateGraphics();
g.SmoothingMode=System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawLine (p,p1,p2);
g.Dispose ();
p.Dispose();
} private void S1(object sender, System.Windows.Forms.MouseEventArgs e)
{
p1.X=e.X;
p1.Y=e.Y;
} private void S2(object sender, System.Windows.Forms.MouseEventArgs e)
{
p2.X=e.X;
p2.Y=e.Y;
ddl();
}
}
}