定义控件实例变量
// Declare Instance Variables
Private:
boolean ib_MouseCaptured
Public:
string is_PicNormal
string is_PicDisabled
string is_PicMouseOver
string is_PicClickDown
int in_State
定义用户事件
// Declare User Events
Event Name=mousemove ID=pbm_mousemove
Event Name=lbuttondown ID=pbm_lbuttondown
Event Name=lbuttonup ID=pbm_lbuttonup
编写事件代码
// Constructor 事件代码
// *** begin constructor event ***
//
is_PicNormal = thisPictureName
is_PicDisabled = Disabled状态图片bmp
is_PicMouseOver = MouseOver状态图片bmp
is_PicClickDown = ClickDown状态图片bmp
in_State =
sb_SuppressHoverBorder = FALSE
//
// *** end constructor event ***
// MouseMove 事件代码
// *** begin mousemove event ***
//
rect lr_Border
if not ib_MouseCaptured then
if flags < > then
thisPictureName = is_PicMouseOver
else
// Left Button Down
thisPictureName = is_PicClickDown
end if
in_State =
SetCapture(handle(this))
ib_MouseCaptured = TRUE
[] [] [] []