时间:2019-03-17 标签:c#pictureboxdock问题
我希望将图片框停靠在表单的右上角,但是当我使用pictureBox1.Dock = DockStyle.Right;
图片框中的图像位于正确的位置,但其背景颜色为我的表单的整个高度创建了一条拉伸条纹。如果我使用它不会出现pictureBox1.Dock = DockStyle.Left;
我不知道为什么会这样,有人可以帮助我吗?
我希望它粘在右上角,当我尝试将窗口大小调整为较小时 - 使其消失,当我尝试将窗口大小调整为更大窗口时 - 保持它仍然粘在右上角。
I wish to dock my picturebox to right-top corner of my form, but when I usepictureBox1.Dock = DockStyle.Right;
the image from picturebox is in the right place, but its background color creates a streatched stripe for whole height of my form. It doesn't appera if I usepictureBox1.Dock = DockStyle.Left;
I have no idea why is it so, can anyone help me?
I wish it was sticked to right top corner and when I try to resize the window to smaller - make it disappear, when I try to resize to bigger window - keep it still sticked to righttop corner.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
按照您想要的方式放置图片框并设置
Anchor
属性:您的图片框就会按照您想要的方式运行。
Place the picturebox like you want it to be placed and set the
Anchor
property like that:and your picturebox behaves like you want it to.