C语言 用VS画正方形的外接圆和内切圆
大佬们 遇到一个问题,如何用C语言在VS下画一个正方形,并且画出他的外接圆和内切圆
望大佬们指导,多谢
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { int _x = int::Parse(textBox1->Text); int _y = int::Parse(textBox2->Text); int _r = int::Parse(textBox3->Text); Image^ MyImage = gcnew Bitmap(pictureBox1->Width, pictureBox1->Height); Graphics^ g = Graphics::FromImage(MyImage); Pen^ mypen = gcnew Pen(Color::Black, 1); Rectangle rect = Rectangle(_x-_r, _y-_r, 2*_r, 2*_r); g->DrawEllipse( mypen, rect ); g->DrawRectangle(mypen,rect); rect = Rectangle(_x-_r*1.414, _y-_r*1.414, 2*(_r*1.414), 2*(_r*1.414)); g->DrawEllipse( mypen, rect ); this->pictureBox1->Image = nullptr; this->pictureBox1->Image = (Image^)MyImage->Clone(); delete g; delete MyImage; delete mypen; }