Home > Software engineering >  The drop-down combo box, a great god glad
The drop-down combo box, a great god glad

Time:10-10

Design a dialog box, use the drop-down combo box, one of the combo box is a name, a requirement is: when the input custom size and press the Enter key or Enter the name and focus after leaving the combo box, the text frame's size into a defined size. (2) if the input size illegal (less than or equal to 0, empty or non-numeric), kept the original font size, the second request I don't know what to do, please answer this is the code I wrote, the first question to come, is not the second
Private Sub Co4_KeyPress (KeyAscii As Integer) Select Case KeyAsciiCase 1 To Max Case ElseT1. FontSize=10 end SelectIf KeyAscii=13 ThenT1. FontSize=Co4. TextEnd IfEnd Sub

CodePudding user response:

 Option Explicit 
Private Sub Change_Font ()
If IsNumeric (Co4. Text) Then
If Val (Co4) & gt; 0 Then T1. The Font. The Size=Val (Co4)
End the If
End Sub

Private Sub Co4_KeyPress (KeyAscii As Integer)
If KeyAscii=13 Then Change_Font
End Sub

Private Sub Co4_LostFocus ()
Change_Font
End Sub
  • Related