Can't access panel.ClientRectangle

  • Thread starter Thread starter DM
  • Start date Start date
D

DM

Hi All,

I'm having trouble accessing the ClientRectangle property on a panel
control.

At design-time it says that ClientRectangle is not a member of the Panel
class, but when I look at the QuickWatch at run-time I can clearly see it is
part of the control parameters.

Am I missing something obvious? I'm running Visual Basic .NET v1.1.

-Duncan
 
Hi All,

I'm having trouble accessing the ClientRectangle property on a panel
control.

At design-time it says that ClientRectangle is not a member of the Panel
class, but when I look at the QuickWatch at run-time I can clearly see it is
part of the control parameters.

Am I missing something obvious? I'm running Visual Basic .NET v1.1.

-Duncan

I have no trouble accessing the ClientRectangle property. Can you
show some segment of code that shows the problem? Have you tried
casting to Control to get it:

Dim r As Rectangle = DirectCast(panel1, Control).ClientRectangle

That sounds awfully strange.

Chris
 
Chris Dunaway said:
I have no trouble accessing the ClientRectangle property. Can you
show some segment of code that shows the problem? Have you tried
casting to Control to get it:

Dim r As Rectangle = DirectCast(panel1, Control).ClientRectangle

That sounds awfully strange.

Chris

Thanks, that seems to work fine.

As for a code snippet, all I do is add the panel to a form at design-time
then try to access that parameter from within the form code. ie.

MyFunction( Me.pnlMyPanel.ClientRectangle )

....and I get a 'ClientRectangle' is not a member of class Panel... Very odd
because it is listed as a member in the MSDN library and when observed via
QuickWatch.

In any case it is working now and I really appreciate your suggestion.

-Duncan
 
Back
Top