用VB实现带图片的XP风格的按钮控件
虽然在VB里实现XP风格很简单,但是要使用XP风格同时又让按钮显示图片,则实现起来要麻烦一些,为此,我写了一个控件来实现前述功能,同时让读者可以从中了解XP主题界面的绘制过程。
使用办法很简单,在VB里新建一个工程,然后添加一个控件模块,粘贴以下代码,再将控件放置到窗口即可,当然,可别忘设置图片和文字属性,具体代码如下:
'* ************************************************** *
'* 模块名称:CommandButtonEx.ctl
'* 模块功能:带图片的XP风格的按钮控件
'* 编码:lyserver
'* 联系方式:http://blog.csdn.net/lyserver
'* ************************************************** *
Option Explicit
'----------------------------------------------------
'API声明
'----------------------------------------------------
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type SIZE
cx As Long
cy As Long
End Type
Private Enum THEMESIZE
TS_MIN '// minimum size
TS_TRUE '// size without stretching
TS_DRAW '// size that theme mgr will use to draw part
End Enum
Private Declare Function OpenThemeData Lib "uxtheme.dll" (ByVal hwnd As Long, ByVal pszClassList As Long) As Long
Private Declare Function CloseThemeData Lib "uxtheme.dll" (ByVal hTheme As Long) As Long
Private Declare Function DrawThemeBackground Lib "uxtheme.dll" (ByVal hTheme As Long, ByVal lHDC As Long, ByVal iPartId As Long, ByVal nStateId As Long, pRect As RECT, pClipRect As RECT) As Long
Private Declare Function DrawThemeParentBackground Lib "uxtheme.dll" (ByVal hwnd As Long, ByVal hdc As Long, prc As RECT) As Long
Private Declare Function GetThemePartSize Lib "uxtheme.dll" (ByVal hTheme As Long, ByVal hdc As Long, ByVal iPartId As Long, ByVal nStateId As Long, prc As RECT, ByVal eSize As Long, psz As SIZE) As Long
Private Declare Function GetThemeBackgroundContentRect Lib "uxtheme.dll" (ByVal hTheme As Long, By
相关文档:
在工程中添加一个类模块,名为 Selection
然后加入以下代码:
Dim colRows As Collection
Dim ControlKey As Boolean
Public WithEvents flx As M ......
VB 注释程序代码的符号是 ',只要在某行程序前面加上该符号就可以注释该行程序。但如果程序代码语句很多的时候,一行一行地注释就非常不方便。其实 VB
本身提供了一次性注释多条语句的功能:在主菜单“视图”选项的“工具栏”下,选中“编辑”,VB
的界面会出现一排工具按钮,其中就有用 ......
Dim p(10000, 1) As Double
Dim num As Integer
Dim ptx As Single
Dim pty As Single
Dim w0, w1, w2, w3 As Single
Private Sub Command1_Click()
Dim t As Single
Dim i As Integer
Dim f0, f1, f2, f3 As Single
Picture1.DrawWidth = 3
For t = 0 To 1 St ......
http://topic.csdn.net/t/20060401/19/4656391.html
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function SetPriorityClass Lib "kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long
Const IDLE_PRIORITY_CLASS = &H40 '新进程应该有非常低的 ......
访问远程数据库的情况有以下几种:
1)访问远程数据库的access数据库
2)访问远程mssql数据库或oracle等其他关系数据库,但是数据库通信端口被防火墙阻挡或其他网络原因造成无法使用该端口
本文仅在windows2000 advance server,mdac2.8下测试通过,其余条件不保证能正常运行
在mdac的Service Providers中包括Microsoft ......