Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use printDocument and pageSetupDialog. How do I change the paper size when I select size from pageSetupDialog?

What I have tried:

C++
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
if(pageSetupDialog1>ShowDialog()==System::Windows::Forms::DialogResult::OK)
{

	}
}
Posted
Updated 27-Oct-23 7:16am
v3

 
Share this answer
 
Where am i wrong? When i select the paper size it doesn't change the size in the document

C++
pageSetupDialog1->PageSettings = gcnew System::Drawing::Printing::PageSettings;
	pageSetupDialog1->PrinterSettings = gcnew System::Drawing::Printing::PrinterSettings;
	pageSetupDialog1->ShowNetwork = false;
	System::Windows::Forms::DialogResult result = pageSetupDialog1->ShowDialog();
	if (result == System::Windows::Forms::DialogResult::OK)
	{
		printDocument1->DefaultPageSettings->PaperSize = pageSetupDialog1->PageSettings->PaperSize;
 
Share this answer
 
Comments
Richard MacCutchan 28-Oct-23 7:18am    
Sorry, I have no idea what the problem may be; my tests change the paper size correctly in the printer dialog. You need to use the debugger to find out exactly what is going wrong.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900