form1.cs

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 XNAGame_008
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        //创建3个半透明的画刷,填充矩形
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g1 = this.CreateGraphics();
            SolidBrush redBrush = new SolidBrush(Color.FromArgb(128,255,0,0));
            SolidBrush greenBrush = new SolidBrush(Color.FromArgb(128,0,255,0));
            SolidBrush blueBrush = new SolidBrush(Color.FromArgb(128,0,0,255));
 
            g1.FillRectangle(redBrush,0,0,100,100);
            g1.FillRectangle(greenBrush, 50, 0, 100, 100);
            g1.FillRectangle(blueBrush,25,50,100,100);
        }
    }
}

页游开发】