जब मैं प्रिंट पूर्वावलोकन विंडो बंद करता हूं या प्रिंट पूर्वावलोकन विंडो को स्थानांतरित करता हूं तो मुझे निम्न कोड में कोई त्रुटि मिलती है। मुझे समझ में नहीं आ रहा है कि यह क्यों हो रहा है। यह g.DrawString() लाइन पर होता है। जहां तक मैं कह सकता हूं कि कुछ भी नहीं सुलझाया गया है।सी # पैरामीटर मान्य त्रुटि नहीं है
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
सिस्टम। ऑर्ग्यूमेंट अपवाद {"पैरामीटर वैध नहीं है।"} – Nathan
'टेक्स्ट' में क्या है? –