就是百度里一样,在框里一点会拉出表。
在click事件中处理。
如果可以的话自己写个控件。
正解
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\STDOLE2.TLB#OLE Automation
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Form=Form1.frm
Module=Module1; Module1.bas
Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0; RICHTX32.OCX
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX
IconForm="Form1"
Startup="Form1"
ExeName32="SHAutoComplete.exe"
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="UMC"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
vbp文件
Attribute VB_Name = "Module1"
Public Const SHACF_DEFAULT As Long = &H0
Public Const SHACF_FILESYSTEM As Long = &H1
Public Const SHACF_URLHISTORY As Long = &H2
Public Const SHACF_URLMRU As Long = &H4
Public Const SHACF_USETAB As Long = &H8
Public Const SHACF_FILESYS_ONLY As Long = &H10
Public Const SHACF_AUTOSUGGEST_FORCE_ON As Long = &H10000000
Public Const SHACF_AUTOSUGGEST_FORCE_OFF As Long = &H20000000
Public Const SHACF_AUTOAPPEND_FORCE_ON As Long = &H40000000
Public Const SHACF_AUTOAPPEND_FORCE_OFF As Long = &H80000000
Public Const SHACF_URLALL As Long = (SHACF_URLHISTORY Or SHACF_URLMRU)
Public Declare Function SHAutoComplete Lib "Shlwapi.dll" _
(ByVal hwndEdit As Long, _
ByVal dwFlags As Long) As Long
' Use to check the version of Shlwapi.dll
Public Const DLLVER_PLATFORM_WINDOWS As Long = &H1
Public Const DLLVER_PLATFORM_NT As Long = &H2
Public Type DllVersionInfo
cbSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformID As Long
End Type
Public Declare Function DllGetVersion Lib "Shlwapi.dll" _
(dwVersion As DllVersionInfo) As Long
bas文件
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Auto Complete"
ClientHeight = 3090
ClientLeft = 2295
ClientTop = 2235
ClientWidth = 5160
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3090
ScaleWidth = 5160
Begin VB.CheckBox Check2
Caption = "Auto Complete (Append)"
Height = 375
Left = 180
TabIndex = 3
Top = 2280
Value = 1 'Checked
Width = 2955
End
Begin VB.CheckBox Check1
Caption = "Auto Complete (Suggest)"
Height = 375
Left = 180
TabIndex = 2
Top = 1980
Value = 1 'Checked
Width = 2955
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 4140
Top = 1920
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin RichTextLib.RichTextBox RichTextBox1
Height = 585
Left = 1320
TabIndex = 1
Top = 1200
Width = 3675
_ExtentX = 6482
_ExtentY = 1032
_Version = 393217
Enabled = -1 'True
ScrollBars = 2
TextRTF = $"Form1.frx":0000
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 315
Left = 0
TabIndex = 12
Top = 2775
Width = 5160
_ExtentX = 9102
_ExtentY = 556
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 8599
EndProperty
EndProperty
End
Begin VB.TextBox Text1
Height = 345
IMEMode = 1 'ON
Left = 1320
TabIndex = 0
Top = 780
Width = 3675
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 615
Left = 0
TabIndex = 14
Top = 0
Width = 5160
_ExtentX = 9102
_ExtentY = 1085
ButtonWidth = 609
ButtonHeight = 926
Appearance = 1
_Version = 393216
BorderStyle = 1
Begin VB.ComboBox cboFontSize
Height = 315
ItemData = "Form1.frx":0333
Left = 2100
List = "Form1.frx":0361
Style = 2 'Dropdown List
TabIndex = 5
ToolTipText = "Font Size"
Top = 120
Width = 1110
End
Begin VB.CheckBox chkBold
Height = 320
Left = 3600
Picture = "Form1.frx":039B
Style = 1 'Graphical
TabIndex = 7
ToolTipText = "Bold"
Top = 120
UseMaskColor = -1 'True
Width = 315
End
Begin VB.ComboBox cboFont
Height = 315
Left = 120
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 4
ToolTipText = "Font"
Top = 120
Width = 1935
End
Begin VB.CheckBox chkItalic
Height = 320
Left = 3960
Picture = "Form1.frx":071D
Style = 1 'Graphical
TabIndex = 8
ToolTipText = "Italic"
Top = 120
Width = 315
End
Begin VB.CheckBox chkUnderline
Height = 320
Left = 4320
Picture = "Form1.frx":0A5F
Style = 1 'Graphical
TabIndex = 9
ToolTipText = "Underline"
Top = 120
Width = 315
End
Begin VB.CommandButton cmdColor
Height = 320
Left = 3240
Picture = "Form1.frx":0DA1
Style = 1 'Graphical
TabIndex = 6
ToolTipText = "Font Color"
Top = 120
Width = 315
End
Begin VB.CheckBox chkStrike
Height = 320
Left = 4680
Picture = "Form1.frx":10E3
Style = 1 'Graphical
TabIndex = 10
ToolTipText = "Strike"
Top = 120
Width = 315
End
End
Begin VB.Label Label2
Caption = "Rich Text Box:"
Height = 255
Left = 180
TabIndex = 13
Top = 1320
Width = 1335
End
Begin VB.Label Label1
Caption = "TextBox:"
Height = 255
Left = 180
TabIndex = 11
Top = 840
Width = 615
End
End
form文件第一部分
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim dwVersion As DllVersionInfo
Dim blnOK As Boolean
Private Sub Check1_Click()
If blnOK Then
Call AutoComplete
Else
MsgBox "The function of Auto Complete is not supported by this version of Internet Explorer.", vbExclamation + vbOKOnly
End If
End Sub
Private Sub Check2_Click()
If blnOK Then
Call AutoComplete
Else
MsgBox "The function of Auto Complete is not supported by this version of Internet Explorer.", vbExclamation + vbOKOnly
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim dwFlags As Long
cboFont.Clear
For i = 0 To Screen.FontCount - 1
cboFont.AddItem Screen.Fonts(i)
Next i
cboFont.ListIndex = 0
' No any reason because I like "Verdana"
For i = 0 To cboFont.ListCount - 1
If cboFont.List(i) = "Verdana" Then
cboFont.ListIndex = i
Exit For
End If
Next i
cboFontSize.ListIndex = 0
With RichTextBox1
.SelFontName = cboFont.List(cboFont.ListIndex)
.SelFontSize = cboFontSize.List(cboFontSize.ListIndex)
.SelColor = vbBlack
.SelBold = False
.SelItalic = False
.SelUnderline = False
.SelStrikeThru = False
End With
dwVersion.cbSize = Len(dwVersion)
DllGetVersion dwVersion
StatusBar1.Panels(1).Text = "The version of Internet Explorer: " & _
dwVersion.dwMajorVersion & "." & _
dwVersion.dwMinorVersion & "." & _
dwVersion.dwBuildNumber
If (dwVersion.dwMajorVersion >= 5) Then
blnOK = True
Call AutoComplete
Else
blnOK = False
MsgBox "The function of Auto Complete is not supported by this version of Internet Explorer.", vbExclamation + vbOKOnly
End If
End Sub
Private Sub RichTextBox1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If RichTextBox1.SelBold Then
chkBold.Value = 1 ' vbChecked
Else
chkBold.Value = 0 ' vbUnchecked
End If
If RichTextBox1.SelItalic Then
chkItalic.Value = 1 ' vbChecked
Else
chkItalic.Value = 0 ' vbUnchecked
End If
If RichTextBox1.SelUnderline Then
chkUnderline.Value = 1 ' vbChecked
Else
chkUnderline.Value = 0 ' vbUnchecked
End If
If RichTextBox1.SelStrikeThru Then
chkStrike.Value = 1 ' vbChecked
Else
chkStrike.Value = 0 ' vbUnchecked
End If
End Sub
Private Sub RichTextBox1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
End If
End Sub
Private Sub chkBold_Click()
On Error Resume Next
With RichTextBox1
.SelBold = Not .SelBold
.SetFocus
End With
End Sub
Private Sub chkItalic_Click()
On Error Resume Next
With RichTextBox1
.SelItalic = Not .SelItalic
.SetFocus
End With
End Sub
Private Sub chkStrike_Click()
On Error Resume Next
With RichTextBox1
.SelStrikeThru = Not .SelStrikeThru
.SetFocus
End With
End Sub
Private Sub chkUnderline_Click()
On Error Resume Next
With RichTextBox1
.SelUnderline = Not .SelUnderline
.SetFocus
End With
End Sub
Private Sub cboFont_Click()
On Error Resume Next
With RichTextBox1
.SelFontName = cboFont.List(cboFont.ListIndex)
.SetFocus
End With
End Sub
Private Sub cboFontSize_Click()
On Error Resume Next
With RichTextBox1
.SelFontSize = cboFontSize.List(cboFontSize.ListIndex)
.SetFocus
End With
End Sub
Private Sub cmdColor_Click()
On Error Resume Next
With CommonDialog1
.CancelError = True
.ShowColor
RichTextBox1.SelColor = .Color
RichTextBox1.SetFocus
End With
End Sub
Private Sub AutoComplete()
Dim dwFlags As Long
If Check1.Value Then
dwFlags = SHACF_URLALL Or _
SHACF_FILESYSTEM Or _
SHACF_AUTOSUGGEST_FORCE_ON
If Check2.Value Then
dwFlags = dwFlags Or _
SHACF_AUTOAPPEND_FORCE_ON
Else
dwFlags = dwFlags Or _
SHACF_AUTOAPPEND_FORCE_OFF
End If
Else
dwFlags = SHACF_URLALL Or _
SHACF_FILESYSTEM Or _
SHACF_AUTOSUGGEST_FORCE_OFF
If Check2.Value Then
dwFlags = dwFlags Or _
SHACF_AUTOAPPEND_FORCE_ON
Else
dwFlags = dwFlags Or _
SHACF_AUTOAPPEND_FORCE_OFF
End If
End If
SHAutoComplete Text1.hWnd, dwFlags
SHAutoComplete RichTextBox1.hWnd, dwFlags
End Sub
第二部分
我的想法也跟 1F 一样。
^_^
textbox和listbox这2个控件很简单
+sendmessage
1、创建一个工程,在Form1中添加:TextBox1、List1
2、创建一个数据库,用以存储可能出现的选项
3、在文本框内输入数据时,写文本框的Change事件,当触发该事件时,用文本框的内容对数据库进行模糊查询,将查询结果用以填写List1,实现动态显示。比如,数据库中有:ABC、ADD、DDD,当你输入:A,通过模糊查询会得到:ABC和ADD两个结果,降其填入List1即可。
同意老猫的想法
已知某程序的路径,如何获得其进程id,并用VB结束其进程? 关于算法的思考 关于盘符的问题 怪异的编译问题 怎么把一个表的数据输入另外一个表? hibernate 锁的问题` 继承CEditView的MDI如何以二进制方式打开文件 几道VB题,请各位大侠解答,先谢谢了!!!! 刚领了蜡烛,晚上八点在广场为汶川受灾人民祈福 有哪位高手懂VC++,和C#的,请进 有爱就有希望 关于计算机学习很无聊的问题 求把UNION ALL 的SQL语句改得高效些 怎样修改IE的安全设置从而允许跨域操作 通用模块代码问题 超图的IS .net 2008能否做出我爱我家地图的效果 基于udp可靠传输协议的分析与实现 【帮忙】求个可以代替IsNumeric的正则表达式!在线等结贴! 从一个C++初学者到精通C++能用C++编3D游戏 都要学习哪些书? 用多线程怎样使两个带参数的方法同时运行?如下: 一个跟人民币有关的的程序 求教c语言算法编成难题 Socket 出错提示(WSACancelBlockingCall 的调用中断)如何解决 (100分求解) 如何用ASP显示当前时间,并每秒更新 如何判断存储过程中,一个查询是否有结果,就是说,查询结果是否为空? 如何整合jsp、asp和php服务器 文件上传出错求解 获取datalist控件被选中行的datakeyfield值 跪求达人---比赛安排日程 ,在线等 事关魔兽啊