[SOLVED]Resize event and GetClientRec fails |
Post Reply |
Author | |
iamgtd
Senior Member Joined: 25 February 2009 Status: Offline Points: 131 |
Post Options
Thanks(0)
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: The resizing of the usercontrol in the client area sholud be done with: private void cjDockingPaneManager_ResizeEvent(object sender, EventArgs e) 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 10 64 bit Codejock Version 22.1 ActiveX MS Visual Studio 2022 - C# --------- |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
if you have both COmmandBars and DockingPane you need handle only CommandBars_ResizeEvent.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
iamgtd
Senior Member Joined: 25 February 2009 Status: Offline Points: 131 |
Post Options
Thanks(0)
|
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.
|
|
tobi
Senior Member Joined: 09 September 2004 Location: Germany Status: Offline Points: 451 |
Post Options
Thanks(0)
|
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 ? |
|
pate
Groupie Joined: 27 April 2009 Status: Offline Points: 36 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |