首页 > 解决方案 > 在 C# 中,图像应保持在屏幕大小上的选项卡视图的中心

问题描述

我有一个选项卡控件,它包含 1 个选项卡视图,其中有 3 个不同的图片框,其中包含 3 个不同的图像,除了彼此之外,现在的问题是我已经根据我的显示器设置设置了图片框,但我想要的是表单和图片框应该与任何屏幕设置完全相同,无论是低分辨率还是高分辨率,我尝试并实现了其中一个图片框,但无法相应地设置另一个,任何人都可以告诉我怎么做吗?图像应相应地保留在选项卡视图的中心,如下所示。

在此处输入图像描述

        Bitmap b = new Bitmap(500, 500);
        pbox_View_Angle.Size = b.Size;
        var left = (tabPage1.ClientRectangle.Width - pbox_View_Angle.ClientRectangle.Width) / 4;
        var top = (tabPage1.ClientRectangle.Height - pbox_View_Angle.ClientRectangle.Height) / 2;
        pbox_View_Angle.Location = new Point(tabPage1.ClientRectangle.Location.X + left, tabPage1.ClientRectangle.Location.Y + top);

        pbox_View_Height.Location = new Point(tabPage1.ClientRectangle.Location.X + left + 400, tabPage1.ClientRectangle.Location.Y + top);

        pbox_View_Azimuth.Location = new Point(tabPage1.ClientRectangle.Location.X + left + 800, tabPage1.ClientRectangle.Location.Y + top);`

标签: c#winformsresponsivepictureboxtabview

解决方案


推荐阅读