如题...3Q~~~
解决方案 »
- C# winform panel中的子窗体切换时,子窗体的背景图片闪烁
- C# winform 如何得到某电脑硬件的唯一序列号.
- 服务程序不能开机启动的错误,很奇怪手动却可以
- 如何把HTML代码在textbox中解析成网页上显示的格式,就象在线编辑器一样
- 关于windows service 的一个很久都没解决的问题,高手帮忙啊!!!
- 实现复制对象操作的方案
- 求助:.net4.0中如何将部分菜单MenuItem隐藏.
- 后台增加一个图片上传功能,带报酬!
- C#编的软件没有.NET环境会出错误怎么办
- 100分求帮助,快快啊,在线等等等等等!!1
- 一个脚本操作TreeView的问题,大家帮帮忙啊,弄了一天没搞定,这是aspx文件的内容
- C#调用C写的dll,出现"尝试读取或写入受保护的内存。这通常指示其他内存已损坏。",高手帮忙看看
想做多大都行。
在www.codeproject.com上有很多人都自己写了这个form。你上去找找。
把人家的form拉大一点就成了,功能更不必说。
不过这样做还不如用 DoModal 来显示一个新的对话框
INT CBTMessageBox(HWND hwnd, LPSTR lpText, LPSTR lpCaption,
UINT uType)
{
hhk = SetWindowsHookEx(WH_CBT, &CBTProc, 0,
GetCurrentThreadId());
return MessageBox(hwnd, lpText, lpCaption, uType);
} LRESULT CALLBACK CBTProc(INT nCode, WPARAM wParam, LPARAM lParam)
{
HWND hParentWnd, hChildWnd; // msgbox is "child"
RECT rParent, rChild, rDesktop;
POINT pCenter, pStart;
INT nWidth, nHeight; // notification that a window is about to be activated
// window handle is wParam
if (nCode == HCBT_ACTIVATE)
{
// set window handles
hParentWnd = GetForegroundWindow();
hChildWnd = (HWND)wParam; if((hParentWnd != 0) &&
(hChildWnd != 0) &&
(GetWindowRect(GetDesktopWindow(), &rDesktop) != 0) &&
(GetWindowRect(hParentWnd, &rParent) != 0) &&
(GetWindowRect(hChildWnd, &rChild) != 0))
{
// calculate message box dimensions
nWidth = (rChild.right - rChild.left);
nHeight = (rChild.bottom - rChild.top); // calculate parent window center point
pCenter.x = rParent.left+((rParent.right
- rParent.left)/2);
pCenter.y = rParent.top+((rParent.bottom
- rParent.top)/2); // calculate message box starting point
pStart.x = (pCenter.x - (nWidth/2));
pStart.y = (pCenter.y - (nHeight/2)); // adjust if message box is off desktop
if(pStart.x < 0) pStart.x = 0;
if(pStart.y < 0) pStart.y = 0;
if(pStart.x + nWidth > rDesktop.right)
pStart.x = rDesktop.right - nWidth;
if(pStart.y + nHeight > rDesktop.bottom)
pStart.y = rDesktop.bottom - nHeight; // move message box
MoveWindow(hChildWnd,
pStart.x, pStart.y,
nWidth, nHeight,
FALSE);
}
// exit CBT hook
UnhookWindowsHookEx(hhk);
}
// otherwise, continue with any possible chained hooks
else CallNextHookEx(hhk, nCode, wParam, lParam);
return 0;
} 哈哈,那你自己form多容易呀
MessageBox.Show(" 输入你要弹出的内容 ");看看!
弹出的窗口是不是很大呀!!