I have a 256x256 .ico that I want to print through my C# syntax. This is my syntax
Image logoImage = global::Winform1.Properties.Resources.KA0_icon.ToBitmap();
Rectangle LogoRect = new Rectangle(m_leftMargin, m_leftMargin, (int)(logoImage.Width * 0.75), (int)(logoImage.Height * 0.8));
e.Graphics.DrawImage(logoImage, LogoRect);
e.Graphics.DrawRectangle(Pens.LightBlue, LogoRect);
But this throws an error of:
An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code
Additional information: Requested range extends past the end of the array
What must I do in order to have this .ico file display on the top of the page I am printing?
Edit
Per the suggestions below I have also tried this syntax
Image logoImage = Bitmap.FromHicon(global::Winform1.Properties.Resources.KA0_icon, new Size(48, 48).Handle);
however this gives me an error of
Size' does not contain a definition for 'Handle' and no extension method 'Handle' accepting a first argument of type 'Size' could be found (are you missing a using directive or an assembly reference?)