急急!!!!!!!!!!!!! 我建了个 MainForm , 在 MainForm 中放了个ListView 控件, 我希望在 ListView 的工作区点击鼠标的右键,能够弹出一个子窗口;目前这个已经实现,但是子窗口总是在 ListView 的背后,请高手指点, 谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的MainForm的属性TOPMOST是否为TRUE呀?把它改为FALSE private void menuItemDirAdd_Clicked(object sender, System.EventArgs e) { DirAdd childForm; childForm = GetChildForm(); this.ActivateMdiChild ( childForm ); childForm.Show(); childForm.Activate(); childForm.BringToFront (); // CreateMyForm(); } using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;namespace Ch18Ex02{ /// <summary> /// DirAdd 的摘要说明。 /// </summary> public class DirAdd : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; public DirAdd() { // // 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() { this.label1 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.Location = new System.Drawing.Point(32, 72); this.label1.Name = "label1"; this.label1.TabIndex = 0; this.label1.Text = "label1"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(160, 72); this.textBox1.Name = "textBox1"; this.textBox1.TabIndex = 1; this.textBox1.Text = "textBox1"; // // button1 // this.button1.Location = new System.Drawing.Point(32, 176); this.button1.Name = "button1"; this.button1.TabIndex = 2; this.button1.Text = "button1"; // // button2 // this.button2.Location = new System.Drawing.Point(184, 184); this.button2.Name = "button2"; this.button2.TabIndex = 3; this.button2.Text = "button2"; // // DirAdd // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(292, 273); this.ControlBox = false; this.Controls.AddRange(new System.Windows.Forms.Control[] { this.button2, this.button1, this.textBox1, this.label1}); this.ForeColor = System.Drawing.Color.Cornsilk; this.Location = new System.Drawing.Point(120, 120); this.Name = "DirAdd"; this.Text = "DirAdd"; this.Load += new System.EventHandler(this.DirAdd_Load); this.ResumeLayout(false); } #endregion private void DirAdd_Load(object sender, System.EventArgs e) { } }} 生成新FORM的時候固定新FORM的位置啊 childForm.Show();这一句改成childForm.ShowDialog(); 你是mdi,在主窗体客户区的控件是覆盖在子窗体上面的,你的弹出窗体不要设mdi子窗体,用Showdialog方式打开就可以了 ChildForm.ShowDialog();ChildForm.MdiParent=this; //使用模式方式打开ChildForm.ShowDialog(this); childForm.Show();改成childForm.ShowDialog();就可以了 private void menuItemDirAdd_Clicked(object sender, System.EventArgs e) { DirAdd childForm=new DirAdd(); childForm.Show(); } DataGridView问题请教高手 求一正则表达式 100分求星期一是几号 在vs.2005中打包时怎样写注册表,让程序下次开机时自动运行,还有安装完成后自动启动?--------很急--在线等.............. 利用.net的安装部署如何实现卸载结束后提示用户卸载完毕?谢谢大牛了 vsto中treeview不能显示图标 如何使连接到数据库的客户端软件自动刷新DataSet。 求助 C# 方法的封装 怎样使用用户自定义控件(急!!!) DataGrid高手請進,,在线等!急! 请问我这个程序里ListBox的值怎么取出来? 加密SQL连接语句后,再解密后为什么不能用?
{
DirAdd childForm;
childForm = GetChildForm();
this.ActivateMdiChild ( childForm );
childForm.Show();
childForm.Activate();
childForm.BringToFront ();
// CreateMyForm();
}
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace Ch18Ex02
{
/// <summary>
/// DirAdd 的摘要说明。
/// </summary>
public class DirAdd : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public DirAdd()
{
//
// 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()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(32, 72);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(160, 72);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(32, 176);
this.button1.Name = "button1";
this.button1.TabIndex = 2;
this.button1.Text = "button1";
//
// button2
//
this.button2.Location = new System.Drawing.Point(184, 184);
this.button2.Name = "button2";
this.button2.TabIndex = 3;
this.button2.Text = "button2";
//
// DirAdd
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.ControlBox = false;
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button2,
this.button1,
this.textBox1,
this.label1});
this.ForeColor = System.Drawing.Color.Cornsilk;
this.Location = new System.Drawing.Point(120, 120);
this.Name = "DirAdd";
this.Text = "DirAdd";
this.Load += new System.EventHandler(this.DirAdd_Load);
this.ResumeLayout(false); }
#endregion private void DirAdd_Load(object sender, System.EventArgs e)
{
}
}
}
这一句改成childForm.ShowDialog();
Showdialog方式打开就可以了
ChildForm.MdiParent=this;
ChildForm.ShowDialog(this);
改成
childForm.ShowDialog();
就可以了
{
DirAdd childForm=new DirAdd();
childForm.Show();
}