想达到几个效果:1,任务拦没有窗体标识
2,最小化时候窗体向右下隐藏,不要向左下跑,当然也不向任务拦跑了!基本上ShowInTaskbar属性不能满足要求!
实际上就是QQ的那个隐藏效果!
2,最小化时候窗体向右下隐藏,不要向左下跑,当然也不向任务拦跑了!基本上ShowInTaskbar属性不能满足要求!
实际上就是QQ的那个隐藏效果!
解决方案 »
- 请教:用vb怎样实现窗体界面中菜单栏与工具栏之间的那条长长的分割线?谢谢。
- vb 如何操作mdb 文件存储图片文件?
- 如何读取目录下的全部文件的文件名???
- 请教文字定位的问题
- 超级简单:关于frame和checkbox
- 我看过很多托盘的例子,但在缩小的时候都有标题栏在桌面左边,怎么彻底去掉
- COM生成GUID的算法,顺便散分国庆放假!!
- 请教高手:如何用日期和时间作为文件名来保存?谢谢(在线等候)
- 寻找可以查看矢量图形的控件,就是工程图用AutoCAD做的(*.dwf)
- 如何在一个PictureBox控件中平铺一张图片
- 过年了,公司也放假了,可以回家了,放200分祝愿大家新年快乐
- 如何向指定程序发送键盘消息?
ShowInTaskbar=False2,
Private Sub Form_Resize()
If Me.WindowState = 1 Then
'放入托盘代码
End If
End SubVB托盘程序详解
http://www.hongen.com/pc/program/apitutor/api0012/api01.htmhttp://community.csdn.net/Expert/topic/3305/3305979.xml?temp=.4436609
ShowInTaskbar=False
这和上面的一样的
2.和QQ一样的最小化效果
用一个按钮实现最小化
在按钮的单击事件里写:
Me.Windowstate=1
Form1.visble=Flase
在下次需要显示窗口的时候在加一句
Form1.visble=Ture
托盘就不用说了,相关的代码很多的,楼上的已经说了不少了
http://search.csdn.net/Expert/topic/703/703062.xml?temp=.1565363
http://search.csdn.net/Expert/topic/1086/1086437.xml?temp=.9213678
1,向左下跑
2,中下跑(任务拦了)
3.右下跑(QQ就是这样)
要的是3的效果!!!!!!!!
to:cso(sjxsoft-天水是我家) form_load 时候就ADD托盘了
to: yuanyeying19506(原野鹰) 你的ShowInTaskbar=False
是让窗体右下最小化,你的 Form1.visble=Flase 是最小化后隐藏,根本达不到QQ那效果
可以用循环来不停地改变窗体的大小(.width .height)和位置(Me.Move X,Y),循环中加上DoEvents
等你代码!!!!!!!
Dim i As Integer
Dim myLeft As Long, mytop As Long
Dim myWidth As Long, myHeight As Long
Dim lstep As Long, tstep As Long, wstep As Long, hstep As Long
myLeft = Me.left
mytop = Me.top
myWidth = Me.Width
myHeight = Me.height
lstep = (Screen.Width - Me.left - 512) \ 32
tstep = (Screen.height - Me.top) \ 32
wstep = (myWidth - 400) \ 32
hstep = (myHeight - 400) \ 32
For i = 1 To 32
myLeft = myLeft + lstep
mytop = mytop + tstep
If myWidth > 400 Then myWidth = myWidth - wstep
If myHeight > 400 Then myHeight = myHeight - hstep
Me.Move myLeft, mytop, myWidth, myHeight
DoEvents
Next
Unload Me
End Sub
Private Sub Form_Load()
prevWndProc = GetWindowLong(Me.hwnd, GWL_WNDPROC)
SetWindowLong Me.hwnd, GWL_WNDPROC, AddressOf WndProc
End SubPrivate Sub Form_Unload(Cancel As Integer)
SetWindowLong Me.hwnd, GWL_WNDPROC, prevWndProc
End Sub
'新建一个模块,添加如下代码:
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPublic Const GWL_WNDPROC = (-4)
Public Const SC_MAXIMIZE = &HF030&
Public Const SC_MINIMIZE = &HF020&
Public Const SC_SIZE = &HF000
Public Const SC_CLOSE = &HF060
Public Const WM_SYSCOMMAND = &H112
Public Const SC_DEFAULT = &HF160
Public Const SC_RESTORE = &HF120&Public prevWndProc As Long '默认窗口程序地址'拦截窗体最小化等消息,做自己的处理
Public Function WndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
On Error GoTo ShowErr If Msg = WM_SYSCOMMAND Then
If wParam = SC_RESTORE Then
'MsgBox "窗体恢复原状!"
ElseIf wParam = SC_MAXIMIZE Then
'MsgBox "窗体最大化!"
ElseIf wParam = SC_MINIMIZE Then
'MsgBox "窗体最小化!"
Call FORM1_MINIMIZE
Else
WndProc = CallWindowProc(prevWndProc, hwnd, Msg, wParam, lParam)
End If
End If
WndProc = CallWindowProc(prevWndProc, hwnd, Msg, wParam, lParam)
Exit Function
ShowErr:
WndProc = CallWindowProc(prevWndProc, hwnd, Msg, wParam, lParam)
End FunctionPublic Sub FORM1_MINIMIZE()
Dim i As Integer
Dim myLeft As Long, mytop As Long
Dim myWidth As Long, myHeight As Long
Dim lstep As Long, tstep As Long, wstep As Long, hstep As Long
myLeft = Form1.left
mytop = Form1.top
myWidth = Form1.Width
myHeight = Form1.height
lstep = (Screen.Width - Form1.left - 512) \ 32
tstep = (Screen.height - Form1.top) \ 32
wstep = (myWidth - 400) \ 32
hstep = (myHeight - 400) \ 32
For i = 1 To 32
myLeft = myLeft + lstep
mytop = mytop + tstep
If myWidth > 400 Then myWidth = myWidth - wstep
If myHeight > 400 Then myHeight = myHeight - hstep
Form1.Move myLeft, mytop, myWidth, myHeight
DoEvents
Next
Unload Form1
End Sub
给分结帖!!!!!!!!!!!!!!!!!!!!!!!!!
大侠们,还有什么办法都拿出来吧,分一定会有的!