MessageBox.Show("前端显示", "TopMostMessageBox", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);

解决方案 »

  1.   

    MessageBox.Show("", "", MessageBoxButtons.OK, null, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
      

  2.   

    有API嘛,消息框是另外一个c++程序写的,我想用.net程序用API设置那个messagebox的TopMost
      

  3.   

    如果没错的话,记得一个叫 setwindowPos 的API你查查看,有一个参数是设置顶层窗体的
      

  4.   

    镇难伺候[DllImport("user32.dll")]
    public static extern bool SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, int flags);HWND_TOPMOST = new HandleRef(null, new IntPtr(-1));
    HWND_NOTOPMOST = new HandleRef(null, new IntPtr(-2));public void SetTopMost(bool topMost){    HandleRef hWndInsertAfter = topMost ? HWND_TOPMOST : HWND_NOTOPMOST;    SafeNativeMethods.SetWindowPos(new HandleRef(this, Handle), hWndInsertAfter, 0, 0, 0, 0, 3);}
      

  5.   

    SetWindowPos我试过不过不行,不知道跟messagebox是不是有关系,它不是一个窗体
      

  6.   

    我想,是windows画出来的东西总是可以找到他的 handle 的吧?那就通过messagebox的标题用FindWindows找到他的handle,
    然后就可以通过setwindowsPos 设置了吧~