To set all the control according to their location and according to the screen resolution. Just go through the code.
declare globally
int ScreenHeight=Screen.GetWorkingArea(this).Height;
int ScreenWidth=Screen.GetWorkingArea(this).Width;
private void SetControlsSize()
{
if (set.Width == 800 && set.Height >= 570)
{
this.pictureClose.Location = new Point(set.Width - 35, this.pictureClose.Location.Y);
this.gBoxMCPV.Height = set.Height - 330;
this.gBoxMCPV.Width = set.Width - 30;
this.dgviewMCPV.Width = set.Width - 30;
this.dgviewMCPV.Height = set.Height - 420;
this.lbltotamount.Top = this.dgviewMCPV.Bottom + 5;
this.gBoxMCPV.Top = lbltotamount.Bottom - 5;
this.lbltotalamount.Top = this.dgviewMCPV.Bottom + 10;
this.lbltotamount.Location = new Point(set.Width - 300, this.lbltotamount.Location.Y);
this.lbltotalamount.Location = new Point(set.Width - 100, this.lbltotalamount.Location.Y);
}
else
{
this.pictureClose.Location = new Point(set.Width - 35, this.pictureClose.Location.Y);
this.gBoxMCPV.Height = set.Height - 400;
this.gBoxMCPV.Width = set.Width - 30;
this.dgviewMCPV.Width = set.Width - 30;
this.dgviewMCPV.Height = set.Height - 540;
this.lbltotamount.Top = this.dgviewMCPV.Bottom + 10;
this.gBoxMCPV.Top = lbltotamount.Bottom + 10;
this.lbltotalamount.Top = this.dgviewMCPV.Bottom + 10;
this.lbltotamount.Location = new Point(set.Width - 300, this.lbltotamount.Location.Y);
this.lbltotalamount.Location = new Point(set.Width - 100, this.lbltotalamount.Location.Y);
}
}
just call the above method.
declare globally
int ScreenHeight=Screen.GetWorkingArea(this).Height;
int ScreenWidth=Screen.GetWorkingArea(this).Width;
private void SetControlsSize()
{
if (set.Width == 800 && set.Height >= 570)
{
this.pictureClose.Location = new Point(set.Width - 35, this.pictureClose.Location.Y);
this.gBoxMCPV.Height = set.Height - 330;
this.gBoxMCPV.Width = set.Width - 30;
this.dgviewMCPV.Width = set.Width - 30;
this.dgviewMCPV.Height = set.Height - 420;
this.lbltotamount.Top = this.dgviewMCPV.Bottom + 5;
this.gBoxMCPV.Top = lbltotamount.Bottom - 5;
this.lbltotalamount.Top = this.dgviewMCPV.Bottom + 10;
this.lbltotamount.Location = new Point(set.Width - 300, this.lbltotamount.Location.Y);
this.lbltotalamount.Location = new Point(set.Width - 100, this.lbltotalamount.Location.Y);
}
else
{
this.pictureClose.Location = new Point(set.Width - 35, this.pictureClose.Location.Y);
this.gBoxMCPV.Height = set.Height - 400;
this.gBoxMCPV.Width = set.Width - 30;
this.dgviewMCPV.Width = set.Width - 30;
this.dgviewMCPV.Height = set.Height - 540;
this.lbltotamount.Top = this.dgviewMCPV.Bottom + 10;
this.gBoxMCPV.Top = lbltotamount.Bottom + 10;
this.lbltotalamount.Top = this.dgviewMCPV.Bottom + 10;
this.lbltotamount.Location = new Point(set.Width - 300, this.lbltotamount.Location.Y);
this.lbltotalamount.Location = new Point(set.Width - 100, this.lbltotalamount.Location.Y);
}
}
just call the above method.
No comments:
Post a Comment