How to load a image from a website URL
Use WebClient to request it and save it to disk, open the local copy.
I get error ‘Value of String cannot be converted System.Drawing.Color’ when I use label1.BackColor= ‘Red’
Try VB.NET Label1.BackColor = System.Drawing.Color.FromName(‘Green’) C# Label1.BackColor = System.Drawing.Color.FromName(‘Green’);
How to show the graphics that have text written on it crisp and clear
Try VB.NET objGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias C# objGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
How to rotate a image in ASP.NET
VB.NET Dim img As System.Drawing.Image Dim strFilename As String = Server.MapPath(‘curves1.jpg’) img = System.Drawing.Image.FromFile(strFilename) Dim b = New System.Drawing.Bitmap(img.Width, img.Height, PixelFormat.Format24bppRgb) Dim g As Graphics = Graphics.FromImage(b) img.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipXY) g.DrawImage(img, New Point(0, 0)) Response.ContentType = ‘image/jpeg’ b.Save(Response.OutputStream, ImageFormat.Jpeg) C# System.Drawing.Image img ; string strFilename = Server.MapPath(‘curves1.jpg’) ; img = System.Drawing.Image.FromFile(strFilename) ; Bitmap b = new System.Drawing.Bitmap(img.Width, img.Height, PixelFormat.Format24bppRgb) ; Graphics g = Graphics.FromImage(b) ; img.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipXY) ; g.DrawImage(img,new Point(0,0)) ; Response.ContentType=’image/jpeg’ ; b.Save(Response.OutputStream, ImageFormat.Jpeg) ;
How to display image on a browser without using the image tag
VB.NET Dim objBitmap As New Bitmap(500, 500) Dim objGraphics As Graphics = Graphics.FromImage(objBitmap) objGraphics.Clear(Color.White) objGraphics.FillRectangle(New SolidBrush(Color.Purple), 0, 0, 400, 10) objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg) C# Bitmap objBitmap = new Bitmap(500, 500); Graphics objGraphics = Graphics.FromImage(objBitmap); objGraphics.Clear(Color.White); objGraphics.FillRectangle(new SolidBrush(Color.Purple ), 0, 0, 400, 10); objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);