Как изменить фон Inputbox - VB
Формулировка задачи:
Всем салам!
Как изменить фон в inputbox?
Решение задачи: «Как изменить фон Inputbox»
textual
Листинг программы
Option Explicit Private Const HH_DISPLAY_TOPIC = &H0 Private Const HH_HELP_CONTEXT = &HF Private HelpFile As String Private Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwndCaller As Long, _ ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long Private lbPrompt As Label Private WithEvents cmdCancel As CommandButton Private WithEvents cmdHelp As CommandButton Private WithEvents cmdOK As CommandButton Private txtInput As TextBox Private Sub cmdCancel_Click() txtInput.Text = "" Me.Hide End Sub Private Sub cmdHelp_Click() On Error Resume Next If Len(Dir(HelpFile)) > 0 Then Call HtmlHelp(Me.hWnd, HelpFile, HH_HELP_CONTEXT, 1) Else Call MsgBox("Unable to display help!", vbExclamation + vbOKOnly, App.Title) End If End Sub Private Sub cmdOK_Click() Me.Hide End Sub Public Function InputBox(ByVal Prompt As String, Optional ByVal Title As String, Optional ByVal Default As String, _ Optional ByVal XPos As Integer, Optional ByVal YPos As Integer, Optional ByVal Help As String, _ Optional ByVal Context As Integer) As String With Me .Caption = IIf(Len(Title) > 0, Title, App.Title) .Left = IIf(XPos > 0, XPos, (Screen.Width - Me.Width) / 2) .Top = IIf(YPos > 0, YPos, (Screen.Height - Me.Height) / 2) End With lbPrompt.Caption = Prompt txtInput.Text = Default If Len(Help) > 0 Then HelpFile = Help cmdHelp.Visible = True End If Me.Show vbModal InputBox = txtInput.Text End Function Private Sub Form_Initialize() With Me .BorderStyle = 3 .Icon = LoadPicture("") .ScaleMode = 3 .Height = 2250 .Width = 5490 End With Set lbPrompt = Controls.Add("VB.Label", "lbPrompt") With lbPrompt .Left = 8 .Top = 8 .Height = 80 .Width = 275 .WordWrap = True .Visible = True End With Set cmdOK = Controls.Add("VB.CommandButton", "cmdOK") With cmdOK .Default = True .Left = 292 .Top = 8 .Height = 23 .Width = 60 .Caption = "OK" .Visible = True End With Set cmdCancel = Controls.Add("VB.CommandButton", "cmdCancel") With cmdCancel .Cancel = True .Left = 292 .Top = 36 .Height = 23 .Width = 60 .Caption = "Cancel" .Visible = True End With Set cmdHelp = Controls.Add("VB.CommandButton", "cmdHelp") With cmdHelp .Left = 292 .Top = 64 .Height = 23 .Width = 60 .Caption = "Help" .Visible = False End With Set txtInput = Controls.Add("VB.TextBox", "txtInput") With txtInput .Left = 7 .Top = 96 .Height = 20 .Width = 344 .Visible = True End With End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = 0 Then Cancel = True Me.Hide End If End Sub
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д