private void SetDimensions() { SuspendLayout(); try { // This is to invoke parent changed message that help rescaling the controls based on parent font (when it changed) Controls.Clear(); //local cache. var pixel_24 = DpiHelper.ConvertToGivenDpiPixel(24, _pixelFactor); var pixel_25 = DpiHelper.ConvertToGivenDpiPixel(25, _pixelFactor); var pixel_32 = DpiHelper.ConvertToGivenDpiPixel(32, _pixelFactor); var pixel_59 = DpiHelper.ConvertToGivenDpiPixel(59, _pixelFactor); var pixel_64 = DpiHelper.ConvertToGivenDpiPixel(64, _pixelFactor); var pixel_89 = DpiHelper.ConvertToGivenDpiPixel(89, _pixelFactor); var pixel_99 = DpiHelper.ConvertToGivenDpiPixel(99, _pixelFactor); var pixel_125 = DpiHelper.ConvertToGivenDpiPixel(125, _pixelFactor); Size = new Size(pixel_125, pixel_89); _topLeft.Size = new Size(pixel_24, pixel_25); _topCenter.Location = new Point(pixel_32, 0); _topCenter.Size = new Size(pixel_59, pixel_25); _topRight.Location = new Point(pixel_99, 0); _topRight.Size = new Size(pixel_24, pixel_25); _middleLeft.Location = new Point(0, pixel_32); _middleLeft.Size = new Size(pixel_24, pixel_25); _middleCenter.Location = new Point(pixel_32, pixel_32); _middleCenter.Size = new Size(pixel_59, pixel_25); _middleRight.Location = new Point(pixel_99, pixel_32); _middleRight.Size = new Size(pixel_24, pixel_25); _bottomLeft.Location = new Point(0, pixel_64); _bottomLeft.Size = new Size(pixel_24, pixel_25); _bottomCenter.Location = new Point(pixel_32, pixel_64); _bottomCenter.Size = new Size(pixel_59, pixel_25); _bottomRight.Location = new Point(pixel_99, pixel_64); _bottomRight.Size = new Size(pixel_24, pixel_25); ResetAnchorStyle(); Controls.AddRange(new Control[] { _bottomRight, _bottomCenter, _bottomLeft, _middleRight, _middleCenter, _middleLeft, _topRight, _topCenter, _topLeft }); } finally { ResumeLayout(); } }