初学C#,自己写的棋盘,没什么技术含量,能达到预期效果就很开心了
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace saolei
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void Form2_Paint(object sender, PaintEventArgs e)
{
int col1 = 5;
int row1 = 9;
int xPoint = 10;
int yPoint = 10;
Pen p = new Pen(Brushes.Black, 2);
p.DashStyle = DashStyle.Custom;
//绘制上半部分:4行
for (int i = 0; i < col1; i++)
{
e.Graphics.DrawLine(p, 10, yPoint, 410, yPoint);