Create a Modeless Messagebox

后端 未结 7 1475
难免孤独
难免孤独 2021-02-07 01:00

How might one go about creating a Modeless MessageBox? Do I have to just create my own Windows Form class and use that? If so, is there an easy way of adding a warning icon (rat

7条回答
  •  情话喂你
    2021-02-07 01:32

    Note: this will create a Modal dialog box, which is not what the question is asking

    here is a sample code

    if (MessageBox.Show("Description of the message", "Caption text", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
    {
        // Do some stuff if yes pressed
    }
    else
    {
        // no pressed
    }
    

提交回复
热议问题