photoshop的工具条好像不是子窗体。只不过它采用了一些方法,使其看起来是一起的(类似子窗体)
解决方案 »
- vb做刷访问量~~~~~! 求教!
- VB通信软件轮询4个单片机,高手进来帮忙啊
- 求助各位:如何改变 表单 容纳控件的最大个数
- vb中怎样把参数传给水晶报表
- 求教:winsock控件客户端地址设定问题
- 使用winsock控件后要在多个系统上移植,需要打包哪些文件,有没有版本限制??
- ADODC的怪问题求救!
- 引用DLL问题:DLL已经不存在,但引用里无法删除,而且影响同名DLL但不同版本不同路径的再引用。
- ppt2007 背景纹理填充样式属性PresetTexture,它的值为什么总是-2
- 如何用API实现象VB开发环境中的 Docking ToolBar ?
- 立即参加微软认证的“最有价值专家”评选,赢取价值万元以上的丰富奖品
- 超菜送分题:如何在SCSI硬盘上安装NT?
Begin VB.Form frmMain
Caption = "Floating Toolbar Demo"
ClientHeight = 2535
ClientLeft = 1125
ClientTop = 3345
ClientWidth = 3165
ForeColor = &H80000008&
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 2535
ScaleWidth = 3165
Begin VB.PictureBox Picture1
BackColor = &H80000005&
Height = 1935
Left = 120
ScaleHeight = 1875
ScaleWidth = 2115
TabIndex = 0
Top = 120
Width = 2175
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
Begin VB.Menu mnuView
Caption = "&View"
Begin VB.Menu mnuViewToolbar
Caption = "&Toolbar"
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = FalseOption ExplicitPrivate Sub Form_Load()
Width = Screen.Width * 0.9
Height = Screen.Height * 0.9
Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
g_xToolbarPos = 1000: g_yToolbarPos = 2000
Call mnuViewToolbar_Click
End Sub
Private Sub Form_Resize()
Picture1.Move 0, 0, ScaleWidth, ScaleHeight
End SubPrivate Sub Form_Unload(Cancel As Integer)
If g_bToolbarVisible Then
frmToolbar.UnloadToolbar
End If
End SubPrivate Sub mnuFileExit_Click()
Unload Me
End SubPrivate Sub mnuView_Click()
If g_bToolbarVisible Then
mnuViewToolbar.Checked = True
Else
mnuViewToolbar.Checked = False
End If
End SubPrivate Sub mnuViewToolbar_Click()
If Not g_bToolbarVisible Then
frmToolbar.LoadToolbar Me
Else
frmToolbar.UnloadToolbar
End If
End SubVERSION 5.00
Begin VB.Form frmToolbar
BorderStyle = 4 'Fixed ToolWindow
Caption = "Tools"
ClientHeight = 2535
ClientLeft = 1155
ClientTop = 1770
ClientWidth = 6300
ForeColor = &H00000000&
KeyPreview = -1 'True
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 2535
ScaleWidth = 6300
ShowInTaskbar = 0 'False
End
Attribute VB_Name = "frmToolbar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = FalseOption Explicit'Set values for imgButtons bitmap
Private Const IMAGE_COLS = 15
Private Const IMAGE_ROWS = 2
Private Const STATE_UNSELECTED = 0
Private Const STATE_SELECTED = 1Private m_ImageWidth As Long
Private m_ImageHeight As Long
Private m_xSpacer As Long
Private m_ySpacer As Long'Indicates which tool is currently selected
Private m_nCurrTool As Integer
'Tracks parent form
Private m_frmParent As Form'Windows API declarations
Private Declare Function SetWindowWord Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long) As Long
Private Const SWW_HPARENT = -8
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 LongPrivate Const HWND_TOPMOST = -1Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Sub LoadToolbar(frm As Form)
Set m_frmParent = frm
Show SetWindowWord hwnd, SWW_HPARENT, m_frmParent.hwnd
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
Me.Width = 1000
Me.Height = 5000
End Sub
Public Sub UnloadToolbar()
Unload Me
End SubPrivate Sub Form_Load()
Dim nWidth As Long, nHeight As Long
Width = nWidth + (Width - ScaleWidth)
Height = nHeight + (Height - ScaleHeight)
Left = g_xToolbarPos: Top = g_yToolbarPos
g_bToolbarVisible = True
End SubPrivate Sub Form_Unload(Cancel As Integer)
g_xToolbarPos = Left: g_yToolbarPos = Top
g_bToolbarVisible = False
m_frmParent.SetFocus
End Sub
Module::Option ExplicitPublic g_xToolbarPos As Integer
Public g_yToolbarPos As IntegerPublic g_bToolbarVisible As Boolean
SetWindowWord 是在16位的windows下的
32为应该用setwindowlong
对于setwindowlong 在msdn中有以下叙述
You must not call SetWindowLong with the GWL_HWNDPARENT index to change the parent of a child window. Instead, use the SetParent function.
不过在win2000中用不了,可能真的得用setparent了
setparent 就会出不去了!!!!!!!!!!!!!
什么意思?
难道SetWindowWord 和setparent有区别?
那要是在nt下怎么办,SetWindowWord 不能用了阿
能具体说明一下吗