Creating a new System.Drawing.Bitmap file

This code throws an exception with the latest version of LINQPad 4.28

new System.Drawing.Bitmap(200, 200).Dump(); 

Is this a problem in my code or a problem with the LINQPad.Dump () extension method?

+6
linqpad
source share
2 answers

The ability to delete bitmaps is a new beta in LINQPad 4.28, but there seems to be a bug. Today I will download the patch.

Edit: The new assembly is now loaded. You can verify it by doing this:

 using (var b = new System.Drawing.Bitmap (400, 200)) using (var g = Graphics.FromImage (b)) using (var f = new Font ("Arial", 40)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.FillEllipse (Brushes.CadetBlue, 0, 0, 400, 200); g.DrawString ("LINQPad", f, Brushes.Black, 75, 70); b.Dump(); } 

Note that you can also reset images by calling Util.Image , passing in a file name or URI. You can use the latter to draw graphs using the Google chart API ; For example, the following:

 Util.Image ("http://chart.apis.google.com/chart?cht=p3&chd=s:Uf9a&chs=350x140&chl=January|February|March|April") 

generates this output:

Google chart demo

+12
source share

LINQPad cannot draw bitmaps using Dump ().

Instead you can write

 Application.Run(new Form { ClientSize = bitmap.Size, BackgroundImage = bitmap}); 
+3
source share

All Articles