Okay, ich habe es geloest. Fuer Leute die das selbe Problem eventuell haben, hier ist meine Loesung:
Code:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
panel1->AutoScroll = false;
panel1->AutoSize = true;
Bitmap^ myBitmap = gcnew Bitmap(panel1->Width, panel1->Height);
Rectangle myRectangle = Rectangle(0, 0, panel1->Size.Width, panel1->Size.Height);
panel1->DrawToBitmap(myBitmap, myRectangle);
myBitmap->Save("C:\\test.bmp", System::Drawing::Imaging::ImageFormat::Bmp);
panel1->AutoSize = false;
panel1->AutoScroll = true;
//printDocument1
if (printDialog1->ShowDialog() == Windows::Forms::DialogResult::OK)
{
printDocument1->Print();
}
}
private: System::Void printDocument1_PrintPage(System::Object^ sender, System::Drawing::Printing::PrintPageEventArgs^ e)
{
e->Graphics->DrawImage(Image::FromFile("c:\\test.bmp"), 0, 0);
}
Beschreibung:
Speichert alles aus dem Panel in ein Bitmap (test.bmp) und druckt dieses aus. Der Code hat keine Kommentierung, also falls Fragen bestehen, einfach hier antworten im Thema.
MfG