0
어떤 도움이 필요합니까? 여기 내 코드는 다음과 같습니다마우스가 예상되는 위치에 그림을 그리지 않습니다. 그것은 컨트롤이 아닌 폼을 페인트합니다.
이using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Client
{
public partial class MainChat : Form
{
bool ShouldPaint = false;
public MainChat()
{
InitializeComponent();
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(400, 400);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (ShouldPaint)
{
Graphics graphics = CreateGraphics();
graphics.FillEllipse(new SolidBrush(Color.Black), e.X, e.Y, 10, 10);
}
}
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
ShouldPaint = false;
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
ShouldPaint = true;
}
}
}
고마워요! 매력처럼 일했습니다! 10 분이 지나면 이것을 해결할 것입니다. 대기 타이머가 있습니다. –