如何在PB中制作特殊形状数据窗口或按钮
【打印文章】
作者:LZP_LRP
以下是全部源码,感兴趣的朋友可以整个窗口的源代码导入到PBL里自己运行一下试试。
$PBExportHeader$w_button.srw
forward
global type w_button from window
end type
type cb_11 from commandbutton within w_button
end type
type cb_10 from commandbutton within w_button
end type
type em_3 from editmask within w_button
end type
type em_2 from editmask within w_button
end type
type em_1 from editmask within w_button
end type
type cb_9 from commandbutton within w_button
end type
type cb_8 from commandbutton within w_button
end type
type cb_7 from commandbutton within w_button
end type
type cb_6 from commandbutton within w_button
end type
type cb_5 from commandbutton within w_button
end type
type cb_4 from commandbutton within w_button
end type
type cb_3 from commandbutton within w_button
end type
type cb_2 from commandbutton within w_button
end type
type cb_1 from commandbutton within w_button
end type
type st_1 from statictext within w_button
end type
type ws_position from structure within w_button
end type
end forward
type ws_position from structure
long xpos
long ypos
end type
global type w_button from window
integer width = 2400
integer height = 1800
boolean titlebar = true
string title = "特殊形状数据窗口演示"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
long backcolor = 17725690
string icon = "AppIcon!"
boolean center = true
cb_11 cb_11
cb_10 cb_10
em_3 em_3
em_2 em_2
em_1 em_1
cb_9 cb_9
cb_8 cb_8
cb_7 cb_7
cb_6 cb_6
cb_5 cb_5
cb_4 cb_4
cb_3 cb_3
cb_2 cb_2
cb_1 cb_1
st_1 st_1
end type
global w_button w_button
type prototypes
FUNCTION ulong CreateRoundRectRgn(Long x1, Long y1, Long x2, Long y2, Long x3, Long y3) library "gdi32"
FUNCTION ulong CreatePolygonRgn (ref ws_position lppt[], int cPoints, int fnPolyFillMode ) Library "gdi32"
FUNCTION ulong CreateEllipticRgn( Long x1, Long y1, Long x2, Long y2) library "gdi32"
FUNCTION ulong SetWindowRgn(ulong hWnd,ulong hRgn,boolean bRedraw) LIBRARY "user32"
FUNCTION ulong CombineRgn(Long hDestRgn, Long hSrcRgn1, Long hSrcRgn2, Long nCombineMode ) LIBRARY "gdi32"
Function Long SetParent( Long hWndChild, Long hWndNewParent) library "user32"
Subroutine keybd_event(long bVk, long bScan, long dwFlags, long dwExtraInfo) LIBRARY "user32.dll"
end prototypes
forward prototypes
public function integer of_set_oval (commandbutton acb_button)
public function integer wf_set_color ()
end prototypes
public function integer of_set_oval (commandbutton acb_button);//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_x1, ll_x2, ll_x3
long ll_y1, ll_y2, ll_y3
long ll_handle
ll_x1 = 1
ll_y1 = 1
ll_x2 = UnitsToPixels(acb_button.width, xunitstopixels!)
ll_y2 = UnitsToPixels(acb_button.height, yunitstopixels!)
ll_x3 = 64
ll_y3 = 64
ll_handle = CreateRoundRectRgn(ll_x1, ll_y1, ll_x2, ll_y2, ll_x3, ll_y3)
SetwindowRgn(handle(acb_button), ll_handle, true)
return 1
end function
public function integer wf_set_color ();long ll_red, ll_green, ll_blue
long ll_data
ll_red = long(em_1.text)
ll_green = long(em_2.text)
ll_blue = long(em_3.text)
ll_data = rgb(ll_red, ll_green, ll_blue)
this.backcolor = ll_data
em_1.backcolor = ll_data
em_2.backcolor = ll_data
em_3.backcolor = ll_data
st_1.backcolor = ll_data
return 1
end function
on w_button.create
this.cb_11=create cb_11
this.cb_10=create cb_10
this.em_3=create em_3
this.em_2=create em_2
this.em_1=create em_1
this.cb_9=create cb_9
this.cb_8=create cb_8
this.cb_7=create cb_7
this.cb_6=create cb_6
this.cb_5=create cb_5
this.cb_4=create cb_4
this.cb_3=create cb_3
this.cb_2=create cb_2
this.cb_1=create cb_1
this.st_1=create st_1
this.Control[]={this.cb_11,&
this.cb_10,&
this.em_3,&
this.em_2,&
this.em_1,&
this.cb_9,&
this.cb_8,&
this.cb_7,&
this.cb_6,&
this.cb_5,&
this.cb_4,&
this.cb_3,&
this.cb_2,&
this.cb_1,&
this.st_1}
end on
on w_button.destroy
destroy(this.cb_11)
destroy(this.cb_10)
destroy(this.em_3)
destroy(this.em_2)
destroy(this.em_1)
destroy(this.cb_9)
destroy(this.cb_8)
destroy(this.cb_7)
destroy(this.cb_6)
destroy(this.cb_5)
destroy(this.cb_4)
destroy(this.cb_3)
destroy(this.cb_2)
destroy(this.cb_1)
destroy(this.st_1)
end on
event mousemove;Send(handle(this), 274, 61458, 0)
end event
type cb_11 from commandbutton within w_button
integer x = 1216
integer y = 1096
integer width = 562
integer height = 148
integer taborder = 70
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "半圆形花边"
end type
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 / 2
lws_pointapi[1].ypos = ll_ypos - ll_flower / 2
lws_pointapi[2].xpos = ll_width + ll_flower / 2
lws_pointapi[2].ypos = ll_ypos - ll_flower / 2
lws_pointapi[3].xpos = ll_width + ll_flower / 2
lws_pointapi[3].ypos = ll_height + ll_flower /2
lws_pointapi[4].xpos = ll_xpos + ll_flower - ll_flower / 2
lws_pointapi[4].ypos = ll_height + ll_flower/2
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_10 from commandbutton within w_button
integer x = 1216
integer y = 1096
integer width = 562
integer height = 148
integer taborder = 60
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "关闭窗口"
end type
event clicked;close(parent)
end event
type em_3 from editmask within w_button
event editchanged pbm_enchange
integer x = 1289
integer y = 104
integer width = 251
integer height = 92
integer taborder = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 17725690
string text = "14"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "###"
boolean autoskip = true
boolean spin = true
double increment = 5
string minmax = "0~~255"
end type
event editchanged;wf_set_color()
end event
type em_2 from editmask within w_button
event editchanged pbm_enchange
integer x = 1024
integer y = 104
integer width = 251
integer height = 92
integer taborder = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 17725690
string text = "120"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "###"
boolean autoskip = true
boolean spin = true
double increment = 5
string minmax = "0~~255"
end type
event editchanged;wf_set_color()
end event
type em_1 from editmask within w_button
event editchanged pbm_enchange
integer x = 759
integer y = 104
integer width = 251
integer height = 92
integer taborder = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 17725690
string text = "250"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "###"
boolean autoskip = true
boolean spin = true
double increment = 5
string minmax = "0~~255"
end type
event editchanged;wf_set_color()
end event
type cb_9 from commandbutton within w_button
integer x = 590
integer y = 1096
integer width = 562
integer height = 148
integer taborder = 50
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "圆形花边"
end type
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
event clicked;//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_handle
ws_position lws_pointapi[]
// 图形2
int li_xpos, li_ypos, li_width, li_height
li_xpos = 12
li_ypos = 1
li_width = UnitsToPixels(parent.width, xunitstopixels!) - 32
li_height = UnitsToPixels(parent.height, yunitstopixels!) - 32
lws_pointapi[1].xpos = li_xpos
lws_pointapi[1].ypos = li_ypos + li_height / 3
lws_pointapi[2].xpos = li_xpos + li_width / 3
lws_pointapi[2].ypos = li_ypos
lws_pointapi[3].xpos = li_xpos + li_width * 2 / 3
lws_pointapi[3].ypos = li_ypos
lws_pointapi[4].xpos = li_xpos + li_width
lws_pointapi[4].ypos = li_ypos + li_height / 3
lws_pointapi[5].xpos = li_xpos + li_width
lws_pointapi[5].ypos = li_ypos + li_height * 2 / 3
lws_pointapi[6].xpos = li_xpos + li_width * 2 / 3
lws_pointapi[6].ypos = li_ypos + li_height
lws_pointapi[7].xpos = li_xpos + li_width / 3
lws_pointapi[7].ypos = li_ypos + li_height
lws_pointapi[8].xpos = li_xpos
lws_pointapi[8].ypos = li_ypos + li_height * 2 / 3
ll_handle = CreatePolygonRgn(lws_pointapi[], 8, 1)
//其中第 1 个参数为多边形各个顶点坐标值的数组
//其中第 2 个参数为多边形边数,可修改,配合数组值
//其中第 3 个参数为填充模式 ALTERNATE /WINDING
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type cb_5 from commandbutton within w_button
integer x = 1216
integer y = 940
integer width = 562
integer height = 148
integer taborder = 20
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "还原窗口"
end type
event clicked;//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_handle
ws_position lws_pointapi[]
// 图形2
int li_xpos, li_ypos, li_width, li_height
li_xpos = 1
li_ypos = 1
li_width = UnitsToPixels(parent.width, xunitstopixels!)
li_height = UnitsToPixels(parent.height, yunitstopixels!)
lws_pointapi[1].xpos = li_xpos
lws_pointapi[1].ypos = li_ypos
lws_pointapi[2].xpos = li_xpos + li_width
lws_pointapi[2].ypos = li_ypos
lws_pointapi[3].xpos = li_xpos + li_width
lws_pointapi[3].ypos = li_ypos + li_height
lws_pointapi[4].xpos = li_xpos
lws_pointapi[4].ypos = li_ypos + li_height
ll_handle = CreatePolygonRgn(lws_pointapi[], 4, 1)
//其中第 1 个参数为多边形各个顶点坐标值的数组
//其中第 2 个参数为多边形边数,可修改,配合数组值
//其中第 3 个参数为填充模式 ALTERNATE /WINDING
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type cb_4 from commandbutton within w_button
integer x = 585
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
parent.width = 2400
parent.height = 1800
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_3 from commandbutton within w_button
integer x = 1216
integer y = 472
integer width = 562
integer height = 148
integer taborder = 20
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "菱形窗口"
end type
event clicked;//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_handle
ws_position lws_pointapi[]
// 图形2
int li_xpos, li_ypos, li_width, li_height
li_xpos = 1
li_ypos = 1
li_width = UnitsToPixels(parent.width, xunitstopixels!)
li_height = UnitsToPixels(parent.height, yunitstopixels!)
lws_pointapi[1].xpos = li_xpos
lws_pointapi[1].ypos = li_ypos + li_height / 2
lws_pointapi[2].xpos = li_xpos + li_width / 2
lws_pointapi[2].ypos = li_ypos
lws_pointapi[3].xpos = li_xpos + li_width
lws_pointapi[3].ypos = li_ypos + li_height / 2
lws_pointapi[4].xpos = li_xpos + li_width / 2
lws_pointapi[4].ypos = li_ypos + li_height
ll_handle = CreatePolygonRgn(lws_pointapi[], 4, 1)
//其中第 1 个参数为多边形各个顶点坐标值的数组
//其中第 2 个参数为多边形边数,可修改,配合数组值
//其中第 3 个参数为填充模式 ALTERNATE /WINDING
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type cb_2 from commandbutton within w_button
integer x = 585
integer y = 472
integer width = 562
integer height = 148
integer taborder = 20
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "圆角矩形按钮"
end type
event clicked;this.enabled = false
of_set_oval(this)
end event
type cb_1 from commandbutton within w_button
integer x = 1216
integer y = 784
integer width = 562
integer height = 148
integer taborder = 10
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
ll_x1 = 4
ll_y1 = 4
ll_x2 = UnitsToPixels(parent.width, xunitstopixels!) - 4
ll_y2 = UnitsToPixels(parent.height, yunitstopixels!) - 4
ll_x3 = 250
ll_y3 = 250
ll_handle = CreateRoundRectRgn(ll_x1, ll_y1, ll_x2, ll_y2, ll_x3, ll_y3)
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type st_1 from statictext within w_button
integer x = 567
integer y = 200
integer width = 1207
integer height = 264
boolean bringtotop = true
integer textsize = -8
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 17725690
alignment alignment = center!
boolean focusrectangle = false
end type
event clicked;if this.width <= 1000 then
this.resize(1586, 2164)
else
this.resize(986, 264)
end if
end event
以下是全部源码,感兴趣的朋友可以整个窗口的源代码导入到PBL里自己运行一下试试。
$PBExportHeader$w_button.srw
forward
global type w_button from window
end type
type cb_11 from commandbutton within w_button
end type
type cb_10 from commandbutton within w_button
end type
type em_3 from editmask within w_button
end type
type em_2 from editmask within w_button
end type
type em_1 from editmask within w_button
end type
type cb_9 from commandbutton within w_button
end type
type cb_8 from commandbutton within w_button
end type
type cb_7 from commandbutton within w_button
end type
type cb_6 from commandbutton within w_button
end type
type cb_5 from commandbutton within w_button
end type
type cb_4 from commandbutton within w_button
end type
type cb_3 from commandbutton within w_button
end type
type cb_2 from commandbutton within w_button
end type
type cb_1 from commandbutton within w_button
end type
type st_1 from statictext within w_button
end type
type ws_position from structure within w_button
end type
end forward
type ws_position from structure
long xpos
long ypos
end type
global type w_button from window
integer width = 2400
integer height = 1800
boolean titlebar = true
string title = "特殊形状数据窗口演示"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
long backcolor = 17725690
string icon = "AppIcon!"
boolean center = true
cb_11 cb_11
cb_10 cb_10
em_3 em_3
em_2 em_2
em_1 em_1
cb_9 cb_9
cb_8 cb_8
cb_7 cb_7
cb_6 cb_6
cb_5 cb_5
cb_4 cb_4
cb_3 cb_3
cb_2 cb_2
cb_1 cb_1
st_1 st_1
end type
global w_button w_button
type prototypes
FUNCTION ulong CreateRoundRectRgn(Long x1, Long y1, Long x2, Long y2, Long x3, Long y3) library "gdi32"
FUNCTION ulong CreatePolygonRgn (ref ws_position lppt[], int cPoints, int fnPolyFillMode ) Library "gdi32"
FUNCTION ulong CreateEllipticRgn( Long x1, Long y1, Long x2, Long y2) library "gdi32"
FUNCTION ulong SetWindowRgn(ulong hWnd,ulong hRgn,boolean bRedraw) LIBRARY "user32"
FUNCTION ulong CombineRgn(Long hDestRgn, Long hSrcRgn1, Long hSrcRgn2, Long nCombineMode ) LIBRARY "gdi32"
Function Long SetParent( Long hWndChild, Long hWndNewParent) library "user32"
Subroutine keybd_event(long bVk, long bScan, long dwFlags, long dwExtraInfo) LIBRARY "user32.dll"
end prototypes
forward prototypes
public function integer of_set_oval (commandbutton acb_button)
public function integer wf_set_color ()
end prototypes
public function integer of_set_oval (commandbutton acb_button);//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_x1, ll_x2, ll_x3
long ll_y1, ll_y2, ll_y3
long ll_handle
ll_x1 = 1
ll_y1 = 1
ll_x2 = UnitsToPixels(acb_button.width, xunitstopixels!)
ll_y2 = UnitsToPixels(acb_button.height, yunitstopixels!)
ll_x3 = 64
ll_y3 = 64
ll_handle = CreateRoundRectRgn(ll_x1, ll_y1, ll_x2, ll_y2, ll_x3, ll_y3)
SetwindowRgn(handle(acb_button), ll_handle, true)
return 1
end function
public function integer wf_set_color ();long ll_red, ll_green, ll_blue
long ll_data
ll_red = long(em_1.text)
ll_green = long(em_2.text)
ll_blue = long(em_3.text)
ll_data = rgb(ll_red, ll_green, ll_blue)
this.backcolor = ll_data
em_1.backcolor = ll_data
em_2.backcolor = ll_data
em_3.backcolor = ll_data
st_1.backcolor = ll_data
return 1
end function
on w_button.create
this.cb_11=create cb_11
this.cb_10=create cb_10
this.em_3=create em_3
this.em_2=create em_2
this.em_1=create em_1
this.cb_9=create cb_9
this.cb_8=create cb_8
this.cb_7=create cb_7
this.cb_6=create cb_6
this.cb_5=create cb_5
this.cb_4=create cb_4
this.cb_3=create cb_3
this.cb_2=create cb_2
this.cb_1=create cb_1
this.st_1=create st_1
this.Control[]={this.cb_11,&
this.cb_10,&
this.em_3,&
this.em_2,&
this.em_1,&
this.cb_9,&
this.cb_8,&
this.cb_7,&
this.cb_6,&
this.cb_5,&
this.cb_4,&
this.cb_3,&
this.cb_2,&
this.cb_1,&
this.st_1}
end on
on w_button.destroy
destroy(this.cb_11)
destroy(this.cb_10)
destroy(this.em_3)
destroy(this.em_2)
destroy(this.em_1)
destroy(this.cb_9)
destroy(this.cb_8)
destroy(this.cb_7)
destroy(this.cb_6)
destroy(this.cb_5)
destroy(this.cb_4)
destroy(this.cb_3)
destroy(this.cb_2)
destroy(this.cb_1)
destroy(this.st_1)
end on
event mousemove;Send(handle(this), 274, 61458, 0)
end event
type cb_11 from commandbutton within w_button
integer x = 1216
integer y = 1096
integer width = 562
integer height = 148
integer taborder = 70
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "半圆形花边"
end type
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 / 2
lws_pointapi[1].ypos = ll_ypos - ll_flower / 2
lws_pointapi[2].xpos = ll_width + ll_flower / 2
lws_pointapi[2].ypos = ll_ypos - ll_flower / 2
lws_pointapi[3].xpos = ll_width + ll_flower / 2
lws_pointapi[3].ypos = ll_height + ll_flower /2
lws_pointapi[4].xpos = ll_xpos + ll_flower - ll_flower / 2
lws_pointapi[4].ypos = ll_height + ll_flower/2
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_10 from commandbutton within w_button
integer x = 1216
integer y = 1096
integer width = 562
integer height = 148
integer taborder = 60
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "关闭窗口"
end type
event clicked;close(parent)
end event
type em_3 from editmask within w_button
event editchanged pbm_enchange
integer x = 1289
integer y = 104
integer width = 251
integer height = 92
integer taborder = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 17725690
string text = "14"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "###"
boolean autoskip = true
boolean spin = true
double increment = 5
string minmax = "0~~255"
end type
event editchanged;wf_set_color()
end event
type em_2 from editmask within w_button
event editchanged pbm_enchange
integer x = 1024
integer y = 104
integer width = 251
integer height = 92
integer taborder = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 17725690
string text = "120"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "###"
boolean autoskip = true
boolean spin = true
double increment = 5
string minmax = "0~~255"
end type
event editchanged;wf_set_color()
end event
type em_1 from editmask within w_button
event editchanged pbm_enchange
integer x = 759
integer y = 104
integer width = 251
integer height = 92
integer taborder = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 17725690
string text = "250"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "###"
boolean autoskip = true
boolean spin = true
double increment = 5
string minmax = "0~~255"
end type
event editchanged;wf_set_color()
end event
type cb_9 from commandbutton within w_button
integer x = 590
integer y = 1096
integer width = 562
integer height = 148
integer taborder = 50
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "圆形花边"
end type
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
event clicked;//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_handle
ws_position lws_pointapi[]
// 图形2
int li_xpos, li_ypos, li_width, li_height
li_xpos = 12
li_ypos = 1
li_width = UnitsToPixels(parent.width, xunitstopixels!) - 32
li_height = UnitsToPixels(parent.height, yunitstopixels!) - 32
lws_pointapi[1].xpos = li_xpos
lws_pointapi[1].ypos = li_ypos + li_height / 3
lws_pointapi[2].xpos = li_xpos + li_width / 3
lws_pointapi[2].ypos = li_ypos
lws_pointapi[3].xpos = li_xpos + li_width * 2 / 3
lws_pointapi[3].ypos = li_ypos
lws_pointapi[4].xpos = li_xpos + li_width
lws_pointapi[4].ypos = li_ypos + li_height / 3
lws_pointapi[5].xpos = li_xpos + li_width
lws_pointapi[5].ypos = li_ypos + li_height * 2 / 3
lws_pointapi[6].xpos = li_xpos + li_width * 2 / 3
lws_pointapi[6].ypos = li_ypos + li_height
lws_pointapi[7].xpos = li_xpos + li_width / 3
lws_pointapi[7].ypos = li_ypos + li_height
lws_pointapi[8].xpos = li_xpos
lws_pointapi[8].ypos = li_ypos + li_height * 2 / 3
ll_handle = CreatePolygonRgn(lws_pointapi[], 8, 1)
//其中第 1 个参数为多边形各个顶点坐标值的数组
//其中第 2 个参数为多边形边数,可修改,配合数组值
//其中第 3 个参数为填充模式 ALTERNATE /WINDING
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type cb_5 from commandbutton within w_button
integer x = 1216
integer y = 940
integer width = 562
integer height = 148
integer taborder = 20
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "还原窗口"
end type
event clicked;//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_handle
ws_position lws_pointapi[]
// 图形2
int li_xpos, li_ypos, li_width, li_height
li_xpos = 1
li_ypos = 1
li_width = UnitsToPixels(parent.width, xunitstopixels!)
li_height = UnitsToPixels(parent.height, yunitstopixels!)
lws_pointapi[1].xpos = li_xpos
lws_pointapi[1].ypos = li_ypos
lws_pointapi[2].xpos = li_xpos + li_width
lws_pointapi[2].ypos = li_ypos
lws_pointapi[3].xpos = li_xpos + li_width
lws_pointapi[3].ypos = li_ypos + li_height
lws_pointapi[4].xpos = li_xpos
lws_pointapi[4].ypos = li_ypos + li_height
ll_handle = CreatePolygonRgn(lws_pointapi[], 4, 1)
//其中第 1 个参数为多边形各个顶点坐标值的数组
//其中第 2 个参数为多边形边数,可修改,配合数组值
//其中第 3 个参数为填充模式 ALTERNATE /WINDING
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type cb_4 from commandbutton within w_button
integer x = 585
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
parent.width = 2400
parent.height = 1800
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_3 from commandbutton within w_button
integer x = 1216
integer y = 472
integer width = 562
integer height = 148
integer taborder = 20
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "菱形窗口"
end type
event clicked;//////////////////////////////////////////////////
// //
// 测试用数据(窗口多边形) //
// //
//////////////////////////////////////////////////
long ll_handle
ws_position lws_pointapi[]
// 图形2
int li_xpos, li_ypos, li_width, li_height
li_xpos = 1
li_ypos = 1
li_width = UnitsToPixels(parent.width, xunitstopixels!)
li_height = UnitsToPixels(parent.height, yunitstopixels!)
lws_pointapi[1].xpos = li_xpos
lws_pointapi[1].ypos = li_ypos + li_height / 2
lws_pointapi[2].xpos = li_xpos + li_width / 2
lws_pointapi[2].ypos = li_ypos
lws_pointapi[3].xpos = li_xpos + li_width
lws_pointapi[3].ypos = li_ypos + li_height / 2
lws_pointapi[4].xpos = li_xpos + li_width / 2
lws_pointapi[4].ypos = li_ypos + li_height
ll_handle = CreatePolygonRgn(lws_pointapi[], 4, 1)
//其中第 1 个参数为多边形各个顶点坐标值的数组
//其中第 2 个参数为多边形边数,可修改,配合数组值
//其中第 3 个参数为填充模式 ALTERNATE /WINDING
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type cb_2 from commandbutton within w_button
integer x = 585
integer y = 472
integer width = 562
integer height = 148
integer taborder = 20
integer textsize = -12
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "圆角矩形按钮"
end type
event clicked;this.enabled = false
of_set_oval(this)
end event
type cb_1 from commandbutton within w_button
integer x = 1216
integer y = 784
integer width = 562
integer height = 148
integer taborder = 10
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
ll_x1 = 4
ll_y1 = 4
ll_x2 = UnitsToPixels(parent.width, xunitstopixels!) - 4
ll_y2 = UnitsToPixels(parent.height, yunitstopixels!) - 4
ll_x3 = 250
ll_y3 = 250
ll_handle = CreateRoundRectRgn(ll_x1, ll_y1, ll_x2, ll_y2, ll_x3, ll_y3)
SetwindowRgn(handle(parent), ll_handle, true)
return 1
end event
type st_1 from statictext within w_button
integer x = 567
integer y = 200
integer width = 1207
integer height = 264
boolean bringtotop = true
integer textsize = -8
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 17725690
alignment alignment = center!
boolean focusrectangle = false
end type
event clicked;if this.width <= 1000 then
this.resize(1586, 2164)
else
this.resize(986, 264)
end if
end event
本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )
【编程爱好者论坛】