本文簡單講述了MFC設置對話框焦點的方法,分享給大家供大家參考。具體實現方法如下:
具體的方法有兩種:
1. 設置對話框控件的tab order。 按Ctrl+D即可看見。將需要被設置到焦點的空間的tab order設為1.
2. 對話框的OnInitDialog返回FALSE。解釋如下:(摘抄至msdn)
If OnInitDialog returns nonzero, Windows sets the input focus to the first control in the dialog box.
The application can return 0 only if it has explicitly set the input focus to one of the controls in the dialog box.
希望本文所述對大家的MFC程序設計有所幫助。
新聞熱點
疑難解答
圖片精選