| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1365 人关注过本帖
标题:[求助]为什么鼠标不响应事件?
只看楼主 加入收藏
c_sharp_man
Rank: 1
等 级:新手上路
帖 子:51
专家分:0
注 册:2005-9-28
收藏
 问题点数:0 回复次数:3 
[求助]为什么鼠标不响应事件?

源程序如下:
sing System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Painter
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Painter : System.Windows.Forms.Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
bool shouldPaint = false;

private System.ComponentModel.Container components = null;

public Painter()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
//
// Painter
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Painter";
this.Text = "Form1";

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Painter());
}
private void Painter_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
shouldPaint = true;
}

private void Painter_MouseUP(object sender, System.Windows.Forms.MouseEventArgs e)
{
shouldPaint = false;
}

private void Painter_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(shouldPaint)
{
Graphics graphics = CreateGraphics();
graphics.FillEllipse(new SolidBrush(Color.BlueViolet),e.X,e.Y,4,4);
}

}
}
}


以上程序的功能是用鼠标画图,程序编译通过了,也能运行但是鼠标不能响应画图的动作
哪位帮帮忙啊,谢了!

搜索更多相关主题的帖子: 鼠标 System using summary Painter 
2006-03-13 11:52
marer
Rank: 2
等 级:新手上路
威 望:3
帖 子:928
专家分:0
注 册:2005-7-18
收藏
得分:0 
第一句:using System

public class 人生历程 extends Thread{public void run(){while(true){努力,努力,再努力!!;Thread.sleep(0);}}}
2006-03-13 12:16
marer
Rank: 2
等 级:新手上路
威 望:3
帖 子:928
专家分:0
注 册:2005-7-18
收藏
得分:0 
修改如下:
private void InitializeComponent()
{
//
// Painter
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Painter";
this.Text = "Form1";

this.MouseDown+=new MouseEventHandler(Painter_MouseDown);
this.MouseUp+=new MouseEventHandler(Painter_MouseUP);
this.MouseMove+=new MouseEventHandler(Painter_MouseMove);
}


public class 人生历程 extends Thread{public void run(){while(true){努力,努力,再努力!!;Thread.sleep(0);}}}
2006-03-13 12:20
c_sharp_man
Rank: 1
等 级:新手上路
帖 子:51
专家分:0
注 册:2005-9-28
收藏
得分:0 
好了,谢谢各位的大力帮忙.我是越学越有信心了.

2006-03-13 13:07
快速回复:[求助]为什么鼠标不响应事件?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011613 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved