另外弹出的form不要用有模式方式
解决方案 »
- 求解!如何获取ListCtrl中的内容?100元手机充值卡以示感谢!
- VB输入格式问题,如何在文本框中显示数字时去除前导“0”
- 光盘刻录问题!!!急!!!!大家帮忙看看
- 一个按钮控件,编译时显示“未找到方法或数据成员”?
- 如何进入另一台计算机。
- API的急问题 高手请进!急 在线等待!
- 在VB中声明SetSockOpt这个API函数的格式是怎样的?急!!
- 请教:VB6的vb6stkit.dll中函数OSfcreateshelllink具体如何使用,高分回报!!!
- datareport 能动态绑定数据源吗?
- 颜色怎麽改?
- 那位仁兄能告诉我:怎样让一个CommandButten得到焦点后能接收enter键(即敲一下回车键产生类似于敲空格键的效果)
- 请问如何用DAO建立一个dbf表,其中一个字段需要限制位数???
请在程序中加个 DoEvents
有Form1 和 Form2'form1
Private Sub Command1_Click()
Form2.Show 0, Form1
form1.enabled=false
'添加你的代码
'不要忘记在使用进度条的时候添加Doevents
unload form2
form1.enabled=true
form1.setfoces
End Sub
Load frmProgress
frmProgress.pProgressStatus = 0
For i = 1 To 10000
frmProgress.pStatusCaption = "Progress" & i
frmProgress.pProgressStatus = Int((i / 10000) * 100)
DoEvents
DoEvents
Next i
Unload frmProgress'进度条窗体代码 frmProgress.frm
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmProgress
BorderStyle = 3 'Fixed Dialog
ClientHeight = 405
ClientLeft = 255
ClientTop = 1410
ClientWidth = 7380
ClipControls = 0 'False
ControlBox = 0 'False
Icon = "frmProgress.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 405
ScaleWidth = 7380
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSComctlLib.ProgressBar pbrStatus
Height = 405
Left = 2880
TabIndex = 0
Top = 0
Width = 4500
_ExtentX = 7938
_ExtentY = 714
_Version = 393216
Appearance = 0
Scrolling = 1
End
Begin MSComctlLib.StatusBar sbrStatus
Align = 2 'Align Bottom
Height = 420
Left = 0
TabIndex = 1
Top = -15
Width = 7380
_ExtentX = 13018
_ExtentY = 741
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 2
Object.Width = 5027
MinWidth = 5027
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Attribute VB_Name = "frmProgress"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_SHOWSPLASH = (SWP_NOACTIVATE Or SWP_NOMOVE Or SWP_NOSIZE)
Private Const HWND_TOPMOST = -1Public Property Get pProgressStatus() As Long
On Error Resume Next
pProgressStatus = pbrStatus.Value
End PropertyPublic Property Let pProgressStatus(vData As Long)
On Error Resume Next
If vData >= 0 And vData <= 100 Then
pbrStatus.Value = vData
End If
End PropertyPublic Property Let pStatusCaption(vData As String)
On Error Resume Next
sbrStatus.Panels(1).Text = vData
End PropertyPrivate Sub Form_Load()
Me.Show
Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWSPLASH)
End Sub
Can't show non-modal form when modal form is displayed另外谁能解释一下DoEnvens吗?
模式窗口: frm.show ,1
非模式窗口 frm.show ,0
將程序控制權釋放給系統,讓系統先完成任務序列中的其他指令
Can't show non-modal form when modal form is displayed另外谁能解释一下DoEnvens吗?
报这个错误的原因是打开Form2的那个窗口(暂且叫他Form1)是作为由模式窗口打开的.
show form1 1 -> show form1
如果要讓它在上方可以這樣做
Private Sub Form_Deactivate()
me.SetFocus
End Sub