⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flexgridinput.frm

📁 适合乡镇供电所使用电费处理系统v3 软件
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form FlexGridInput 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "输入资料"
   ClientHeight    =   4980
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5295
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   4980
   ScaleWidth      =   5295
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Caption         =   "展示区"
      Height          =   4830
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5100
      Begin MSComctlLib.ImageList ImageList1 
         Left            =   3255
         Top             =   3795
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         ImageWidth      =   16
         ImageHeight     =   16
         MaskColor       =   12632256
         _Version        =   393216
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
            NumListImages   =   2
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "FlexGridInput.frx":0000
               Key             =   "Elec"
            EndProperty
            BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "FlexGridInput.frx":031A
               Key             =   "eleca"
            EndProperty
         EndProperty
      End
      Begin MSComctlLib.ImageCombo Combo1 
         Height          =   315
         Left            =   2625
         TabIndex        =   10
         Top             =   1950
         Width           =   2145
         _ExtentX        =   3784
         _ExtentY        =   556
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         Locked          =   -1  'True
         Text            =   "ImageCombo1"
      End
      Begin VB.CommandButton Command1 
         Caption         =   ".."
         Height          =   270
         Left            =   2535
         TabIndex        =   9
         Top             =   2730
         Width           =   315
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   720
         TabIndex        =   8
         Text            =   "Combo2"
         Top             =   2700
         Width           =   1740
      End
      Begin VB.TextBox Text4 
         Height          =   345
         Left            =   720
         TabIndex        =   7
         Text            =   "Text4"
         Top             =   3645
         Width           =   1800
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   720
         TabIndex        =   6
         Text            =   "Text3"
         Top             =   3105
         Width           =   1755
      End
      Begin VB.TextBox Text2 
         Height          =   315
         Left            =   705
         TabIndex        =   5
         Text            =   "Text2"
         Top             =   2700
         Width           =   1740
      End
      Begin VB.ComboBox Combo11 
         Height          =   300
         Left            =   2640
         TabIndex        =   3
         Text            =   "Combo1"
         Top             =   960
         Visible         =   0   'False
         Width           =   2055
      End
      Begin VB.TextBox Text1 
         Height          =   300
         Left            =   120
         TabIndex        =   2
         Text            =   "Text1"
         Top             =   960
         Visible         =   0   'False
         Width           =   2055
      End
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
         Height          =   1500
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   4665
         _ExtentX        =   8229
         _ExtentY        =   2646
         _Version        =   393216
         AllowBigSelection=   0   'False
         HighLight       =   0
         AllowUserResizing=   1
         BorderStyle     =   0
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Label1"
         Height          =   180
         Left            =   120
         TabIndex        =   4
         Top             =   1920
         Width           =   480
      End
   End
End
Attribute VB_Name = "FlexGridInput"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Combo1_KeyPress(KeyAscii As Integer)
Dim I As Integer, bSame As Boolean
If KeyAscii = vbKeyEscape Then
    Combo1.Visible = False
    MSFlexGrid1.SetFocus
    Exit Sub
End If
If KeyAscii = vbKeyReturn Then
    Dim Item As ComboItem
    Set Item = Combo1.SelectedItem

    If Not (Item Is Nothing) Then
        MSFlexGrid1.Text = Item.Text
    End If
    Combo1.Visible = False
    MSFlexGrid1.SetFocus
'    With Combo1
'        bSame = False
'        For I = 0 To .ListCount
'            If .Text = .List(I) Then bSame = True
'        Next I
'        If Not bSame Then .AddItem .Text
'    End With
End If
End Sub

Private Sub Combo1_LostFocus()
Combo1.Visible = False
MSFlexGrid1.SetFocus
End Sub

Private Sub Command1_Click()
   Combo2.Visible = True
End Sub

Private Sub Form_Load()
Dim I As Integer
With MSFlexGrid1
    .Cols = 5
    .Rows = 5
    For I = 0 To 4
        .RowHeight(I) = 300
    Next I
End With
'For I = 1 To 10
'    Combo1.AddItem I
'Next I
Label1.Caption = "在第一、二行中,双击左键,会出现一文字框(TextBox)..." & vbCr & _
                 "而第三、四行,会出现选择类表单(ComboBox)..." & vbCr & _
                 "输入完毕后按下Enter键,资料即可保留于MSFlexGrid中," & vbCr & _
                 "而按下Esc键则取消输入..."
                 
Combo2.Visible = False
Combo1.Visible = False
    Set Combo1.ImageList = ImageList1
    
    With Combo1.ComboItems
        .Add , , "1101 照明用电 0.98", "Elec"   ', "Openfold"
        .Add , , "01 第一价区 0.88", "eleca", , 1
        .Add , , "02 第二价区 0.68", "eleca", , 1
        .Add , , "03 第三价区 0.78", "eleca", , 1
        '.Add , , "第11章 Windows 通用控件(二)", "Folder", "Openfold"
        '.Add , , "11-1 ListView控件", "Note", , 1
        '.Add , , "11-2 TreeView控件", "Note", , 1
    End With
    
    Set Combo1.SelectedItem = Combo1.ComboItems(1)

End Sub


Private Sub MSFlexGrid1_dblClick()
Dim c As Integer, r As Integer
With MSFlexGrid1
    c = .Col: r = .Row
    If c <= 2 Then
        Text1.Left = .Left + .ColPos(c)
        Text1.Top = .Top + .RowPos(r)
        Text1.Width = .ColWidth(c)
        Text1.Height = .RowHeight(r)
        Text1 = .Text
        Text1.Visible = True
        Text1.SetFocus
    Else
        Combo1.Left = .Left + .ColPos(c)
        Combo1.Top = .Top + .RowPos(r)
        Combo1.Width = .ColWidth(c)
        Combo1.Text = .Text
        Combo1.Visible = True
        Combo1.SetFocus
    End If
End With
End Sub

Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
    Call MSFlexGrid1_dblClick
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then
    Text1.Visible = False
    MSFlexGrid1.SetFocus
    Exit Sub
End If
If KeyAscii = vbKeyReturn Then
    MSFlexGrid1.Text = Text1.Text
    Text1.Visible = False
    MSFlexGrid1.SetFocus
End If
End Sub

Private Sub Text1_LostFocus()
Text1.Visible = False
MSFlexGrid1.SetFocus
End Sub

Private Sub Text3_GotFocus()
   Command1.Top = Text3.Top
 '  Command1.Left = 2535    'Text3.Left   ' + Command1.Left
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -