I am creating a .net program which requires a rectangle to be drawn on the screen, the code is triggered by a menu item click, which runs the code:
this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::PaintForm);
this event draws a rectangle fill, then a rectangle line around it (anybody know how to make that one shape instead of two?) like this:
Graphics^ g = this->CreateGraphics();
Pen^ blackPen = gcnew Pen(Color::Black);
SolidBrush^ whiteBrush = gcnew SolidBrush(Color::White);
Rectangle stage = Rectangle(70, 70, 339, 439);
g->DrawRectangle(blackPen, 69, 69, 340, 440);
the code runs fine, but the shape will not appear (the screen won't blit) until I minimize the form, then restore it. I've tried all sorts of things like using e->Graphics-> Instead of the Graphics^ g = this->CreateGraphics();, and nothing seems
to fix it. Any help?
By the way, I'm fine with receiving code samples in codes other than c++.
View Complete Post