SoFunction
Updated on 2025-03-07

C# 2 ways to add picture to picturebox controls to select states

Method 1:

The simple way is to change the borderstyle style of the picturebox control

  = BorderStyle.Fixed3D;
();//Force control repaint

Method 2

Add a rectangular box to the picturebox control, but this method reacts slowly in the program.

How to add rectangular boxes:
            Graphics pictureborder = ();
            Pen pen = new Pen(, 2);
            (pen, , , + , + );
How to remove rectangular boxes

();

If you have a better way, I hope to share it with us.