Windows Forms C# Panel should not have white background, and panel should be only image
I have a windows forms, i have placed an image on it, and the image is not rectangular, so white space lefts with it, because windows form is either开发者_高级运维 square or rectangular, but image is not, i want panel should be only image, rest of the space should not be visible, i am attaching an image to describe further.
Thanks Atif
as I understand it you want your form to be invisible? that isn't supported well in winforms and you should consider moving to WPF. however theres this example:
http://www.blackbeltcoder.com/Articles/winforms/non-rectangular-splash-screen-for-winforms
create a splash screen as the writer advices.
I think you have set form properties [BackgroundImageLayout:stretch] or
you have to change image size(width,height) same as form size(width,height)
Read the ImageSize before applying to the form. Resize the form with the image size. If you can set the ControlBox property of the Form, you can even hide the Close, Maximize and Minimize buttons from the right top corner.
So you mean to stretch your image to the window frame? Just dock the picturebox to full form size. There is an option called Dock in parent container. Use that
You need to set the BackgroundImageLayout
property to ImageLayout.Stretch
, ImageLayout.Zoom
or ImageLayout.Tile
depending on how you want the image to fill the Form.
Put the image on the form directly by setting the following properties:
Form1.BackgroundImage = MyBackgroundImage
Form1.BackgroundImageLayout = Stretch
精彩评论