Проект 25: Графични примитиви Правоъгълник
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication23
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); Draw();
}
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;
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication23
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); Draw();
}
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;
}
}
}