Click here to Skip to main content
16,020,677 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

As I try to place the Panel7 in centre of the already define panel(Custinfo)with the under mention code.
But the panel7 is not coming in the exact location.
I am unable to trace the problem.


Dim xx, yy As Integer
xx = Custinfo.Width - Panel7.Width
yy = Custinfo.Height - Panel7.Height
Panel7.Location = New System.Drawing.Point(CInt(xx / 2), CInt(yy / 2))
Panel7.Visible = True
Posted
Updated 9-Sep-10 0:12am
v2
Comments
Dalek Dave 9-Sep-10 6:12am    
Edited for Code Block.

1 solution

Panel1.Location=New Point((Me.Width/2)-(Panel1.Width/2),(Me.Height/2)-(Panel1.Height/2))


Adjust to suit your needs
 
Share this answer
 
Comments
Jatinder Gupta 9-Sep-10 8:59am    
It is ok to work with me.width but it will calculate from Form not from the Panel-A. As explained that the I have a panel-A inside Form and another Panel-B inside that Panel-A. Now I want to place Panel-B inside Panel-A in centre. That is my query

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900