0

代码在上面。我不明白为什么在 PrintView 中我在 PrintPreview 中看不到 123456?我使用 Visual Studio 2012 Windows 窗体 C++

    private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {
        printPreviewDialog1->Document=printDocument1;
        printPreviewDialog1->Location = System::Drawing::Point( 400, 300 );
        printPreviewDialog1->ShowDialog();
        }

        private: System::Void printDocument1_PrintPage(System::Object^  sender, System::Drawing::Printing::PrintPageEventArgs^  e) {
        System::Drawing::Bitmap^ pBitmap = gcnew System::Drawing::Bitmap( groupBox2->ClientRectangle.Width, groupBox2->ClientRectangle.Height ); 
        groupBox2->DrawToBitmap(pBitmap, groupBox2->ClientRectangle);   
        }

   public: System::Drawing::Graphics^ g;

   private: System::Void button2_Click_1(System::Object^  sender, System::EventArgs^  e) {
        g = groupBox2->CreateGraphics();
        groupBox2->Refresh();
        g->RotateTransform(-90.0F);
        drawString1erPanneau="123456";
        System::Drawing::Font^ drawFont=gcnew System::Drawing::Font("Microsoft Sans Serif", 9, FontStyle::Bold);
        SolidBrush^ drawBrush=gcnew SolidBrush(Color::FromArgb(51,153,255));
        Pen^ whitePen=gcnew Pen (Color::White);
        float x=-320.0F;
        float y1=216.0F;
        float width=70.0F;
        float height=15.0F;
        RectangleF drawRect1erPanneau=RectangleF(x,y1,width,height);
        g->DrawRectangle(whitePen, x,y1, width, height);
        g->DrawString(drawString1erPanneau,drawFont,drawBrush,drawRect1erPanneau);
        }
4

0 回答 0