有关spliter的源代码,请有兴趣者指点
小弟学习pb编程时间不长,幸得各路高手不吝相传,无以为报,今日上传近日小弟依pfc之spliter所改之spliter控件,希望大侠们指教!
本程序在pb6.5下测试通过!
--------------------------------------------------------------------------
$PBExportHeader$uo_spliter.sru
forward
global type uo_spliter from statictext
end type
end forward
global type uo_spliter from statictext
int Width=128
int Height=112
boolean FocusRectangle=false
long TextColor=33554432
long BackColor=79741120
int TextSize=-8
int Weight=400
string FaceName="MS Serif"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Roman!
FontPitch FontPitch=Variable!
event mouseup pbm_lbuttonup
event mousedown pbm_lbuttondown
event mousemove pbm_mousemove
event uo_resizebars ( )
event uo_resizepanels ( )
event uo_refreshbars ( )
event uo_pre_open ( boolean ab_spliter, long al_this_height, long al_parent_height, long al_this_width, long al_parent_width, any adrg_vertical1, any adrg_vertical2, window aw_parent )
event uo_pre_resize ( any adrg_vertical1, any adrg_vertical2 )
end type
global uo_spliter uo_spliter
type variables
private:
boolean ib_debug = False
long il_backcolor
public:
boolean ib_spliter = true //spliter方式
//true top_bottom
//false left_right
long il_this_width = 12 //自身宽度
long il_this_height = 12 //自身高度
long il_parent_width //父容器宽度
long il_parent_height //父容器高度
dragobject idrg_Vertical[2]
//idrg_vertical[1]左边容器
//idrg_vertical[2]右边容器
//idrg_vertical[1]上边容器
//idrg_vertical[2]下边容器
window iw_parent //窗口
end variables
event mouseup;If Not ib_debug Then This.BackColor = il_backcolor
event uo_ResizePanels()
end event
event mousedown;If Not ib_debug Then this.BackColor = 0
event uo_ResizePanels()
end event
event mousemove;If KeyDown(keyLeftButton!) Then
if ib_spliter then
This.y = iw_parent.Pointery()
else
This.x = iw_parent.PointerX()
end if
End If
end event
event uo_resizebars;if ib_spliter then
Move(idrg_Vertical[1].x,this.Y)
Resize( idrg_Vertical[1].width,il_this_height)
else
Move(this.x,idrg_Vertical[1].y)
Resize(il_this_width, idrg_Vertical[1].height)
end if
event uo_RefreshBars()
end event
event uo_resizepanels;if ib_spliter then
idrg_Vertical[1].Move (idrg_Vertical[1].x, idrg_Vertical[1].y)
idrg_Vertical[1].Resize (idrg_Vertical[1].width, this.y - idrg_Vertical[1].y)
idrg_Vertical[2].Move (idrg_Vertical[2].x, this.y + il_this_height)
idrg_Vertical[2].Resize (idrg_Vertical[2].width, il_parent_height - idrg_Vertical[1].y - idrg_vertical[1].height - il_this_height)
else
idrg_Vertical[1].Move (idrg_Vertical[1].x, idrg_Vertical[1].y)
idrg_Vertical[1].Resize (this.x - idrg_Vertical[1].X, idrg_Vertical[1].height)
idrg_Vertical[2].Move (this.x + il_this_width, idrg_Vertical[2].y)
idrg_Vertical[2].Resize (il_parent_width - idrg_Vertical[1].X - idrg_vertical[1].width - il_this_width, idrg_Vertical[2].height)
end if
end event
event uo_refreshbars;SetPosition(ToTop!)
if ib_spliter then
Move(idrg_Vertical[1].x,this.Y)
height = il_this_height
width = idrg_vertical[1].width
else
Move(this.x,idrg_Vertical[1].y)
Width = il_this_width
height = idrg_vertical[1].height
end if
end event
event uo_pre_open;ib_spliter = ab_spliter
//if ib_spliter then
// setpointer(sizens!)
//else
// setpointer(sizewe!)
//end if
il_this_height = al_this_height
il_parent_height = al_parent_height
il_this_width = al_this_width
il_parent_width = al_parent_width
iw_parent = aw_parent
idrg_Vertical[1] = adrg_Vertical1
idrg_Vertical[2] = adrg_Vertical2
event uo_ResizeBars()
event uo_ResizePanels()
end event
event uo_pre_resize;idrg_vertical[1] = adrg_vertical1
idrg_vertical[2] = adrg_vertical2
If IsValid(idrg_Vertical[1]) and isvalid(idrg_vertical[2]) Then
event uo_ResizeBars()
event uo_ResizePanels()
End If
end event
event constructor;il_backcolor = this.backcolor
/*使用说明*/
/*windows open*/
//uo_pre_open(spliter_bool,this_height,parent_height,this_width,parent_width,drg_object1,drg_object2,w_parent)
/*windows resize*/
//uo_pre_resize(drgobject1,drgobject2)
/* E_mail: BigMouthZ@163.net DateTime: 2002.07.30 Address: HuBeiWuHan */
end event