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