当我尝试在屏幕上绘制矩形或其他东西时出现问题。在这段代码中,我会期望在坐标x = 0和y =屏幕的一半上绘制一个矩形,但它不在屏幕的中心。C#绘制问题
谢谢!
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
private Graphics gr;
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
gr = this.CreateGraphics();
Pen p = new Pen(new SolidBrush(Color.Black),1);
gr.DrawRectangle(p, 0, this.Height/2 - 50, 100, 100);
}
}
}
所以你的问题是????? – Bas 2014-08-31 18:05:42