質問

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