const int SW_SHOWNOACTIVATE = 4;
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hWnd, short cmdShow);
public void ScrollShow()
{
this.Width = widthMax;
this.Height = 0;
this.Show();
ShowWindow(this.Handle, SW_SHOWNOACTIVATE);
this.timer1.Enabled = true;
} 已有这 API可以在大多熟软件窗体不抢焦点,但在web下,焦点有被这窗体抢占 如MSN的新消息,QQ传文件提示。
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hWnd, short cmdShow);
public void ScrollShow()
{
this.Width = widthMax;
this.Height = 0;
this.Show();
ShowWindow(this.Handle, SW_SHOWNOACTIVATE);
this.timer1.Enabled = true;
} 已有这 API可以在大多熟软件窗体不抢焦点,但在web下,焦点有被这窗体抢占 如MSN的新消息,QQ传文件提示。
解决方案 »
- 两种引用方式有没有区别
- this.refresh() 和 Application.Doevents()区别
- 弹出新的窗体,在关闭旧窗体的时候,把新窗体也关闭掉了,请问是为什么?谢谢
- .NET有什么控件象DELPHI中的TActionList一样呢?
- 和讯博客上自带的无需安装的和讯通是如何实现的?
- 急啊,高分请教,如何用Sql语句修改Access文件中某个字段的名称?
- 如何用C#做计算器
- 如何将dataset内容放入到一个数组里
- 未将对象引用设置到对象的实例,高手请进啊 ,急 ,在线等待 !!!谢谢了
- 如何根据要求在DataGrid中显示数据?
- 子系统集成后文本框不能滑动选择了!!!!
- C#中非静态字段方法属性要求对象引用
using System.Runtime.InteropServices;
......
const int SW_SHOWNOACTIVATE = 4;
[DllImport("User32.dll", CharSet=CharSet.Auto)]
public static extern int ShowWindow(IntPtr hWnd, short cmdShow);
......
private void button4_Click(object sender, System.EventArgs e)
{
Form2 frm = new Form2();
ShowWindow(frm.Handle, SW_SHOWNOACTIVATE);
}
{
Form1 fm = new Form1();
fm.Show(this);//正常show
fm.Owner.Focus();//将焦点移到父窗口
}