To solve the positioning problem you can use either of the following options:
PictureBox
at run-timeRun-Time Solution
You can simply create PictureBox
at run-time and add it to Controls
collection of the Form
and when needed, simply bring it to from using BringToFront
method.
Design-Time Solution
You can use Document Outline window to change parent of the controls and their z-index. You can simply drag and drop tree nodes (controls) to change parent and z-index of the control.
举例来说,创建一个新表单Form
,放置一个Panel
on表单并将其设置Dock
为Fill
。然后PictureBox
在面板上放置一个。然后在树状视图中使用“文档大纲”窗口,PictureBox
将其拖动并在树状视图中将其置于面板节点中。这样,您可以将Form设置为的父级PictureBox
。要将图片框移动到窗体上的适当位置,请使用箭头键或使用“属性”窗口。不要使用鼠标,如果使用鼠标更改位置,则会意外更改父对象。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句