TTF1控件的基本操作VB.NET代码
Imports System.Drawing.Drawing2D
Imports Crownwood.DotNetMagic.Menus
Public Class Form_ttfclient
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents af1 As AxTTF160.AxF1Book
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form_ttfclient))
Me.af1 = New AxTTF160.AxF1Book
CType(Me.af1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'af1
'
Me.af1.Dock = System.Windows.Forms.DockStyle.Fill
Me.af1.Location = New System.Drawing.Point(0, 0)
Me.af1.Name = "af1"
Me.af1.OcxState = CType(resources.GetObject("af1.OcxState"), System.Windows.Forms.AxHost.State)
Me.af1.Size = New System.Drawing.Size(520, 273)
Me.af1.TabIndex = 0
'
'Form_ttfclient
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(520, 273)
Me.Controls.Add(Me.af1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "Form_ttfclient"
Me.Text = "操作界面"
CType(Me.af1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub af1_MouseDownEvent(ByVal sender As Object, ByVal e As AxTTF160.DF1Events_MouseDownEvent) Handles af1.MouseDownEvent
If e.button = 2 Then
Dim popup As Crownwood.DotNetMagic.Menus.PopupMenu = New Crownwood.DotNetMagic.Menus.PopupMenu
Dim p0 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("剪切", New EventHandler(AddressOf cutxls))
Dim p1 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("拷贝", New EventHandler(AddressOf copyxls))
Dim p2 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("拷贝格式", New EventHandler(AddressOf copyxls))
Dim p3 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("粘贴", New EventHandler(AddressOf Pastexls))
Dim p4 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("特殊粘贴", New EventHandler(AddressOf specPastexls))
Dim p5 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("-")
Dim p6 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("插入", New EventHandler(AddressOf insertcellxls))
Dim p7 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("删除", New EventHandler(AddressOf delcellxls))
Dim p8 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("清除内容", New EventHandler(AddressOf delconxls))
Dim p9 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("-")
Dim p10 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("格式化单元格", New EventHandler(AddressOf formatCellxls))
Dim p11 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("设置格式化取数公式", New EventHandler(AddressOf cutxls))
Dim p12 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("数据浏览", New EventHandler(AddressOf cutxls))
Dim p13 As Crownwood.DotNetMagic.Menus.MenuCommand = New Crownwood.DotNetMagic.Menus.MenuCommand("sql语句向导", New EventHandler(AddressOf cutxls))
popup.MenuCommands.AddRange(New Crownwood.DotNetMagic.Menus.MenuCommand() {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13})
popup.BackColor = Color.Lavender
popup.HighlightColor = Color.LightGray
popup.MenuCommands.ExtraText = "Ccyt Menu"
popup.MenuCommands.ExtraFont = New Font("Garamond", 12.0F, FontStyle.Bold)
popup.MenuCommands.ExtraBackBrush = New LinearGradientBrush(New Point(0, 0), New Point(100, 100), Color.LightGreen, Color.DarkGreen)
popup.TrackPopup(af1.PointToScreen(New Point(e.x, e.y)))
End If
End Sub
'剪切
Public Sub cutxls(ByVal sender As Object, ByVal e As System.EventArgs)
Try
af1.EditCut()
Catch
End Try
End Sub
'拷贝
Public Sub copyxls(ByVal sender As Object, ByVal e As System.EventArgs)
Try
af1.EditCopy()
Catch
End Try
End Sub
'拷贝
Public Sub Pastexls(ByVal sender As Object, ByVal e As System.EventArgs)
Try
af1.EditPaste()
Catch
End Try
End Sub
'拷贝
Public Sub specPastexls(ByVal sender As Object, ByVal e As System.EventArgs)
Try
af1.PasteSpecialDlg()
Catch
End Try
End Sub
'插入
Public Sub insertcellxls(ByVal sender As Object, ByVal e As System.EventArgs)
Try
af1.InsertDlg()
Catch
End Try
End Sub
'插入
Public Sub delcellxls(ByVal sender As Object, ByVal e As System.EventArgs)
Try
af1.DeleteDlg()
Catch
End Try
End Sub
'删除内容
Public Sub delconxls(ByVal sender As Object, ByVal e As System.EventArgs)
Try
af1.EditClear(TTF160.F1ClearTypeConstants.F1ClearValues)
Catch
End Try
End Sub
'替换
Public Sub formatCellxls(ByVal sender As Object, ByVal e As System.EventArgs)
Try
af1.FormatCellsDlg(TTF160.F1DialogPageConstants.F1AllPages)
Catch
End Try
End Sub
Private Sub Form_ttfclient_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class