本帖最后由 hessen 于 2022-2-9 16:40 编辑
- Imports SpreadsheetGear
- Imports KbInterfaces
- Imports System.Windows.Resources
- Imports System.Windows.Threading
- Imports System.Windows
- Imports System.Windows.Controls
- Imports C1.Silverlight
- Imports C1.Silverlight.C1MessageBoxButton
- Imports C1.Silverlight.C1MessageBoxIcon
- Imports Newtonsoft.Json
- Imports Newtonsoft.Json.Linq
- Imports System.IO
- Imports System.Text
- Imports System.Runtime.InteropServices.Automation
- Namespace ExcelViewVBDotnet
- Public Class StandardInterface '自定义名称
- Implements Interfaces.IExcelWorkBook
- Public Property ActiveWorkbook() As IWorkbook Implements Interfaces.IExcelWorkBook.Workbook
- Dim EV As SpreadsheetGear.Windows.Controls.WorkbookView
- Dim Range As SpreadsheetGear.IRange
- Dim AW As SpreadsheetGear.IWorkbook
- Dim CF As TextBox, VW As Object
- Dim TS As StackPanel
- Public Sub Workbook_Open(OldRoot As Grid, NewRoot As Grid, Excel As SpreadsheetGear.Windows.Controls.WorkbookView) Implements Interfaces.IExcelWorkBook.Workbook_Open
- EV = Excel
- Excel.GetLock()
- AW = Excel.ActiveWorkbook
- Range = AW.ActiveWorksheet.Range
- Excel.ReleaseLock()
- CF = CType(OldRoot.Children(1), TextBox)
- TS = CType(OldRoot.Children(5), StackPanel)
- Dim BT1 As New Button
- BT1.Name = "BT_HT"
- BT1.Content = "生成合同"
- BT1.Margin = New Thickness(0, 2, 0, 2)
- BT1.Padding = New Thickness(13, 3, 13, 3)
- BT1.Style = CType(Application.Current.Resources("ButtonStyle"), Style)
- BT1.Foreground = New SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255))
- 'BT1.Background = New SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 242, 117, 1))
- AddHandler BT1.Click, Sub()
- If MessageBox.Show("是否要生成合同?", "生成合同询问", MessageBoxButton.OKCancel) = MessageBoxResult.OK Then
- Call CreateHt()
- End If
- End Sub
- TS.Children.Insert(16, BT1)
- Dim BT2 As New Button
- BT2.Name = "BT_HideArea"
- BT2.Content = "隐藏区域"
- BT2.Margin = New Thickness(0, 2, 0, 2)
- BT2.Padding = New Thickness(13, 3, 13, 3)
- BT2.Style = CType(Application.Current.Resources("ButtonStyle"), Style)
- BT2.Foreground = New SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255))
- 'BT2.Background = New SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 242, 117, 1))
- AddHandler BT2.Click, Sub()
- ActiveWorkbook.WorkbookSet.GetLock()
- Call HideArea()
- ActiveWorkbook.WorkbookSet.ReleaseLock()
- End Sub
- TS.Children.Insert(17, BT2)
- Dim BT3 As New Button
- BT3.Name = "BT_ViewArea"
- BT3.Content = "显示区域"
- BT3.Margin = New Thickness(0, 2, 0, 2)
- BT3.Padding = New Thickness(13, 3, 13, 3)
- BT3.Style = CType(Application.Current.Resources("ButtonStyle"), Style)
- BT3.Foreground = New SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255))
- 'BT3.Background = New SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 242, 117, 1))
- AddHandler BT3.Click, Sub()
- ActiveWorkbook.WorkbookSet.GetLock()
- Call ViewArea()
- ActiveWorkbook.WorkbookSet.ReleaseLock()
- End Sub
- TS.Children.Insert(18, BT3)
- Dim BT4 As New Button
- BT4.Name = "BT_TransferNo"
- BT4.Content = "生成结算单"
- BT4.Margin = New Thickness(0, 2, 0, 2)
- BT4.Padding = New Thickness(13, 3, 13, 3)
- BT4.Style = CType(Application.Current.Resources("ButtonStyle"), Style)
- BT4.Foreground = New SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255))
- 'BT4.Background = New SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 242, 117, 1))
- AddHandler BT4.Click, Sub()
- CF.Tag = "2,传递流水号"
- CF.Text = "#执行公式" '执行提取公式写入"#执行公式",执行SQL语句写入"#执行SQL"
- End Sub
- TS.Children.Insert(19, BT4)
- '位置:2保存3新增4提交5退回6进度7打印8预览9导出10捕获11上传图片12上传附件13插入行14插多行15删除行16查找17最后
- End Sub '打开时执行事件
复制代码
ButtonStyle 为默认主题色ButtonStyle1 为直角按钮
ButtonStyle2 按钮大小固定
ButtonStyle3 自定义按钮色彩,没有默认色
|
|
hessen