C 自動關閉彈出提示框

2022-06-27 16:06:11 字數 1078 閱讀 8693

自動關閉彈出提示框(用乙個小窗體顯示提示資訊):

例如在乙個form窗體中彈出自動關閉的提示框

1、首先建立乙個彈出提示資訊的窗體 autoclosemassagebox,在裡面拖乙個lable控制項,去掉預設文字,設定為透明,專門用來顯示提示資訊

在這個窗體中加入外部傳入需要提示的資訊和文字標題獲取函式

public void getmassage(string text)//顯示的提示資訊

public void gettext(string caption)//顯示的文字標題(左上角的窗體標題提示)

2、然後在form窗體中宣告和加入這個彈出提示框函式

public autoclosemassagebox m_massagebox;

//自動關閉彈出提示框

public class autoclosingmessagebox

public static void show(string text, string caption, int timeout)

void ontimerelapsed(object state)

const int wm_close = 0x0010;

[system.runtime.interopservices.dllimport("user32.dll", setlasterror = true)]

static extern intptr findwindow(string lpclassname, string lpwindowname);

[system.runtime.interopservices.dllimport("user32.dll", charset = system.runtime.interopservices.charset.auto)]

static extern intptr sendmessage(intptr hwnd, uint32 msg, intptr wparam, intptr lparam);

}3、最後在想要顯示自動關閉彈出提示框的地方呼叫該函式即可

autoclosingmessagebox.show("系統初始化中,請稍後 ... ", "自動關閉提示框", 1500);

自動關閉MessageBox提示框

dllimport user32.dll public static extern int messageboxtimeouta intptr hwnd,string txt,string caption,int wtype,int wlange,int dwtimeout 記得前面引用命名空間 u...

JQuery定時自動消失提示框 彈出框

在表單提交中,不論成功與否,好的體驗都應該有彈出提示,效果 在頁面 顯示提示,1.5秒後消失,不影響頁面的正常布局。html 顯示提示內容,放在頁面中任何位置。alert alert success alert info alert warning alert danger 首先,載入jquery,...

彈出提示框,對話方塊

還在繼續jeecg 所以彈出的對話方塊是lhgdialog 在對話方塊1中有乙個按鈕,點選它希望能再跳出乙個dialog對話方塊 在點選的方法裡寫到 zindex控制在幾層 意思就是 如果不寫,在lhgdialog中,新彈出的對話方塊2就不能出現在對話方塊1的前面,只有對話方塊1關閉或移走才能發現對...