1
좋아, 나는 모든 것을 고쳐야한다. 지금은 내가 원하는 것이다. 나는 textBox1
, panel1
및 drawTexta
(버튼)을 가지고 있습니다.패널에 텍스트 그리기
버튼을 클릭하고 패널에서 점을 선택하면 textBox1
에서 문자열을 그립니다.
private void panel1_Paint(object sender, PaintEventArgs e)
{
using (SolidBrush br = new SolidBrush(Color.Red))
{
StringFormat sf = new StringFormat();
sf.FormatFlags = StringFormatFlags.DirectionRightToLeft;
e.Graphics.DrawString(textBox1.Text, this.Font, br, point1, sf);
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
point1 = new Point(e.X, e.Y);
}
bool flag = false;
Point point1 = new Point();
private void drawTexta_Click(object sender, EventArgs e)
{
flag = true;
panel1.Refresh();
}
텍스트 상자를 사용하고 나중에 캔버스에 텍스트를 그리는 것이 더 쉬울 수 없습니까? – GolezTrol
내가 아는 유일한 것은 'SolidBrush'에 의한 메모리 누출이 있다는 것입니다. –
@AlvinWong .net 가비지 수집을 처리합니다. 그러나 사용하는 것은 여전히 좋은 습관입니다. – Yatrix