简体   繁体   中英

C# Panel or picturebox for drawing

Im looking to draw a map of dots(coordinates), i want to be able to select these dots later on by clicking on them. Is it better to use a picturebox for this or should i use a panel?

EDIT

Im drawing the dots from an array of values

When using a PictureBox, it's best to assign a Bitmap object to PictureBox.Image and then draw to the Bitmap, as that's how it's designed to work.

If you want to use Panel, you should use your own class that inherits from Panel so you can set the options as follows. It's probably the best option if you need scrollbars:

public class Canvas : Panel {

    public Canvas() {
        ResizeRedraw = true;
        DoubleBuffered = true;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM