现在从一个窗体SHOW另一个窗体,但只能SHOW一次出来,然后SHOW第二次的时候就不出来了,但是在ALT+TAL能调出来.好像排在了窗体的下面...
请问怎么将要SHOW出来的窗体设为总在最上.
请问怎么将要SHOW出来的窗体设为总在最上.
解决方案 »
- c# 枚举初始化赋值问题 求解!
- TABLE打印 在FIREFOX下面正常 为什么在IE下面就会有200多页呢
- 求一實例,WinForm,gridView中的DropDownList聯動,只要能觸發DropDownList事件就可以啦
- 关于spread 的一个简单问题
- VS2003装了后,再装上VS2005,然后VS2003就建立不了项目了!大家帮忙解决一下
- 如何在IE中通过点击链接文字获取其URL?
- 关于软件体系结构的问题
- vs2005做web为什么在页面的属性窗口中找不到事件
- 谁有DevExpress.XtraEditors(2.0.2.0)的注册码?
- 请大神们推荐一个数据库
- winform 上传图片预览的问题
- 还是string字符串的问题~!
class Win32
{
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern bool SetWindowPos(
int hWnd, // window handle
int hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
uint uFlags); // window positioning flags
public const int HWND_BOTTOM = 0x1;
public const uint SWP_NOSIZE = 0x1;
public const uint SWP_NOMOVE = 0x2;
public const uint SWP_SHOWWINDOW = 0x40;
} private void ShoveToBackground()
{
Win32.SetWindowPos((int)this.Handle, -1, this.Location.X, this.Location.Y, this.Size.Width, this.Size.Height, 1); //Win32.SetWindowPos(
// (int)this.Handle,
// (int),
// 0, 0, 0, 0,
// Win32.SWP_NOMOVE | Win32.SWP_NOSIZE | Win32.HWND_BOTTOM);
} private void Bar_Activated(object sender, EventArgs e)
{
//总在最上
ShoveToBackground();
}
private void Bar_Leave(object sender, EventArgs e)
{
//总在最上
ShoveToBackground();
}
然后在你新窗体里using它
using win32;
private void Main_Load(object sender, EventArgs e)
{
Win32.SetWindowPos((int)this.Handle, -1, this.Location.X, this.Location.Y, this.Size.Width, this.Size.Height, 1);
}
否则用 Activate() 激活。
1 用ShowDialog替换Show。
2 设置TopMost属性。