开发者

How can I create a PictureBox with close, maximize, and minimize buttons?

I am creating a GUI with C#. I intended to use a ListView to see preview of pictures, and a PictureBox to display the full view. I used a Panel as parent and placed a PictureBox inside of that to have scrollbars appear on the picture box.

What I still can't figure out how to do is to provide close, maximize, and minimize, buttons on the Panel, as se开发者_如何学Pythonen in many GUI applications.

How can I do this? Any ideas will be appreciated.


Those other GUI applications probably use a Form instead of a Panel/PictureBox, assuming that they provide maximize, minimize, and close buttons.

You could add your own buttons to the Panel control, and then write code in their Click event handlers to do whatever you want with the control. This is easy and relatively straight-forward if you just want to be able to close the picture, but it seems like unnecessary work to duplicate all of the functions that are built right into a Form.

I'd ditch the Panel control, add a new Form to my project, place the existing PictureBox control onto the form that I just added, and go from there. You might want to set the form's FormBorderStyle property to something like "SizableToolWindow", depending on how you want it to look.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜