ҡդӶ ʵŧ 纺촨շ٨絴͵ ᷹ФѺ

͵Դҷҧ Inbox Ѻ

˹ѡ
-
VB 6/VB.Net
ASP/ASP.Net
Ѻ¤
¹ҹ Flash Movie
ռͺش  
 RSS Feeds
 ǹŴ RSS Reader ...   Download  RSS Reader

Forum - www.g2gnet.com
Webmaster - www.g2gnet.com
Visitors - Session views
 5 6 1 6 1 6 3

7 ѹҤ ..2549
118 Users On-Line.
Visitors - Page views
 8 9 7 3 9 0 6
1 Ҿѹ ..2551

Google   
g2gnet.com
Ҵѡ:  

á ToolBar ARViewer ͧ Active Report 2.0

Category »  VB 6/VB.Net
: Webmaster 23/4/2551 14:24:00
(ҹ : 20030) 
Ѩغѹ ActiveX ӧҹ躹 VB6 Class ҧ㹵С .Net ǹǵͧ¹ٻẺ¡ Run-Time ... ͡¹仡͹ Ǥѹ ѹ֧繼Ѿ͡ й繵ҧͧ繡ѹ Һô ActiveX ( Component) ѹ١ӡѴá˹ Properties ٻẺ Design-Time §ҹ ѧ件֧Ըա (Method) ҨФǺ÷ӧҹҧջԷҾ ... ҹ繡蹡Ѻ ToolBar 㹵Ǣͧ ARViewer Ѻͧ ѹٴ ժҵԵС лҤҢա ... ˻ҳ
 ǹŴ Active Report 2.0 ҡ DataDynamics ... (ó .Net Ҷ֧ Version 3 ǹФѺ)


ӧҹ

ǹŴ Source Code Ѻ MS Visual Basic 6.0 - Service Pack 6
 ǹŴ Visual Basic 6.0 SP5: Run-Time Redistribution Pack
 ǹŴ Microsoft Data Access Object (MDAC) Jet 4.0 Update
 ǹŴ Microsoft Visual Basic Service Pack 6


Option Explicit

Private Sub Form_Load()
    Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
    
    With ARViewSample
        .Zoom = 80   '  % 㹡ʴź Active Report Viewer
        
        ' ͺá (Insert) 价 index = 5
        ' ͵Ƿ 6 ѹ鹹Ѻҡ 0 ФѺ
        .ToolBar.Tools.Insert 5, "ʴ͹" ' ͧ Double Quote "" ѹ Caption ФѺ
        .ToolBar.Tools.Item(5).AddIcon LoadPicture(App.Path & "\Preview.ico")
        '  ˹ ID (Identifier) Ѻ Item  繤ҵŢӹǹẺ Integer  ФѺ
        ' ҡ˹ͧ պҧдѺѡ蹢 繤ҷʧǹҹͧѹͧѺ
        ' ˹ҵ ҡѹӻѹͧͧ͡
        ' ª͹鷴ͺҼҹ () ФѺ ... ͧ
        .ToolBar.Tools(5).ID = 5
        
        
        .ToolBar.Tools.Insert (6), "Export Excel"
        .ToolBar.Tools.Item(6).AddIcon LoadPicture(App.Path & "\Excel.ico")
        ' ˹ ID (Identifier) Ѻ Item 
        .ToolBar.Tools(6).ID = 6
        
        
        '  Item ˹觷شͧӹǹ Item 
        .ToolBar.Tools.Add "駤ͧ"
        ' ҡҡ Item ǡ Ѻӹǹͧ Item  Count
        ' MsgBox .ToolBar.Tools.Count
        ' ҡùѺ Index 㹤 ѡ鹷 0 ФѺ
        ' ͧ٤觹 MsgBox .ToolBar.Tools(0).Caption
        ' ͤ͹ѹ
        .ToolBar.Tools.Item(23).AddIcon LoadPicture(App.Path & "\printer.ico")
        .ToolBar.Tools(23).ID = 7
    End With
End Sub

' ˵ءóԴ鹵͹Ҥ͡ҡ ToolBar  ARViewer
Private Sub ARViewSample_ToolbarClick(ByVal Tool As DDActiveReportsViewer2Ctl.IDDTool)
    ' ҹ IDDTool ѹҡ Help Ѻ

    ' ÷ͺ͹ 2 Ẻ 
    ' 1.  Caption ШӵǢͧ Item
    ' 2.  ID ҡ˹Ѻ Item еͧ

    ' ÷ͺ Caption
    Select Case Tool.Caption
        Case "ʴ͹"
            MsgBox "س ʴ͹", vbOKOnly + vbInformation, "§ҹ"
        Case "Export Excel"
            MsgBox "س Export Excel", vbOKOnly + vbInformation, "§ҹ"
        Case "駤ͧ"
            ' ¡ҹѧ蹡õ駤ͧ ...
            '  AR ѹ¡ API  "硹 - Microsoft" ͧ
            ARViewSample.Printer.SetupDialog
    End Select
    
    '  ͺ¤ ID (Identifier) ҡ˹
    Select Case Tool.ID
        Case 5
            MsgBox "س ʴ͹", vbOKOnly + vbInformation, "§ҹʶҹ"
        Case 6
            MsgBox "س Export Excel", vbOKOnly + vbInformation, "§ҹʶҹ"
        Case 7
            MsgBox "س 駤ͧ", vbOKOnly + vbInformation, "§ҹʶҹ"
    End Select
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    ' ҹͧ˹سѵԢͧ KeyPreview = True ͹ФѺ
    Select Case KeyCode
        Case vbKeyF1: MsgBox "No help now."
        Case vbKeyF10:
                    cmdExit_Click
   End Select
End Sub

Private Sub Form_Resize()
    fraData.Width = Me.ScaleWidth - 30
    fraData.Height = Me.ScaleHeight - fraCommand.Height
    ARViewSample.Move 15, 120, fraData.Width - 60, fraData.Height - 180
    fraCommand.Move 15, fraData.Top + fraData.Height, Me.ScaleWidth - 30
    cmdExit.Move fraCommand.Width - cmdExit.Width - 60
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    ' ҧ§ҹѡ Temporary Դ Դáاѧ
    ' Ҩ֧ͧźҹ¤ Kill ͡令Ѻ ... ͧ
    If Dir$(App.Path & "\*.tmp") <> "" Then
        Kill App.Path & "\*.tmp"
    End If
    End
End Sub

͵ - g2gNet Dot Com
Ţ¹ҳԪ硷͹ԡ 0407314800231
CopyLeft © 2004 - 2099 g2gNet.Com All rights reserved.
Email: [email protected] . 08-6862-6560