Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,907 questions

51,839 answers

573 users

How to draw 8X8 matrix of box frames (WinForms) in C#

1 Answer

0 votes
using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            int x, y = 10, w = 50, h = 50;

            Pen pen = new Pen(Color.Black, 2);

            for (int i = 1; i <= 8; i++)
            {
                x = 10;
                for (int j = 1; j <= 8; j++)
                {
                    Graphics g = this.CreateGraphics();
                    g.DrawRectangle(pen, new Rectangle(x, y, w, h));
                    x += 50;
                    g.Dispose();
                }
                y += 50;
            }
            pen.Dispose();
        }
    }
}



answered Feb 9, 2015 by avibootz
edited Feb 9, 2015 by avibootz

Related questions

1 answer 311 views
1 answer 2,068 views
1 answer 233 views
...