verification image
-
hi , i try to draw a virification image on my page and i try some code and it worked alleady but the problem is all controls on the page not display i want to draw this but without i lose the page controls here the code i wrote // Initialize graphics Rectangle rectF = new Rectangle(0, 0, 100, 150); Bitmap pic = new Bitmap(100, 150); Graphics g = Graphics.FromImage(pic); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.FillRectangle(new SolidBrush(Color.White), rectF); //g.DrawRectangle (Pens.Aqua , rectF); Font font = new Font("Times New Roman", 12); // Set font direction & alignmentString StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; // Finally, draw the font g.DrawString(GenerateRendomText(), font, System.Drawing.Brushes.Black, rectF, format); //Response.ContentType = "image/jpeg"; // Set the content type Response.ContentType = "image/gif"; // Output the image to the OutputStream by using the Save method pic.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif); // Dispose objects pic.Dispose();
MD_NADA
-
hi , i try to draw a virification image on my page and i try some code and it worked alleady but the problem is all controls on the page not display i want to draw this but without i lose the page controls here the code i wrote // Initialize graphics Rectangle rectF = new Rectangle(0, 0, 100, 150); Bitmap pic = new Bitmap(100, 150); Graphics g = Graphics.FromImage(pic); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.FillRectangle(new SolidBrush(Color.White), rectF); //g.DrawRectangle (Pens.Aqua , rectF); Font font = new Font("Times New Roman", 12); // Set font direction & alignmentString StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; // Finally, draw the font g.DrawString(GenerateRendomText(), font, System.Drawing.Brushes.Black, rectF, format); //Response.ContentType = "image/jpeg"; // Set the content type Response.ContentType = "image/gif"; // Output the image to the OutputStream by using the Save method pic.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif); // Dispose objects pic.Dispose();
MD_NADA
GenerateRendomText()? do you have a try/cach around this structure? And does the catch nog get reached?
In Word you can only store 2 bytes. That is why I use Writer.