PictureBox displays white background

Hi,


I need to develop a menu form which contains icons and when user clicks those icons they will be directed to respected forms. Easiest way is to use PictureBox and set PictureBox.Image property to icon images. For this, I'm using .ico format of images since PictureBox can accept that. Then i handle the click event of those PictureBoxes.

It works just fine except those PictureBoxes can't display transparent background, instead they display white background. No matter what color I chose for the BackColor property, they still produce white bground. It took me hours to think what is going wrong. I googled this problem and some say PictureBox can't display transparent bground. Kinda weird here, it is not just fail to go transparent, PictureBox can't display any other colors except white.

Some workarounds I tried but to no joy:

1) Put those PictureBoxes in a container control, like Panel and make it the Parent control for PictureBox.

pictureBox1.Parent = panel1;
pictureBox1.BackColor = System.Drawing.Color.Transparent;


Answer this question

PictureBox displays white background

  • bigove

    Which version of the SDF are you using In the SDF v1.4 it's PictureBoxEx and in the SDF v2 it has been renamed to PictureBox2.
  • JamesJ

  • mfewtrell

    Just browse and add the OpenNETCF.Windows.Forms.dll to your Toolbox.
  • http200

    I'm using SDF v2.0 Free edition. I have referenced it in VS2005 project and included the classes in my Code using "Using" statement. I just not sure where is the PictureBox resides. Hope u can guide me. Thanks.
  • LOTG

    Finally, it worked. Thanks Alex.


  • 041661K

    Anyone know how to call PictureBox inside SDF I couldnt find any PictureBox in there.


  • PictureBox displays white background