인쇄 미리보기 창을 닫거나 인쇄 미리보기 창을 이동하면 다음 코드에서 오류가 계속 발생합니다. 왜 이런 일이 일어나는 지 이해할 수없는 것 같습니다. g.DrawString() 줄에서 발생합니다. 내가 말할 수있는 한, 어느 쪽도 처분되었다. 오류의C# 매개 변수가 잘못되었습니다. 오류
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
Brush textBrush = new SolidBrush(this.ForeColor);
float width = TextRenderer.MeasureText(Text, this.Font).Width;
float height = TextRenderer.MeasureText(Text, this.Font).Height;
float radius = 0f;
if (ClientRectangle.Width < ClientRectangle.Height)
radius = ClientRectangle.Width * 0.9f/2;
else
radius = ClientRectangle.Height * 0.9f/2;
switch (orientation)
{
case Orientation.Rotate:
{
double angle = (_rotationAngle/180) * Math.PI;
g.TranslateTransform(
(ClientRectangle.Width + (float)(height * Math.Sin(angle)) - (float)(width * Math.Cos(angle)))/2,
(ClientRectangle.Height - (float)(height * Math.Cos(angle)) - (float)(width * Math.Sin(angle)))/2);
g.RotateTransform((float)_rotationAngle);
g.DrawString(Text, this.Font, textBrush, 0, 0);
g.ResetTransform();
}
break;
}
}
첫 번째 부분 : 어떤 도움을 주시면 감사하겠습니다
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
at System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, Single x, Single y)
at ScanPro.CustomControls.UserLabel.OnPaint(PaintEventArgs e)
.
감사합니다.
예외는 무엇입니까? – jason
System.ArgumentException { "매개 변수가 유효하지 않습니다."} – Nathan
'텍스트'에 무엇이 있습니까? –