0

I have a tab-control and it contains 1 tab view and in it there are 3 different picture-boxes which contain the 3 different images, besides each other, now the thing is that I have set the picture-boxes according to my monitor settings, but what I want is the form and picture boxes should remain exactly the same as per any screen settings, either it is low resolution or high, I tried and achieved one of the picture-boxes, but not able to set the other accordingly, can any body show me how to do it?. Images should remain in center of the tab view accordingly like this.

enter image description here

        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);`
habib
  • 2,366
  • 5
  • 25
  • 41
Huzaifa
  • 9
  • 2
  • Writing code that is dpiAware is very, very important today. Something that Winforms programmers tend to discover early, the designer runs inside VS which is a dpiAware app. But they forget to [mark their own app to be dpiAware](https://stackoverflow.com/a/13228495/17034), so the UI gets rescaled to 96 dpi. Discovering the bugs is otherwise useful, helps you find out what happens on another user's machine. The code has a bug, hard-coding 400 and 800 is not correct when it gets rescaled. Easy fix, either stop helping or add pbox_View_Angle.Width. – Hans Passant Jun 29 '18 at 12:10
  • Thank you, understood, but not much clear on dpiAware, will check it and let you know. – Huzaifa Jun 29 '18 at 13:10
  • Are the pboxes anchored? They probably shouldn't be. – TaW Jul 01 '18 at 17:43
  • No, not anchored. – Huzaifa Jul 02 '18 at 11:40

0 Answers0