专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > PB

窗口上放一个分隔条,随着分隔条的左右移动,左右两边控件的宽度随着变化,PB中怎么实现啊

发布时间:2011-06-29 20:31:30 文章来源:www.iduyao.cn 采编人员:星星草
窗口上放一个分隔条,随着分隔条的左右移动,左右两边控件的宽度随着变化,PB中如何实现啊?
问题如标题,论坛里出现过相关的帖子,但是没看明白。是否可以直接提供源码,万分感谢!!

------解决方案--------------------
[code=C]$PBExportHeader$lht_vo_splitter.sru
$PBExportComments$分割条
forward
global type lht_vo_splitter from uo_statictext
end type
end forward

global type lht_vo_splitter from uo_statictext
integer width = 82
integer height = 240
integer textsize = -8
fontcharset fontcharset = ansi!
fontfamily fontfamily = roman!
string facename = "Times New Roman"
boolean focusrectangle = false
integer i_uid = 0
integer tipicon = 0
boolean havefocusrect = true
rowfocusind tooltiptype = hand!
boolean 透明 = false
event ue_lbuttondown pbm_lbuttondown
event ue_lbuttonup pbm_lbuttonup
event ue_drag ( long oldx,  long oldy )
event ue_rbuttonup pbm_rbuttonup
end type
global lht_vo_splitter lht_vo_splitter

type prototypes
function ulong SetCapture(ulong hwnd)library "user32.dll"
function ulong ReleaseCapture() library "user32.dll"
end prototypes

type variables
long il_distance = 6
boolean ib_live = true

protected:
userobject  iuo_1, iuo_2
boolean ib_vertical = true

boolean mousedown = false
long oldxpos,oldypos

end variables

forward prototypes
public subroutine of_setpointer ()
public subroutine of_setleftright (readonly graphicobject ago_l, readonly graphicobject ago_r)
public subroutine of_setupdown (readonly graphicobject ago_u, readonly graphicobject ago_d)
public subroutine of_resize ()
public subroutine of_resize (integer ai)
public subroutine of_setleftright (readonly graphicobject ago_l, readonly graphicobject ago_r, integer ai)
public subroutine of_setupdown (readonly graphicobject ago_u, readonly graphicobject ago_d, integer ai)
end prototypes

event ue_lbuttondown;ulong hnd
mousedown = true
oldxpos = unitstopixels( xpos, xunitstopixels! )
oldypos = unitstopixels( ypos, yunitstopixels! )
this.bringtotop = true
this.border = false
hnd = handle(this)
SetCapture(hnd)
if not ib_live then
this.backcolor = f_invert_color(this.backcolor)
end if

end event

event ue_lbuttonup;mousedown = false
ReleaseCapture()
if not ib_live then
this.backcolor = f_invert_color(this.backcolor)
this.post event ue_drag( iuo_1.x, iuo_1.y )
//iuo_2.setredraw( false )
if ib_vertical then
iuo_1.width = this.x - iuo_1.x
iuo_2.width = iuo_2.x + iuo_2.width - this.x - this.width
iuo_2.x = this.x + this.width
else
iuo_1.height = this.y - iuo_1.y
iuo_2.height = iuo_2.y + iuo_2.height - this.y - this.height
iuo_2.y = this.y + this.height
end if
iuo_1.triggerevent("ue_aftersize")
//iuo_2.setredraw( true )
end if
end event

event ue_rbuttonup;//
end event

public subroutine of_setpointer ();if isvalid( iuo_1 ) or isvalid( iuo_2 ) then
if ib_vertical then
this.pointer = "SizeWE!"
else
this.pointer = "SizeNS!"
end if
else
this.pointer = "Arrow!"
end if

end subroutine

public subroutine of_setleftright (readonly graphicobject ago_l, readonly graphicobject ago_r);of_setleftright(ago_l, ago_r,  2)
end subroutine

public subroutine of_setupdown (readonly graphicobject ago_u, readonly graphicobject ago_d);of_setupdown(ago_u, ago_d, 2)
end subroutine

public subroutine of_resize ();//默认为以右边或下方的控件为基准
of_resize(2)
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: