pb窗体中两个数据窗口如何实现左右自由滑动
解决方法:可以在两个数据窗口间添加一个文本控件(st_1),设置其为黑色竖条,并为该添加四个事件,如下
// constructor This.BackColor = Parent.BackColor // mousedown This.SetPosition(ToTop!) //If Not ib_debug Then This.BackColor = 0 // Show Bar in Black while being moved. This.BackColor = 0 // mousemove Integer li_prevposition If KeyDown(keyLeftButton!) Then li_prevposition = This.X IF Parent.PointerX() <= 100 Or Parent.Width - Parent.PointerX() <=200 Then REturn This.X = Parent.PointerX() End If // mouseup Long ll_X1 This.BackColor = Parent.BackColor dw_1.Width = This.X - dw_1.X - ll_X1 dw_2.X = This.X + This.Width + ll_X1 dw_2.Width = Parent.Width - dw_2.X - dw_1.X
同时也需要在窗体事件resize中设置st_1,这样它才能随着窗体大小自动变化
1 // 根据窗体自动调整数据窗口的大小 2 dw_1.Height = newheight - dw_1.y * 2 3 dw_1.Width = newWidth / 2 - dw_1.x 4 5 dw_2.Height = newheight - dw_1.y * 2 6 dw_2.Width = dw_1.Width - dw_1.x 7 8 dw_2.x = newWidth / 2 + dw_1.x 9 10 st_1.x = newWidth / 2 11 st_1.Height = newheight - dw_1.y * 2