Print Page | Close Window

GetClientRect returns wrong values

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1769
Printed Date: 17 November 2024 at 11:17pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: GetClientRect returns wrong values
Posted By: blazej
Subject: GetClientRect returns wrong values
Date Posted: 09 February 2005 at 2:09pm
Hi

I'm in the process of evaluating Xtreme Suite for the purposes of the software project we're working on. I'm using the ActiveX version of the components in C# (VS .NET 2003).

I'm using both Command Bars and Docking Pane Manager. I want to create an SDI application do I have created a single document control on my main form. I'm trying to position it properly inside commandBars_ResizeEvent(). Here's what I do (copied straight from sample code):

int left, top, right, bottom;
commandBars.GetClientRect( out left, out top, out right, out bottom );
dataTableControl.SetBounds( left, top, right - left, bottom - top );

The problem is that commandBars.GetClientRect() returns unrealistic values: left=3090, top=345, right=9630, bottom=9030. Of course, the SetBounds() call is then positioning my document control well beyond the screen.

What's wrong?

Regards

     Michal Blazejczyk



Replies:
Posted By: SuperMario
Date Posted: 09 February 2005 at 2:23pm
Might need to add:

        private void frmMain_Load(object sender, System.EventArgs e)
        {
             ..............

           foreach (Control ctrl in this.Controls)
            {
         &nbs p;      if (ctrl is MdiClient)
                {                                                                       
                    CommandBars.SetMDIClient(ctrl.Handle.ToInt32());
                }
            }

             ..............
        }


Posted By: blazej
Date Posted: 09 February 2005 at 2:31pm
Hi

Yes, but my app is not MDI and none of my controls are MDI. Is this required by the Xtreme Suite?

What I did was following the example that I found in the DockingPane C# sample... It works there, why not in my case? The only difference is the presence of CommandBars...

Regards

     Michal


Posted By: SuperMario
Date Posted: 09 February 2005 at 2:35pm
You can try:

    DockingPaneManager.SetCommandBars (CommandBars.GetDispatch());



Posted By: blazej
Date Posted: 09 February 2005 at 2:53pm
Yep, I'm doing that.

This behavior looks like a bug to me. I tried remove the command bars from the picture - dockingManager.GetClientRect() still returns way too big values.

But the DockingPane sample works fine :-(((

Michal


Posted By: Boyd
Date Posted: 09 February 2005 at 3:48pm
Try changing the scale mode of CommandBars and DockingPanes from Twips to Pixels.  It defaults to Twips, and that's probably what's giving you the large numbers.  I've been using all the controls in C# without problems.


Posted By: blazej
Date Posted: 09 February 2005 at 4:09pm
Thanks, that was it!

Some strange default, I tell ya!

;)

Michal



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net