![]() |
Can't resize PictureBox in MDI Frame window |
Post Reply
|
| Author | |
DaveH
Groupie
Joined: 22 December 2008 Status: Offline Points: 10 |
Post Options
Thanks(0)
Quote Reply
Topic: Can't resize PictureBox in MDI Frame windowPosted: 25 June 2026 at 5:48pm |
|
Hi, I have a VB6 MDIForm with a CommandBars control, and have aligned a PictureBox on the left. In the CommandBars_RepositionAlignedControls event handle, I call CommandBars.MoveAlignedControl on the PictureBox, and everything looks good. However, I want to change the width of the PictureBox at runtime. If the CommandBars isn't on the form, it works as expected. However, when the CommandBars is on the form, changing the Width property of the PictureBox doesn't do anything: no visible change, and if I set the Width, then read it back, it's unchanged. A small project that demonstrates the problem: Create a new VB6 project that contains an MDIForm. On the MDIForm, put a CommandBars control named CommandBars and a PictureBox named Picture1. Set the Align of Picture1 to Align Left and the Width to 2000. Put a CommandButton named Command1 inside Picture1, near the upper-left. Private Sub Command1_Click() Dim NewWidth As Single NewWidth = IIf(Picture1.Width > 1000, 1000, 2000) Picture1.Width = NewWidth Debug.Print "Set to " & NewWidth & ", actual width is " & Picture1.Width ' Trying RecalcLayout to see if it helps, but it doesn't. ' It does cause the RepositionAlignedControl event to fire though. CommandBars.RecalcLayout End Sub Private Sub CommandBars_RepositionAlignedControls(Left As Long, Top As Long, Right As Long, Bottom As Long) CommandBars.MoveAlignedControl Picture1, Left, Top, Right, Bottom End Sub If you remove the CommandBars from the form and comment out the lines that reference it, it works as expected: Clicking the button toggles the PictureBox width between two sizes. With CommandBars, clicking the button doesn't do anything, and the Debug message says "Set to 1000, actual width is 2004" SuitePro 22.0.0 on Windows 11.
|
|
|
SuitePro version 22.0.0
David Huang CAI Software, LLC Inventory and Distribution Management for QuickBooks |
|
![]() |
|
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 |