如何用控件透明盖住一个窗体的控件,而我响应上面控件的事件!急!! 控件的透明部分是不能接收输入的,你的要求恐怕不容易达到,除非使用透明控件下面的控件来触发透明控件的事件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackColor = System.Drawing.Color.White; this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage"))); this.ClientSize = new System.Drawing.Size(192, 96); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "Form1"; this.Text = "Form1"; this.TransparencyKey = System.Drawing.Color.White; this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown); this.DoubleClick += new System.EventHandler(this.Form1_DoubleClick); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove); },,,,,,,,,,,,private int beginX; private int beginY; private bool mousedown; [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { this.mousedown=true; this.beginX=e.X; this.beginY=e.Y; } private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (this.mousedown) { this.Left+=e.X-this.beginX; this.Top+=e.Y-this.beginY; } } private void Form1_DoubleClick(object sender, System.EventArgs e) { Application.Exit(); } private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { this.mousedown=false; } }}这是是不规则窗体的代码。和你要求的有点像!它可以用FORM的事件!希望对你有帮助!透明控件?你可以把你的控件的高,宽设为0就见不到了呀!:) close无法关闭窗体,什么情况 谁遇到过“silverlight调用存储过程输出为游标”问题 datagridview按数字排序 一个解决方案中的多个项目如何共享配置文件 程序已关闭但是进程没有关闭? 读取excel,提示拒绝访问 关于datagrid里面绑定dropdownlist。。急 DataGridView绑定Ilist 100分求资源文件的操作问题! framework下的问题 TabControl的tabPage顺序问题 有谁对事件的使用方法比较了解
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.White;
this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(192, 96);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form1";
this.Text = "Form1";
this.TransparencyKey = System.Drawing.Color.White;
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.DoubleClick += new System.EventHandler(this.Form1_DoubleClick);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove); }
,,,,,,,,,,,,
private int beginX;
private int beginY;
private bool mousedown;
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.mousedown=true;
this.beginX=e.X;
this.beginY=e.Y;
} private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (this.mousedown)
{
this.Left+=e.X-this.beginX;
this.Top+=e.Y-this.beginY;
}
} private void Form1_DoubleClick(object sender, System.EventArgs e)
{
Application.Exit();
} private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.mousedown=false;
}
}
}
这是是不规则窗体的代码。和你要求的有点像!它可以用FORM的事件!希望对你有帮助!
透明控件?你可以把你的控件的高,宽设为0就见不到了呀!:)