{"id":739,"date":"2011-12-15T14:10:01","date_gmt":"2011-12-15T14:10:01","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=739"},"modified":"2022-02-17T06:24:03","modified_gmt":"2022-02-17T06:24:03","slug":"printing-general","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/printing\/printing-general","title":{"rendered":"Printing General"},"content":{"rendered":"<h4>Create Your Print Document<\/h4>\n<pre><code>\r\n\tSystem::Drawing::Printing::PrintDocument ^printDoc;\r\n<\/code><\/pre>\n<h4>Start Printing<\/h4>\n<pre><code>\r\n\t\/\/Setup the print dialog\r\n\tPrintDialog ^dlgPrint = gcnew PrintDialog();\r\n\tdlgPrint-&gt;AllowSelection = true;\r\n\tdlgPrint-&gt;ShowNetwork = true;\r\n\tdlgPrint-&gt;Document = printDoc;\r\n\tdlgPrint-&gt;PrinterSettings-&gt;DefaultPageSettings-&gt;Landscape = true;\t\t\/\/(This doesn't necessarily work)\r\n\tdlgPrint-&gt;UseEXDialog = true;\r\n\r\n\tprintDoc-&gt;BeginPrint += gcnew System::Drawing::Printing::PrintEventHandler(this, &amp;DataGridViewPrint::PrintDoc_BeginPrint);\r\n\tprintDoc-&gt;PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler(this, &amp;DataGridViewPrint::PrintDoc_PrintPage);\r\n\tif (dlgPrint-&gt;ShowDialog() != DialogResult::OK)\r\n\t{\r\n\t\tprintDoc-&gt;BeginPrint -= gcnew System::Drawing::Printing::PrintEventHandler(this, &amp;DataGridViewPrint::PrintDoc_BeginPrint);\r\n\t\tprintDoc-&gt;PrintPage -= gcnew System::Drawing::Printing::PrintPageEventHandler(this, &amp;DataGridViewPrint::PrintDoc_PrintPage);\r\n\t\treturn;\r\n\t}\r\n\r\n\t\/\/Print the Documnet\r\n\tprintDoc-&gt;Print();\r\n\tprintDoc-&gt;BeginPrint -= gcnew System::Drawing::Printing::PrintEventHandler(this, &amp;DataGridViewPrint::PrintDoc_BeginPrint);\r\n\tprintDoc-&gt;PrintPage -= gcnew System::Drawing::Printing::PrintPageEventHandler(this, &amp;DataGridViewPrint::PrintDoc_PrintPage);\r\n<\/code><\/pre>\n<h4>The Callbacks To Provide<\/h4>\n<pre><code>\r\nvoid DataGridViewPrint::PrintDoc_BeginPrint(System::Object^  sender, System::Drawing::Printing::PrintEventArgs ^e) \r\n{\r\n}\r\nvoid DataGridViewPrint::PrintDoc_PrintPage(System::Object ^sender, System::Drawing::Printing::PrintPageEventArgs ^e)\r\n{\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Create Your Print Document System::Drawing::Printing::PrintDocument ^printDoc; Start Printing \/\/Setup the print dialog PrintDialog ^dlgPrint = gcnew PrintDialog(); dlgPrint-&gt;AllowSelection = true; dlgPrint-&gt;ShowNetwork = true; dlgPrint-&gt;Document = printDoc; dlgPrint-&gt;PrinterSettings-&gt;DefaultPageSettings-&gt;Landscape = true; \/\/(This doesn&#8217;t necessarily work) dlgPrint-&gt;UseEXDialog = true; printDoc-&gt;BeginPrint += gcnew System::Drawing::Printing::PrintEventHandler(this, &amp;DataGridViewPrint::PrintDoc_BeginPrint); printDoc-&gt;PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler(this, &amp;DataGridViewPrint::PrintDoc_PrintPage); if (dlgPrint-&gt;ShowDialog() != DialogResult::OK) { printDoc-&gt;BeginPrint -= gcnew System::Drawing::Printing::PrintEventHandler(this, [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80],"tags":[],"class_list":["post-739","post","type-post","status-publish","format-standard","hentry","category-printing"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/739","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=739"}],"version-history":[{"count":4,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/739\/revisions"}],"predecessor-version":[{"id":1031,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/739\/revisions\/1031"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}