
I’d like to try THBResize. I downloaded it. I installed it. I created a new project in VB6. I added the control to the tools, and finally I placed your control to the main form. I set some properties, and ran the project. Nothing happened. What was wrong?
It’s only necessary to write one line of code. But this line is really important: Private Sub Form_Load() THBResize1.hWnd = Me.hWnd End Sub
I am having a problem with controls that are hidden. Whenever resize the hidden controls become visible again.
If you work with invisible controls set the properties HideControlsSmallerThanWidth and HideControlsSmallerThanHeight to 0 or your invisible controls will become visible. If these properties are not equal to 0 the control will change the Visible property of all controls on the form. It doesn’t treat Invisible controls in a special way.
Another way to solve the problem is to exclude the invisible controls from being resized. You can do this by setting DeactivateAutoResize for each invisible control to True. I am using Frames with THBResize on my VB Form but when I resize the Form very fast resizing doesn’t work. There’s an extra effort necessary to use Frames. Please refer to the documentation and the Frames example Form. I placed THBResize on a MDI Child Form. The resizer doesn’t recognize the original Form size. If you use a resizer on a MDIChild Form then it is necessary to set the Width and Height of the form manually before you activate THBResize: Private Sub Form_Load() Me.Width = 8280 Me.Height = 6720 THBResize1.hWnd = Me.hWnd End Sub
Can I use THBResize with MSAccess?
No THBResize doesn’t support MSAccess.
THBResize doesn’t work on a VB UserControl?
Indeed the resizer doesn’t work on a user control. What you can do is to place a Frame or PictureBox control on the UserControl. Instead of placing your controls on the UserControl place them on the Frame. Then place the resizer on the Frame control. In this way the resizer is hosted by the Frame control and this works fine. To resize the Frame simply use the Resize event of the UserControl and resize the Frame manually:
Private Sub UserControl_Initialize()
THBResize1.hWnd = Frame1.hWnd
End Sub
Private Sub UserControl_Resize()
Frame1.Left = 0
Frame1.Top = 0
Frame1.Width = UserControl.Width
Frame1.Height = UserControl.Height
End Sub
THBResize doesn’t work on a VB UserControl that runs
in a browser?
Use the following code to create a VB UserControl with a THBResize control that runs in a browser like MSInternetExplorer
Option Explicit
Private Sub UserControl_Initialize()
THBResize1.hWnd = Frame1.hWnd
End Sub
Private Sub UserControl_Resize()
Frame1.Left = 0
Frame1.Top = 0
Frame1.Width = UserControl.Width
Frame1.Height = UserControl.Height
End Sub
Private Sub UserControl_Hide()
THBResize1.hWnd = 0
End Sub
Private Sub UserControl_Terminate()
THBResize1.hWnd = 0
End Sub
How to exclude certain controls from resizing in VC++?
Therefore you need to create a THBResizeSpecial object and set the DeactivateAutoResize property to True. In VC++ you can use the following code:
BOOL CDialogDemo1::OnInitDialog()
{
CDialog::OnInitDialog();
//This control will not be resized
m_edNoResize.SetWindowText("Don't resize me!");
m_THBResize.AddResizeSpecialDirect("", (long)m_sbLeft.GetSafeHwnd(), thbFixHorizLeft, thbFixVertTop, thbFixHorizLeft, thbFixVertBottom);
m_THBResize.AddResizeSpecialDirect("", (long)m_sbRight.GetSafeHwnd(), thbFixHorizRight, thbFixVertTop, thbFixHorizRight, thbFixVertBottom);
m_THBResize.AddResizeSpecialDirect("", (long)m_sbTop.GetSafeHwnd(), thbFixHorizLeft, thbFixVertTop, thbFixHorizRight, thbFixVertTop);
m_THBResize.AddResizeSpecialDirect("", (long)m_sbBottom.GetSafeHwnd(), thbFixHorizLeft, thbFixVertBottom, thbFixHorizRight, thbFixVertBottom);
m_THBResize.AddResizeSpecialDirect("", (long)m_Edit.GetSafeHwnd(), thbFixHorizLeft, thbFixVertTop, thbFixHorizRight, thbFixVertBottom);
try
{
ITHBResizeSpecialPtr rs;
// Create the THBResizeSpecial object and prevent
// m_edNoResize from being resized
if(CreateTHBResizeSpecial(rs))
{
rs->PutDeactivateAutoResize(VARIANT_TRUE);
rs->PutHWnd((long)m_edNoResize.GetSafeHwnd());
m_THBResize.AddResizeSpecial(rs);
}
}
catch(_com_error &e)
{ _bstr_t bstrDescription(e.Description());
MessageBox((char*)bstrDescription, "THBImageDemo", MB_OK);
}
m_THBResize.SetHWnd((long)this->GetSafeHwnd());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//--------------------------------------------------------------
//
// Create the THBResizeSpecial object
//
BOOL CDialogDemo1::CreateTHBResizeSpecial(ITHBResizeSpecialPtr &rs)
{
if(FAILED(rs.CreateInstance ("THBCom.THBResizeSpecial.25")))
{
MessageBox("Can't create THBResizeSpecial!");
return FALSE;
}
return TRUE;
}
I put a resize control on a CFormView based MDI app which
shows up initially with scrollbars, and resize the window, the controls that were not in view originally never do come into view. Just the ones that are visible, get stretched…… Use the OnInitialUpdate() to start the resizer on a FormView. To get rid of the initial scrollbars please call the function ResizeParentToFit(); It fits the form into the available space and this actually removes the scrollbars.
void CResizeTest2View::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
ResizeParentToFit();
m_thbResize.SetHWnd((long)this->GetSafeHwnd());
}
How can I add THBResize to my MFC application?
To add THBResize 2.5 ActiveX control to your MFC application use: Project->Add to Project->Components and controls Select ‘THBResize 2.5’ from the list of available controls VC++ will create wrapper classes CTHBResize(CTHBResize.h) and CTHBResizeSpecial(CTHBResizeSpecial.h)
Now you have a new icon for THBResize in your controls palette. Place a new control on the dialog. Create a member variable for the control with the class wizard. And add this source code line to the OnInitDialog event
BOOL CDialogGeneral::OnInitDialog()
{
CDialog::OnInitDialog();
m_THBResize.SetHWnd((long)this->GetSafeHwnd());
...



RSS News Feed