Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Docking Pane
  New Posts New Posts RSS Feed - [SOLVED]Resize event and GetClientRec fails
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED]Resize event and GetClientRec fails

 Post Reply Post Reply
Author
Message
iamgtd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 February 2009
Status: Offline
Points: 131
Post Options Post Options   Thanks (0) Thanks(0)   Quote iamgtd Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED]Resize event and GetClientRec fails
    Posted: 27 August 2009 at 5:10am

In a form I'm using a ribbonbar and a dockingpane. In the client area should be placed a usercontrol.

The dockingpane is associated with the commandar with the following code:
cjDockingPaneManager.SetCommandBars(this.cjCommandBars.GetDispatch());

The resizing of the usercontrol in the client area sholud be done with:

        private void cjDockingPaneManager_ResizeEvent(object sender, EventArgs e)
        {
            int left, top, right, bottom;
            cjDockingPaneManager.GetClientRect(out left, out top, out right, out bottom);
            userControl.SetBounds(left, top , right - left, bottom - top);
        }

But the resize event occurs only once at the program start and the second thing is that the values from the GetClientRect method delivers wrong values (left and top = 0, right and bottom are the values from this.ClientSize).

I have tried to resize the client usercontrol in an other resize event (form, commandbar). But the GetClientRect method delivers always wrong values. I have also tried to use a richtextbox instead of the usercontrol, but the result is the same.

It seems that the GetClientRect method only work correct if no commandbar is present.

Is there a way to solve this behavior?

-------------------------------
OS: Win XP prof. SP3
Codejock Version 13.1.0
Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM
Microsoft .NET Framework Version 3.5 SP1
Installed Edition: Enterprise
Microsoft Visual C# 2008
-------------------------------

---------

OS: Win 10 64 bit

Codejock Version 22.1 ActiveX

MS Visual Studio 2022 - C#

---------
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2009 at 7:23am
Hi,
 
if you have both COmmandBars and DockingPane you need handle only CommandBars_ResizeEvent.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
iamgtd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 February 2009
Status: Offline
Points: 131
Post Options Post Options   Thanks (0) Thanks(0)   Quote iamgtd Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2009 at 7:50am
many, thanks. problem solved.
 
 
        private void cjCommandBars_ResizeEvent(object sender, EventArgs e)
        {
            int left, top, right, bottom;           
            cjCommandBars.GetClientRect(out left, out top, out right, out bottom);
           
            userControl.SetBounds(left, top, right - left, bottom - top);
        }
 
It's interesting that the resize event of the commandbar reacts to the resizing of panes in the dockingpane, because in this case the size of the commandbar isn't changed.
Back to Top
tobi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 September 2004
Location: Germany
Status: Offline
Points: 451
Post Options Post Options   Thanks (0) Thanks(0)   Quote tobi Quote  Post ReplyReply Direct Link To This Post Posted: 21 September 2009 at 12:23pm
I have similar question: In my VB6 app I have a textbox in a docking pane and want to "manually" resize it because I want a little more borders !
So I use this code in the CommandBars_Resize event handler:

Dim Left As Long, Top As Long, Right As Long, Bottom As Long

CommandBars.GetClientRect Left, Top, Right, Bottom
Text1.Move Left, Top, Right - Left, Bottom - Top

DockingPane.GetClientRect Left, Top, Right, Bottom
Text2.Move Left + 5, Top + 5, Right - Left, Bottom - Top

The first Textbox which should cover mainform works right, but the Text2 control, which should fill the docking pane
does not - it is sized to a much smaller size than the docking pane area !?!?!?!

Btw. I created the docking pane by directly attaching Text2.hwnd which is placed on the mainform ! Is this best practice
or should I use a PictureBox where the textbox is placed in ?


Back to Top
pate View Drop Down
Groupie
Groupie


Joined: 27 April 2009
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote pate Quote  Post ReplyReply Direct Link To This Post Posted: 05 November 2009 at 4:10pm
A lot of times when I see a control get resized much smaller than I would think it has to do with the scaling.  You may expect twips and are using pixels instead and vice-versa.  Not sure that is the problem, but it has happened to me a number of times in the past.  Getting them on the same scaling usually solved the issue.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.