简体   繁体   English

可以将消息框按钮设置为没有默认按钮焦点吗?

[英]Possible to set message box buttons to not have a default button focus?

Is it possible to set it so there is no default button focus when a messagebox appears?是否可以设置它以便在出现消息框时没有默认按钮焦点? This way, the message box will force the user to select Yes or No with a mouse.这样,消息框将强制用户用鼠标选择是或否。 The MessageBoxDefaultButton (as seen below) only allows for the changing of the default button and does not give the option to select none. MessageBoxDefaultButton(如下所示)仅允许更改默认按钮,并且不提供选择无的选项。

MsgBox("continue?", vbYesNo + vbQuestion, "Do you want to continue?", MessageBoxDefaultButton.Button1)

Thanks!谢谢!

Its quiet easy to set default button on Vb.net Msgbox by combining MsgBoxStyle (MsgBoxStyle.YesNoCancel + MsgBoxStyle.DefaultButton2) :通过结合 MsgBoxStyle (MsgBoxStyle.YesNoCancel + MsgBoxStyle.DefaultButton2) 在 Vb.net Msgbox 上设置默认按钮非常容易:

MsgBox("Er. Mayank Nainwal", MsgBoxStyle.YesNoCancel + MsgBoxStyle.DefaultButton2, "Default Button is NO ?")

    If MsgBox("Er. Mayank Nainwal", MsgBoxStyle.YesNoCancel + MsgBoxStyle.DefaultButton2, "Default Button is NO ?") = MsgBoxResult.Yes Then
        '' Your Code 
    End If

Visual Studio (VB, 16.8.4) - 如果你需要信息符号和焦点在 Yes 按钮上,试试这个:-

MsgBox("Your message", vbQuestion + vbYesNo + MsgBoxStyle.DefaultButton1, "The MsgBox title")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM