}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication48
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int w, h;
bmp = new Bitmap(500, 500);
g = Graphics.FromImage(bmp);
w = pictureBox1.Width; h = pictureBox1.Height;
Color[] c = new Color[] { Color.Black, Color.Green, Color.Red, Color.Blue, Color.Yellow, Color.Violet, Color.Gray };
float dx = pictureBox1.Height / 14;
float dy = pictureBox1.Width / 14;
for (int i = 0; i < 7; i++)
{
g.DrawRectangle(new Pen(c[i], 3), (i + 1) * dx, (i + 1) * dy, pictureBox1.Width - 2 * (i + 1) * dx, pictureBox1.Height);
g.FillRectangle(new SolidBrush(c[i]), (i + 1) * dx, (i + 1) * dy, pictureBox1.Width - 2 * (i + 1) * dx, pictureBox1.Height);
pictureBox1.Image = bmp;
}
g.Dispose();
}
Graphics g;
Bitmap bmp;
private void button1_Click(object sender, EventArgs e)
{
}
}
}
Do'stlaringiz bilan baham: |