The ExSplitBar control provides automatic resizing and repositioning of controls and windows within a form, dialog, or window. When the Mode property is set to exSplitBarHorz, the control resizes the controls located above or below it, while exSplitBarVert resizes the controls located to its left or right. Unlike other components of the same type, the ExSplitBar control works across a wide range of programming environments, including Microsoft Office (Microsoft Access, Microsoft Excel, and Microsoft Word), Visual Basic, Visual FoxPro, .NET Framework, Delphi, C++, C++ Builder, dBASE Plus, and more.
In short, the ExSplitBar component splits a form, dialog, or window into two sections: left/top and right/bottom. To use the control, you only need to specify which objects, controls, or windows belong to each side of the split bar. The control automatically resizes and repositions these objects as the user drags the split bar to a new position.
Here's the steps you need to follow in order to use the ExSplitBar control:
- Insert the ExSplitBar library/reference to your project ( follow the
"inserting the component to a form/dialog" here
)
- Place ExSplitBar control to your form/dialog/window
- Specify the objects in the left/top and right/bottom parts of the
split bar, using the ObjectsLT / ObjectsRB or AddObjectLT /
AddObjectRB available at runtime.
For instance, let's say we have the following layout:
so we have two split bars ( horizontal and vertical ), and three
buttons/commands. One splitter should resizes the left-most button, and
the rest, and the vertical split bar show resize the top-most button and
the bellow one.
In
- C# for /NET Assembly
- Microsoft Office ( Access, Excel, Word )
- Visual Basic 6
- Visual Basic for /NET Assembly
- Visual FoxPro
you can select the split bar in design mode, and specify the objects in the left/top and right/bottom parts of the split bar as in the following screen shot, using the ObjectsLT and ObjectsRB properties:
In
- C++ Builder
- C# for /COM on /NET Framework
- Delphi
- dBASE Plus
- Visual Basic for /COM on /NET Framework
- Visual C++
The following C++ Builder sample shows how to add the objects to the split bar, using the AddObjectLT and AddObjectRB methods:
SplitBar1->AddObjectLT(TVariant(Button1->Handle));
SplitBar1->AddObjectRB(TVariant(Button2->Handle));
SplitBar1->AddObjectRB(TVariant(SplitBar2->DefaultInterface));
SplitBar1->AddObjectRB(TVariant(Button3->Handle));
The following C# sample shows how to add the objects to the split bar, using the AddObjectLT and AddObjectRB methods (/COM on /NET Framework):
axSplitBar1.AddObjectLT(button1);
axSplitBar1.AddObjectRB(button2);
axSplitBar1.AddObjectRB(axSplitBar2);
axSplitBar1.AddObjectRB(button3);
The following Delphi sample shows how to add the objects to the split bar, using the AddObjectLT and AddObjectRB methods:
with SplitBar1 do
begin
AddObjectLT(Button1.Handle);
AddObjectRB(Button2.Handle);
AddObjectRB(SplitBar2.DefaultInterface);
AddObjectRB(Button3.Handle);
end
The following dBASE Plus sample shows how to add the objects to the split bar, using the AddObjectLT and AddObjectRB methods:
this.EXSPLITBARACTIVEXCONTROL1.nativeobject.AddObjectLT(this.PUSHBUTTON1.hwnd)
this.EXSPLITBARACTIVEXCONTROL1.nativeobject.AddObjectRB(this.PUSHBUTTON2.hwnd)
this.EXSPLITBARACTIVEXCONTROL1.nativeobject.AddObjectRB(this.EXSPLITBARACTIVEXCONTROL2.nativeobject.hwnd)
this.EXSPLITBARACTIVEXCONTROL1.nativeobject.AddObjectRB(this.PUSHBUTTON3.hwnd)
Note: If the object you want to add to one side of the split bar does not provide an hwnd property, or its hwnd property returns 0, place the object inside a container and use the container's hwnd property with the AddObjectLT or AddObjectRB methods.
The following VB.NET sample shows how to add the objects to the split bar, using the AddObjectLT and AddObjectRB methods (/COM on /NET Framework):
With AxSplitBar1
.AddObjectLT(Button1)
.AddObjectRB(Button2)
.AddObjectRB(AxSplitBar2)
.AddObjectRB(Button3)
End With
The following Visual C++ sample shows how to add the objects to the split bar, using the AddObjectLT and AddObjectRB methods:
EXSPLITBARLib::ISplitBarPtr spSplitBar1 = GetDlgItem(IDC_SPLITBAR1)->GetControlUnknown();
spSplitBar1->AddObjectLT( (long)::GetDlgItem( m_hWnd, IDC_BUTTON1 ) );
spSplitBar1->AddObjectRB( (long)::GetDlgItem( m_hWnd, IDC_BUTTON2 ) );
spSplitBar1->AddObjectRB( GetDlgItem(IDC_SPLITBAR2)->GetControlUnknown() );
spSplitBar1->AddObjectRB( (long)::GetDlgItem( m_hWnd, IDC_BUTTON3 ) );