VB中的一般控件可以用gdi32.dll的CreateEllipticRgn,或CreatePolygonRgn等,和user32.dll的SetWindowRgn两个函数实现非矩形化。如,生成菱形窗体(控件道理是一样的),代码如下:
hy = Me.Height \ (2 * Screen.TwipsPerPixelY)
hx = Me.Width \ (2 * Screen.TwipsPerPixelX)
ap(0).x = 0: ap(0).y = hy
ap(1).x = hx: ap(1).y = 0
ap(2).x = Me.Width \ Screen.TwipsPerPixelX: ap(2).y = hy
ap(3).x = hx: ap(3).y = Me.Height \ Screen.TwipsPerPixelY
ap(4) = ap(0)
reRgn = CreatePolygonRgn(ap(0), 3, 1)
SetWindowRgn Me.hWnd, reRgn, True可是ActiveX的hWnd却不能直接获得,上网查了很多资料也没解决,我该怎么办?在ActiveX控件设计形式下的Form_Load和UserControl_Initialize中加入相应代码,也是不成功。