Вопрос

Okay, in my program I am showing a printDialog and I want to be able to know if the user clicks the print button, or the cancel button. In all the examples online that I've seen, the printDialogs have OK buttons, instead of Print buttons.

For Example (code from msdn) :

System::Windows::Forms::DialogResult result = printDialog1->ShowDialog();
if ( result == ::DialogResult::OK )
{
   //printing code here
}

So without an OK button obviously this code is not going to work.

Anybody know how to tell if print button is clicked?

Это было полезно?

Решение

The "Print" button returns DialogResult::OK so it is safe to check against that value.

In fact any of the dialogs that inherit from CommonDialog will return OK for success.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top