flash模拟器调全屏
在研究透明形式时,我遇到了一个非常简单的解决方案,以解决Access中严重缺乏的“在全屏模式下运行”功能,该功能改编自MSDN文章,网址为
具有透明背景的模态对话框(MSDN)如果您只希望纯色填充整个屏幕,请使用该颜色的明细创建一个表格并设置:
-Scroolbars =都不
-记录选择器=否
-导航按钮=否
-分界线=否
-自动调整大小=否
-自动居中=是
-弹出=是
-模态=否
-边框样式=无
如果您想要一张照片,则需要制作不同尺寸的表格以填写不同的分辨率并打开相关表格。
在表单的VBA中输入
Private Sub Form_Resize()
Me.Painting = False
DoCmd.Maximize
Me.Painting = True
End Sub
在打开数据库的表单上,在“加载时”输入:
With DoCmd
.Echo False
.OpenForm <FormName>
.Echo True
End With
然后在关闭时输入:
If (CurrentProject.AllForms(<Form Name>).IsLoaded) Then
DoCmd.Close acForm, <Form Name>
End If
这将填满整个屏幕背景,并提供将其他表单设置为“弹出”的功能,并且它将保持这种状态。
如果您想使其透明以使错误或登录等变暗,请添加一个模块:
Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "User32" _
(ByVal hWnd As Long, _
ByVal crKey As Long, _
ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long
Private Const LWA_ALPHA As Long = &H2
Private Const GWL_EXSTYLE As Long = -20
Private Const WS_EX_LAYERED As Long = &H80000
Public Sub SetFormOpacity(frm As Form, sngOpacity As Single)
Dim lngStyle As Long
' get the current window style, then set transparency
lngStyle = GetWindowLong(frm.hWnd, GWL_EXSTYLE)
SetWindowLong frm.hWnd, GWL_EXSTYLE, lngStyle Or WS_EX_LAYERED
SetLayeredWindowAttributes frm.hWnd, 0, (sngOpacity * 255), LWA_ALPHA
End Sub
并将背景表单上的resize子栏更改为:
Private Sub Form_Resize()
Me.Painting = False
DoCmd.Maximize
SetFormOpacity Me, 0.7
Me.Painting = True
End Sub
当与多个变暗的“阶段”结合使用时,窗体在打开和关闭时可以有效地淡入和淡出,而在失去焦点时可以变得稍微透明。
注意:要实现平滑的淡入淡出,您需要删除所有Me.Painting =属性。
当窗体没有边框时,这可以创建一个很好的浮动窗体效果。
翻译自: https://bytes.com/topic/access/insights/886318-simulate-full-screen-dim-background
flash模拟器调全屏