|
xinbao :你要的源代码!
Option Compare Database
Public ICO
Private Sub cmdICO_Click()
If ICO = 1 Then
intX = AddAppProperty("AppIcon", DB_Text, CurrentProject.Path & "\FStar.ico")
Application.RefreshTitleBar '//设置程序的标题,图标
ICO = 0
Else
intX = AddAppProperty("AppIcon", DB_Text, CurrentProject.Path & "\MSN.ico")
Application.RefreshTitleBar '//设置程序的标题,图标
ICO = 1
End If
End Sub
Private Sub cmdPic_Click()
If Me.Picture = CurrentProject.Path & "\a.jpg" Then
Me.Picture = CurrentProject.Path & "\b.jpg"
Else
Me.Picture = CurrentProject.Path & "\a.jpg"
End If
End Sub
Private Sub Form_Close()
Access.SetOption "Show Status Bar", True
End Sub
Private Sub Form_Load()
Dim I, J As Integer
ICO = 1
intX = AddAppProperty("AppTitle", DB_Text, "修改背景和应用程序图标的例子")
intX = AddAppProperty("AppIcon", DB_Text, CurrentProject.Path & "\MSN.ico")
Application.RefreshTitleBar '//设置程序的标题,图标
Me.Picture = CurrentProject.Path & "\b.jpg"
Access.SetOption "Show Status Bar", False
' DoCmd.RunCommand acCmdAppMaximize
DoCmd.Maximize
I = Me.WindowWidth
J = Me.WindowHeight
DoCmd.Restore
DoCmd.MoveSize 0, 0, I, J
End Sub
Option Compare Database
Option Explicit
Const DB_Text As Long = 10
Function AddAppProperty(strName As String, varType As Variant, varValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo AddProp_Err
dbs.Properties(strName) = varValue
AddAppProperty = True
AddProp_Bye:
Exit Function
AddProp_Err:
If Err = conPropNotFoundError Then
Set prp = dbs.CreateProperty(strName, varType, varValue)
dbs.Properties.Append prp
Resume
Else
AddAppProperty = False
Resume AddProp_Bye
End If
End Function
作的很好!!是个典型的例子!值得学习!!
|
|