我需要在vc ++ 2010中打印我的表单内容。 有没有办法这样做?
答案 0 :(得分:0)
终于做到了
public: Bitmap^ memoryImage;
private: System::Void CaptureScreen()
{
Graphics^ myGraphics = this->CreateGraphics();
memoryImage = gcnew Bitmap(Size.Width, Size.Height, myGraphics);
Graphics^ memoryGraphics = Graphics::FromImage(memoryImage);
memoryGraphics->CopyFromScreen(this->Location.X, this->Location.Y, 0, 0, this->Size);
}
private: System::Void printDocument1_PrintPage(System::Object^ sender, System::Drawing::Printing::PrintPageEventArgs^ e) {
e->Graphics->DrawImage(memoryImage, 0, 0);
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
CaptureScreen();
printDocument1->Print();
}