I am new to C # programming coming from VB6, so please be careful: P
I use panels to group controls (i.e. panels contain a text box, shortcuts, list, etc.), and then the panel is aligned at runtime, so that the controls are aligned in different resolutions. However, I am doing this from the Paint Paint (?) Procedure
i.e:.
private void pnlTop_Paint(object sender, PaintEventArgs e) { btnExit.Location = new Point(this.Width - (this.Left + lblTitleMain.Left + btnExit.Width), 10); btnMinimize.Location = new Point(this.Width - (this.Left + lblTitleMain.Left + (btnExit.Width * 2)), 10); btnSettings.Location = new Point(this.Width - (this.Left + lblTitleMain.Left + (btnExit.Width * 2 + btnExit.Width)), 10); lblTitleMain.Left = (((this.ClientSize.Width - lblTitleMain.Width) / 2) / 2) / 2; lblTitleMain.Top = btnExit.Top + lblTitleMain.Height; int intMenuY = lblTitleMain.Bottom + 5; lnkMenuSystem.Location = new Point(lblTitleMain.Left + 3, intMenuY); lnkMenuDeployment.Location = new Point(lnkMenuSystem.Right + 50, intMenuY); lnkMenuTables.Location = new Point(lnkMenuDeployment.Right + 50, intMenuY); lnkMenuTCP.Location = new Point(lnkMenuTables.Right + 50, intMenuY); lnkMenuDCM.Location = new Point(lnkMenuTCP.Right + 50, intMenuY); lnkMenuProcessData.Location = new Point(lnkMenuDCM.Right + 50, intMenuY); lnkMenuGenerateReports.Location = new Point(lnkMenuProcessData.Right + 50, intMenuY); lineMenuButtom.StartPoint = new Point((((this.ClientSize.Width - lblTitleMain.Width) / 2) / 2) / 2, lnkMenuSystem.Top + lnkMenuSystem.Height + 10); lineMenuButtom.EndPoint = new Point(this.Width - (this.Left + lblTitleMain.Left), lnkMenuSystem.Top + lnkMenuSystem.Height + 10); lnkMenuErrorMessage.Location = new Point(lnkMenuSystem.Left, lineMenuButtom.Y1+5); lnkMessageWelcome.Location = new Point(lineMenuButtom.X2 - lnkMessageWelcome.Width, lineMenuButtom.Y2 + 5); GlobalVariables.intGeneralLeft = lineMenuButtom.StartPoint.X; GlobalVariables.intGeneralWidth = lineMenuButtom.X2; }
I want to ask: Is this the right way to do this?
The reason for this is that I'm not sure if this will affect performance as soon as the application runs on older systems (assuming that it will be used in XP with 2G RAM Pentium 4 HT or equivalent).
source share