winforms – Windows窗体中BackgroundImage的位置

我将Windows窗体的BackgroundImage设置为200 x 200图像.表格是500 x 500.我希望图像锚定在表单的右下角.但是,我唯一可用的选项是BackgroundImageLayout属性 – 将此设置为“无”会导致图像锚定在左上角.我怎么能改变这个?

注意:我使用的是.NET 2.0

只需在OnPaintBackground()方法中绘制它.将图像添加到资源(我称之为BkgImage)并使表单代码如下所示:
public Form1() {
        InitializeComponent();
        backgroundImage = Properties.Resources.BkgImage;
        this.DoubleBuffered = true;
        this.SetStyle(ControlStyles.ResizeRedraw,true);
    }
    private Image backgroundImage;

    protected override void OnPaintBackground(PaintEventArgs e) {
        base.OnPaintBackground(e);
        var rc = new Rectangle(this.ClientSize.Width - backgroundImage.Width,this.ClientSize.Height - backgroundImage.Height,backgroundImage.Width,backgroundImage.Height);
        e.Graphics.DrawImage(backgroundImage,rc);
    }

相关文章

文章浏览阅读2.2k次,点赞6次,收藏20次。在我们平时办公工作...
文章浏览阅读1k次。解决 Windows make command not found 和...
文章浏览阅读3.2k次,点赞2次,收藏6次。2、鼠标依次点击“计...
文章浏览阅读1.3w次。蓝光版属于高清版的一种。BD英文全名是...
文章浏览阅读974次,点赞7次,收藏8次。提供了更强大的功能,...
文章浏览阅读1.4w次,点赞5次,收藏22次。如果使用iterator的...