高分请教:如何做弹出窗体的控件???

ledy 2003-10-09 01:49:03
类似于ComboBox。。。
谢谢!
分不够可以再加。。。
...全文
40 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunliangchao 2003-10-10
  • 打赏
  • 举报
回复
估计你干不了
hc_z 2003-10-10
  • 打赏
  • 举报
回复
学习
LuBingLin 2003-10-09
  • 打赏
  • 举报
回复
该程序有不少知识点,大家好好体会体会,敢定会收获不小。
LuBingLin 2003-10-09
  • 打赏
  • 举报
回复
给你们个参考程序:www.easthot.net 下的"色彩选择ComboBox "
注意该程序有错误,会溢出!
挂掉下面的语句即可。

Private Sub UserControl_Resize()
'Position the constituent controls

Dim BaseHeight As Long
Dim bReDo As Boolean
PicCombo.ScaleMode = vbTwips
UserControl.ScaleMode = vbTwips
BaseHeight = PicCombo.TextHeight("P")
If PicCombo.Appearance = 0 Or PicCombo.BorderStyle = 0 Then
If PicCombo.Height <> BaseHeight + PicCombo.ScaleY(6, vbPixels, vbTwips) Then
PicCombo.Height = BaseHeight + PicCombo.ScaleY(6, vbPixels, vbTwips)
End If
Else
If PicCombo.Height <> BaseHeight + PicCombo.ScaleY(8, vbPixels, vbTwips) Then
PicCombo.Height = BaseHeight + PicCombo.ScaleY(8, vbPixels, vbTwips)
End If
End If
' If Height <> PicCombo.Height Then
' bReDo = True
' End If
Height = PicCombo.Height
PicCombo.Width = UserControl.Width
If UserControl.Width <> 0 Then
picSelection.Move 3, 3, PicCombo.Width - 300, PicCombo.Height - 60
End If

picPopup.Width = UserControl.Extender.Width
DrawComboBtn PicCombo, False, True, True, True
' If bReDo Then
' UserControl_Resize
' End If
End Sub
LuBingLin 2003-10-09
  • 打赏
  • 举报
回复
主要是用到以下API函数:
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long


Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TOOLWINDOW = &H80

我现在还有些问题没能处理,现在不在办公室改天给你们发个源码讨论讨论!!!
大体思路是:
1.改变要下拉的控件的容器
2.去掉状态栏的白框框
3.定位
4.显示与隐藏处理
xfyxq 2003-10-09
  • 打赏
  • 举报
回复
xfyxq@163.net

谢谢~~~
陈年椰子 2003-10-09
  • 打赏
  • 举报
回复
up
踏平扶桑 2003-10-09
  • 打赏
  • 举报
回复
帮楼主up
同时也讨要一份:)
wdw984@126.com
道素 2003-10-09
  • 打赏
  • 举报
回复
比较麻烦
主要要考虑控件弹出的窗体可能超过父窗体,你需要用到一些api,我手头有一个例子,如果需要给我发个消息告诉我mail地址

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧