Мне удалось напечатать dataGridView, используя этот метод:
private:
void printDocument1_PrintPage(System::Object ^ sender,
System::Drawing::Printing::PrintPageEventArgs ^ e)
{
Bitmap^ bm = gcnew Bitmap(this->dataGridView1->Width, this->dataGridView1->Height);
this->dataGridView1->DrawToBitmap(bm, Rectangle(0, 0, this->dataGridView1->Width, this->dataGridView1->Height));
e->Graphics->DrawImage(bm, 0, 0);
}
System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
printDialog1->ShowDialog();
printDocument1->Print();
}
Я попытался найти некоторую документацию по MSDN о том, как мне выполнить центрирование компонента DataGridView в растровом виде, но я нашелничего такого.Как я могу центрировать это на бумаге?