标题:求教高手 :关于改变ComboBox控件下拉列表长度的Bug
取消只看楼主
treea
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-3-11
 问题点数:0 回复次数:1 
求教高手 :关于改变ComboBox控件下拉列表长度的Bug
代码:
Option Explicit
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
    ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Public Sub SizeCombo(CBobj As ComboBox, ByVal newHeight As Long)
    Dim cLeft As Long
    Dim cTops As Long
    Dim cWidths As Long
    Dim oldMode As Long   
    oldMode = CBobj.Parent.ScaleMode
    CBobj.Parent.ScaleMode = vbPixels   
    cLeft = CBobj.Left
    cTops = CBobj.Top
    cWidths = CBobj.Width   
    CBobj.Parent.ScaleMode = oldMode
    MoveWindow CBobj.hwnd, cLeft, cTops, cWidths, newHeight, 1
End Sub

程序应用在主界面上没有问题,如图:


但一旦置入其它的控件中,如:SSTab、Frame、PictureBox等控件中,执行程序后,就会不能在原位置显示,如图:



已经想过很多办法,都没法解决,请教高手不吝赐教,先行感谢!
搜索更多相关主题的帖子: ComboBox 控件 ByVal Long Dim 
2019-06-03 23:42
treea
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-3-11
得分:0 
经过测试无问题,谢谢楼上的指点

2019-06-04 12:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-495084-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.305139 second(s), 11 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved