Can I create a transparent background on a PictureBox in WinForms?

不羁的心 提交于 2019-12-05 04:30:45

Setting pictureBox.BackColor = Color.Transparent; definitely should work.

Also verify if you are setting alpha channel of color when using Color.FromArgb(0, 0, 0, 0); (this is a first parameter, zero means transparent color)

And, of course, make sure your icons have transparent background.

If using WinForms then Setting the background color to transparent won't work as transparency handling is not a cascading system - you can only (in most cases) set transparency (or rather the opacity) of a control overall using the Opacity property, however this will alter the alpha channel of the entire control display giving your images a see-througness.

One solution might be to set the background color of the PictureBox to be that of the control beneath it (the color of the form, for example). But this may not suffice in your situation.

hi you must set the icon on the other portion underneath the icon by using this

icon_pictureBox_name.Controls.Add(other_portion_picturBox_name);

and after that you can set the PictureBox.BackColor property to "Transparent" and it will work ;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!