作者ChenRobert (罗伯陈)
看板C_Sharp
标题[问题] BackgroundImageLayout 的问题
时间Sun Dec 30 22:32:55 2018
我想用 picturebox 的 BackgroundImageLayout
可是我发现有个问题 我不能用程式去设定 BackgroundImageLayout
当我设定 this.BackgroundImageLayout = ImageLayout.Zoom; 也是跑原来大小的图片
debug 之後确实有改Zoom
请问该怎样改写?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 220.135.6.189
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_Sharp/M.1546180377.A.8F4.html
补充
class cPicture : PictureBox
{
public cPicture() {
this.Image = Properties.Resources.犬走椛;
this.BackColor = Color.Transparent; //输入MSDN
this.Location = new Point(420, 316);
this.Size = new Size(176, 269);
this.BackgroundImageLayout = ImageLayout.Zoom;
}
}
主要程式是这样,我用 cPicture 去继承 PictureBox,这物件有这功能。
当主程式去呼叫这物件时,图片都会印出来。
问题是其他功能有效果,唯独this.BackgroundImageLayout = ImageLayout.Zoom;无效
※ 编辑: ChenRobert (220.135.6.189), 12/31/2018 09:43:15