11. Изчертаване на правоъгълник

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
 
namespace r
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent(); Draw();
        }
 
 
        public void Draw()
        {

 

            Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height); 
            Graphics graph = Graphics.FromImage(bmp); 
            Pen pen=new Pen(Color.Red,2); 
            int x = 10, y = 10; 
            graph.DrawRectangle(pen, x, y, 200, 100); 
            pictureBox1.Image = bmp;

}

}

}

Търсене