- ·上一篇内容:PB8.0应用程序编译发布技术研究
- ·下一篇内容:PB和EAServer共筑多层应用架构
在PB中制作特殊形状数据窗口和按钮
event clicked;//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_handle, ll_data
ws_position lws_pointapi[]
long ll_xpos, ll_ypos, ll_width, ll_height
long ll_xnum, ll_ynum
long ll_x, ll_y, ll_flower = 20
long ll_i, ll_k
ll_xpos = 1
ll_ypos = 1
ll_width = UnitsToPixels(parent.width, xunitstopixels!)
ll_height = UnitsToPixels(parent.height, yunitstopixels!)
ll_xpos = ll_xpos + 5
ll_ypos = ll_ypos + 25 + ll_flower
ll_width = ll_width - 20
ll_width = ll_width - mod(ll_width - ll_xpos, ll_flower)
ll_xnum = (ll_width - ll_xpos) / ll_flower
ll_height = ll_height - 20
ll_height = ll_height - mod(ll_height - ll_ypos, ll_flower)
ll_ynum = (ll_height - ll_ypos) / ll_flower
lws_pointapi[1].xpos = ll_xpos + ll_flower
lws_pointapi[1].ypos = ll_ypos
lws_pointapi[2].xpos = ll_width
lws_pointapi[2].ypos = ll_ypos
lws_pointapi[3].xpos = ll_width
lws_pointapi[3].ypos = ll_height
lws_pointapi[4].xpos = ll_xpos + ll_flower
lws_pointapi[4].ypos = ll_height
ll_handle = CreatePolygonRgn(lws_pointapi[], 4, 1)
for ll_i = 1 to ll_xnum + 1
ll_y = ll_ypos - ll_flower
ll_x = ll_xpos + ll_flower * ( ll_i - 1 )
ll_data = CreateEllipticRgn(ll_x, ll_y, ll_x + ll_flower, ll_y + ll_flower)
CombineRgn(ll_handle, ll_handle, ll_data, 2)
next
for ll_i = 1 to ll_ynum + 1
ll_y = ll_ypos + ll_flower * ( ll_i - 1 )
ll_x = ll_xpos + ll_flower * ll_xnum
ll_data = CreateEllipticRgn(ll_x, ll_y, ll_x + ll_flower, ll_y + ll_flower)
CombineRgn(ll_handle, ll_handle, ll_data, 2)
next
for ll_i = 1 to ll_xnum + 1
ll_y = ll_ypos + ll_flower * ll_ynum
ll_x = ll_xpos + ll_flower * (ll_xnum - ll_i + 1)
ll_data = CreateEllipticRgn(ll_x, ll_y, ll_x + ll_flower, ll_y + ll_flower)
CombineRgn(ll_handle, ll_handle, ll_data, 2)
next
for ll_i = 1 to ll_ynum + 1
ll_y = ll_ypos + ll_flower * (ll_ynum - ll_i + 1)
ll_x = ll_xpos
ll_data = CreateEllipticRgn(ll_x, ll_y, ll_x + ll_flower, ll_y + ll_flower)
CombineRgn(ll_handle, ll_handle, ll_data, 2)
next
SetwindowRgn(handle(parent), ll_handle, true)
end event
type cb_8 from commandbutton within w_button
integer x = 1216
integer y = 628
integer width = 562
integer height = 148
integer taborder = 30
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "圆形窗口"
end type
event clicked;//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_x1, ll_x2, ll_x3
long ll_y1, ll_y2, ll_y3
long ll_handle
long ll_data
ll_data = UnitsToPixels(parent.width, xunitstopixels!)
ll_data = PixelsToUnits(ll_data, ypixelstounits!)
parent.height = ll_data
ll_x1 = 10
ll_y1 = 25
ll_x2 = UnitsToPixels(parent.width, xunitstopixels!) - 10
ll_y2 = UnitsToPixels(parent.height, yunitstopixels!) - 10
ll_handle = CreateEllipticRgn(ll_x1, ll_y1, ll_x2, ll_y2)
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type cb_7 from commandbutton within w_button
integer x = 585
integer y = 940
integer width = 562
integer height = 148
integer taborder = 40
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "波浪花边"
end type
event clicked;long ll_xpos, ll_ypos, ll_width, ll_height
long ll_x, ll_y, ll_flower = 80
long ll_i, ll_k, ll_max = 40, ll_min = 35
long ll_handle
ws_position lws_pointapi[]
ll_xpos = 1
ll_ypos = 1
ll_width = UnitsToPixels(parent.width, xunitstopixels!)
ll_height = UnitsToPixels(parent.height, yunitstopixels!)
ll_k = 1
for ll_i = 1 to ll_flower
if mod(ll_i, 2) = 0 then
ll_y = ll_ypos + ll_max
else
ll_y = ll_ypos + ll_min
end if
ll_x = ll_xpos + ll_width / ll_flower * ll_i
lws_pointapi[ll_k].xpos = ll_x
lws_pointapi[ll_k].ypos = ll_y
ll_k ++
next
for ll_i = 1 to ll_flower
if mod(ll_i, 2) = 0 then
ll_x = ll_width - 5
else
ll_x = ll_width - ll_max + ll_min - 5
end if
ll_y = ll_ypos + ll_height / ll_flower * ll_i + ll_min
lws_pointapi[ll_k].xpos = ll_x
lws_pointapi[ll_k].ypos = ll_y
ll_k ++
next
for ll_i = 1 to ll_flower
if mod(ll_i, 2) = 1 then
ll_y = ll_height - 5
else
ll_y = ll_height - ll_max + ll_min - 5
end if
ll_x = ll_width - ll_width / ll_flower * ll_i - 5
lws_pointapi[ll_k].xpos = ll_x
lws_pointapi[ll_k].ypos = ll_y
ll_k ++
next
for ll_i = 1 to ll_flower
if mod(ll_i, 2) = 1 then
ll_x = ll_xpos + 5
else
ll_x = ll_xpos + ll_max - ll_min + 5
end if
ll_y = ll_height - ll_height / ll_flower * ll_i + ll_min
lws_pointapi[ll_k].xpos = ll_x
lws_pointapi[ll_k].ypos = ll_y
ll_k ++
next
ll_handle = CreatePolygonRgn(lws_pointapi[], upperbound(lws_pointapi), 1)
//其中第 1 个参数为多边形各个顶点坐标值的数组
//其中第 2 个参数为多边形边数,可修改,配合数组值
//其中第 3 个参数为填充模式 ALTERNATE /WINDING
SetwindowRgn(handle(parent), ll_handle, true)
end event
type cb_6 from commandbutton within w_button
integer x = 585
integer y = 784
integer width = 562
integer height = 148
integer taborder = 30
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "八边形窗口"
end type