ActiveX
Programmatically Moving\\Docking an Existing Pane Author: Mike Palmatier Posted: April 26, 2008 Environment:Visual Basic 6.0
Downloads:
movepanesample.zip - Source Files with Demo Project [8 KB]
To programmatically dock a pane, you will need to destroy the pane, then create a new pane, using the CreatePane method to specify the new place to dock the pane.
The instance of the attached form\\object still exists after a pane is destroyed. After you re-create the pane in the desired location you will then attach the form\\object that was previously attached to the old pane to the new pane. If you set up the Attach_Pane event properly you should not have to worry about re-attaching the form\\object to the pane.
The sample code below simply shows how to dock an existing pane to the right side of the application. Please download the sample project for the entire source.
'Dock the pane with Id ID_SEARCH_PANE to the right of 'the application
MoveSearchPane ID_SEARCH_PANE, 200, 200, _
DockingDirection.DockRightOf
'subroutine used to dock a pane to the top, bottom, left, or right 'side of an application
Private Sub MoveSearchPane(PANE_TO_MOVE As Integer, nWidth As _ Integer, nHeight As Integer, _
Optional Direction = DockingDirection.DockLeftOf)
Dim Pane As Pane
Dim sTitle As String
Dim iIconId As Integer
'search for a pane with Id PANE_TO_MOVE
Set Pane = DockingPaneManager.FindPane(PANE_TO_MOVE)
'If a pane with Id PANE_TO_MOVE exists save the Title and 'IconId, then destroy it If Not Pane Is Nothing Then
'save Title
sTitle = Pane.Title
'save IconId
iIconId = Pane.IconId
'Destroy Pane with Id PANE_TO_MOVE. '
'NOTE: The instance of the attached form\\object still 'exists and is not deleted, only the pane DockingPaneManager.DestroyPane Pane End If
'Creates new pane docking it in the new location, when the 'attach_pane event is called (which is the first time the 'pane becomes visible) the old form\\object will get attached 'to the new pane
Set Pane = DockingPaneManager.CreatePane(PANE_TO_MOVE, _ nWidth, nHeight, Direction, Nothing)
'Restore Title and IconId Pane.Title = sTitle Pane.IconId = iIconId
End Sub
Changing the Language for a Component
Author: Mike Palmatier Posted: April 28, 2008
Environment:Visual Basic 6.0
Codejock Components allows you to support multiple languages with only a single line of code. Below are the 32 different languages currently supported: Arabic (Saudi Arabia)
Czech
Finnish
Hebrew
Swedish Thai
Portuguese (Portugal)
Chinese (PRC)
Danish
French (France)
Hungarian
Ukrainian
Dutch
Romanian
Chinese (Taiwan)
English (US)
German (Germany)
Italian (Italy)
Slovenian
Spanish
Croatian
Estonian
Greek
Japanese
Slovakian
Russian
South Korean
Latvian
Lithuanian
Norwegian
Polish
Portuguese (Brazil)
Included with each Codejock component is 32 language resource files. This will translate all static strings that the developer can not change such as the text on the commandbars customize dialog. These files are installed to the \folder. All you need to do is set the ResourceFile property of the component to the name of the resource file you want to use. This should be done in the Form_Initialize event. Private Sub Form_Initialize()
CommandBarsGlobalSettings.ResourceFile = \ DockingPaneGlobalSettings.ResourceFile = \ PropertyGridGlobalSettings.ResourceFile = \ ShortcutBarGlobalSettings.ResourceFile = \ End Sub
Overriding the Default Expand Popup Menu Author: Mike Palmatier Posted: April 28, 2008
Environment:Visual Basic 6.0 Downloads:
CustomExpandButton.zip - Source Files with Demo Project [39 KB]
When the expand button is pressed, the default menu only allows the user to \Buttons\not translated as well. You can create your own popup menu to override the default one in the ExpandButtonDown event. This not only allows you to add your own popup menu, but you can translate the text to the current local. This tutorial will show you how to create an expand menu similar to the one seen in Office 2003.
To start, you must set CancelMenu to True in the ExpandButtonDown event: 'The ExpandButtonDown event is fired when the ShortcutBar's 'expand button is clicked.
Private Sub wndShortcutBar_ExpandButtonDown(CancelMenu As Boolean)
'Cancels the default menu that is displayed when the expand button is pressed. 'The default button only displays the \More Buttons\and \Fewer
'Buttons\ CancelMenu = True
Dim Popup As CommandBar
Dim Control As CommandBarControl Dim SubControl As CommandBarControl Dim i As Long
Dim Item As ShortcutBarItem
In this sample we will use the CommandBars to create our expand menu. So we will need to add any icons to the CommandBars Icons collection.
'Add the icons from the ShortcutBar to the Commandbars to 'be used in the commandbar popup that will be created CommandBars.Icons.AddIcons wndShortcutBar.Icons
Then create a Popup Commandbar that will be used as the ShortcutBar's new expand button popup:
'Creates a popup command bar we will use as the 'ShortcutBar's expand button popup menu
Set Popup = CommandBars.Add(\
Now add some buttons to the popup menu. The picture below shows where these buttons will be displayed:
'Adds buttons to the popup command bar, we will add a total 'of 9 commands With Popup
'Adds the \
Set Control = frmMain.AddButton(.Controls, xtpControlButton, _
SHORTCUT_SHOW_MORE, \Buttons\
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库codejock英文教程(5)在线全文阅读。
相关推荐: