using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
this->SuspendLayout();
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(300, 300);
this->Name = L"Form1";
this->Text = L"Happy Face";
this->Paint +=
gcnew System::Windows::Forms::PaintEventHandler(this,
&Form1::Form1_Paint);
this->ResumeLayout(false);
}
System::Void Form1_Paint(System::Object^ sender,
System::Windows::Forms::PaintEventArgs^ e)
{
Graphics^ g = e->Graphics;
Pen^ b4pen = gcnew Pen(Color::Black, 4);
// Head
Rectangle rect = Drawing::Rectangle(25, 25, 250, 250);
g->FillEllipse(Brushes::Yellow, rect);
g->DrawEllipse(b4pen, rect);
// Mouth
g->FillPie(Brushes::White, 100, 175, 100, 50, 0, 180);
g->DrawPie(b4pen, 100, 175, 100, 50, 0, 180);
// Left Eye
rect = Drawing::Rectangle(100, 100, 25, 25);
g->FillEllipse(Brushes::White, rect);
g->DrawEllipse(b4pen, rect);
// Right Eye
rect = Drawing::Rectangle(175, 100, 25, 25);
g->FillEllipse(Brushes::White, rect);
g->DrawEllipse(b4pen, rect);
// Get rid of pen Created
delete b4pen;
}
};
[STAThreadAttribute]
int main(array ^args)
{
Application::Run(gcnew Form1());
return 0;
}