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

📄 dlgphoto.frm

📁 本系统可用于医院和专业体检中心的健康体检管理
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{0B81E4A9-BE4E-4AEF-9272-33AB5B51C6FC}#1.0#0"; "XPControls.ocx"
Begin VB.Form dlgPhoto 
   BackColor       =   &H80000018&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "图片属性"
   ClientHeight    =   3210
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   5055
   Icon            =   "dlgPhoto.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3210
   ScaleWidth      =   5055
   ShowInTaskbar   =   0   'False
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   0
      Top             =   1365
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.TextBox txtPath 
      Height          =   330
      Left            =   1245
      TabIndex        =   8
      Top             =   465
      Width           =   2475
   End
   Begin VB.TextBox txtHeight 
      Alignment       =   2  'Center
      Height          =   330
      Left            =   1245
      TabIndex        =   6
      Top             =   1590
      Width           =   2475
   End
   Begin VB.TextBox txtWidth 
      Alignment       =   2  'Center
      Height          =   330
      Left            =   1245
      TabIndex        =   5
      Top             =   1027
      Width           =   2475
   End
   Begin XPControls.XPCommandButton cmdSelect 
      Height          =   330
      Left            =   3855
      TabIndex        =   3
      Top             =   465
      Width           =   750
      _ExtentX        =   1323
      _ExtentY        =   582
      Caption         =   "选择..."
      Font            =   "dlgPhoto.frx":0CCA
   End
   Begin XPControls.XPCommandButton cmdCancel 
      Height          =   375
      Left            =   3030
      TabIndex        =   0
      Top             =   2565
      Width           =   975
      _ExtentX        =   1720
      _ExtentY        =   661
      Caption         =   "取消(&C)"
      Font            =   "dlgPhoto.frx":0CF6
   End
   Begin XPControls.XPCommandButton cmdOK 
      Height          =   375
      Left            =   1455
      TabIndex        =   1
      Top             =   2580
      Width           =   975
      _ExtentX        =   1720
      _ExtentY        =   661
      Caption         =   "确定(&O)"
      Font            =   "dlgPhoto.frx":0D22
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "毫米"
      Height          =   195
      Left            =   3780
      TabIndex        =   10
      Top             =   1650
      Width           =   360
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "毫米"
      Height          =   195
      Left            =   3780
      TabIndex        =   9
      Top             =   1095
      Width           =   360
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "高度:"
      Height          =   195
      Left            =   630
      TabIndex        =   7
      Top             =   1658
      Width           =   540
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "宽度:"
      Height          =   195
      Left            =   630
      TabIndex        =   4
      Top             =   1095
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "图片:"
      Height          =   195
      Left            =   630
      TabIndex        =   2
      Top             =   533
      Width           =   540
   End
End
Attribute VB_Name = "dlgPhoto"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim mblnOK As Boolean
Dim mstrRet As String

'被调函数
Public Function GetPhotoProperty(ByVal strProperty As String) As String
    Dim arrProperty
    
    arrProperty = Split(strProperty, "*")
    txtWidth.Text = arrProperty(0)
    txtHeight.Text = arrProperty(1)
    txtPath.Text = arrProperty(2)
    
    Me.Show vbModal
    
    If mblnOK = True Then
        GetPhotoProperty = mstrRet
    End If
End Function


Private Sub cmdCancel_Click()
    mblnOK = False
    Unload Me
End Sub

Private Sub cmdOK_Click()
    '是否输入了图片路径
'    If txtPath.Text = "" Then
'        MsgBox "请选择或输入图片路径!", vbInformation, "提示"
'        txtPath.SetFocus
'        Exit Sub
'    End If
    
    '图片是否存在
    If Dir(txtPath.Text) = "" Then
        MsgBox "您选择的图片不存在,请核对后重新设置,或者清除掉!", vbInformation, "提示"
        txtPath.SetFocus
        Exit Sub
    End If
    
    '输入的宽宽是否合理
    If Val(txtWidth.Text) <= 0 Then
        MsgBox "宽度应该大于零,请重新新输入!", vbInformation, "提示"
        txtWidth.SetFocus
        Exit Sub
    End If
    
    '输入的高度是否合理
    If Val(txtHeight.Text) < 0 Then
        MsgBox "高度应该大于零,请重新新输入!", vbInformation, "提示"
        txtHeight.SetFocus
        Exit Sub
    End If
    
    '校验通过
    mstrRet = txtWidth.Text & "*" & txtHeight.Text & "*" & txtPath.Text
    mblnOK = True
    
    Unload Me
End Sub

Private Sub cmdSelect_Click()
On Error Resume Next
    With CommonDialog1
        .CancelError = True
        .DialogTitle = "选择图片文件"
        .Filter = "位图(*.bmp),GPEG(*.jpg)|*.bmp;*.jpg|GIF图像(*.gif)|*.gif|图标(*.ico)|*.ico"
        .ShowOpen
        If Err.Number = 0 Then
            txtPath.Text = .FileName
        End If
    End With
End Sub

Private Sub txtHeight_KeyPress(KeyAscii As Integer)
    '不是回车和退格键的时候,校验长度和字符
    If (KeyAscii <> vbKeyBack) And (KeyAscii <> vbKeyReturn) Then
        '是否输入了数字或小数点
        If ((KeyAscii < vbKey0) Or (KeyAscii > vbKey9)) And KeyAscii <> 46 Then
            Beep 50, 10
            KeyAscii = 0
        End If
        
        '校验长度
        If Len(txtHeight.Text) >= 5 Then
            MsgBox "您输入的数字太长!", vbInformation, "提示"
            KeyAscii = 0
            Exit Sub
        End If
    End If

    EnterToTab KeyAscii
End Sub

Private Sub txtHeight_LostFocus()
    txtHeight.Text = Val(txtHeight.Text)
End Sub

Private Sub txtWidth_KeyPress(KeyAscii As Integer)
    '不是回车和退格键的时候,校验长度和字符
    If (KeyAscii <> vbKeyBack) And (KeyAscii <> vbKeyReturn) Then
        '是否输入了数字或小数点
        If ((KeyAscii < vbKey0) Or (KeyAscii > vbKey9)) And KeyAscii <> 46 Then
            Beep 50, 10
            KeyAscii = 0
        End If
        
        '校验长度
        If Len(txtWidth.Text) >= 5 Then
            MsgBox "您输入的数字太长!", vbInformation, "提示"
            KeyAscii = 0
            Exit Sub
        End If
    End If

    EnterToTab KeyAscii
End Sub

Private Sub txtWidth_LostFocus()
    txtWidth.Text = Val(txtWidth.Text)
End Sub

⌨️ 快捷键说明

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