什么是迫使表格带来前沿的强大方式?

Anu*_*uya 3 c# windows

什么是强制表单使用Windows c#应用程序带来所有其他应用程序的前端的强大方法?

180*_*ION 15

强制用户单击任务栏中的应用程序窗口图标.


RRU*_*RUZ 7

将Form.TopMost设置为true


小智 6

这是适合我的代码:

using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace LicenseManager {

  public static class WinApi {

    [DllImport( "user32.dll" )]
    static extern bool SetWindowPos( IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags );

    static private IntPtr HWND_TOPMOST = new IntPtr( -1 );

    private const uint SWP_NOSIZE = 0x0001;
    private const uint SWP_NOMOVE = 0x0002;

    static public void MakeTopMost( Form f ) {
      SetWindowPos( f.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
    }

  }
}
Run Code Online (Sandbox Code Playgroud)


jay*_*t55 5

this.BringToFront();

它对我有用.