PB12.5评测

pb12.5已经出来很久了,对12.5数据窗口新增的自绘功能比较欣赏,抽时间做了个例子,供大家参考

 

New Win32 DataWindow Features:

User-Drawn Controls in the DataWindow

 

参考源代码如下:

 

global type MyDrawPieSlice from function_object
end type

forward prototypes
global function boolean mydrawpieslice (long al_dc, long al_x, long al_y, long al_w, long al_h)
end prototypes

global function boolean mydrawpieslice (long al_dc, long al_x, long al_y, long al_w, long al_h);
long ll_handle
ws_position lws_pointapi[]

// 图形2

long ll_pen, ll_brush

//创建一个画笔
ll_pen = CreatePen(0, 1, rgb(0, 0, 255))
SelectObject(al_dc, ll_pen)

//创建一个刷子
ll_brush = CreateSolidBrush(rgb(0, 255, 255))
SelectObject(al_dc, ll_brush)

//画一个三角形
lws_pointapi[1].xpos = al_x + 26
lws_pointapi[1].ypos = al_y + 1

lws_pointapi[2].xpos = al_x + 51
lws_pointapi[2].ypos = al_y + 26

lws_pointapi[3].xpos = al_x + 1
lws_pointapi[3].ypos = al_y + 26
Polygon(al_dc, lws_pointapi, 3)

//画一个四边形
al_x += 30
al_y += 50

lws_pointapi[1].xpos = al_x
lws_pointapi[1].ypos = al_y

lws_pointapi[2].xpos = al_x - 20
lws_pointapi[2].ypos = al_y + 20

lws_pointapi[3].xpos = al_x + 40
lws_pointapi[3].ypos = al_y + 20

lws_pointapi[4].xpos = al_x + 60
lws_pointapi[4].ypos = al_y
Polygon(al_dc, lws_pointapi, 4)

//画一个六连形
al_x += 100
al_y -= 20
lws_pointapi[1].xpos = al_x
lws_pointapi[1].ypos = al_y

lws_pointapi[2].xpos = al_x - 50
lws_pointapi[2].ypos = al_y + 50

lws_pointapi[3].xpos = al_x
lws_pointapi[3].ypos = al_y + 100

lws_pointapi[4].xpos = al_x + 100
lws_pointapi[4].ypos = al_y + 100

lws_pointapi[5].xpos = al_x + 150
lws_pointapi[5].ypos = al_y + 50

lws_pointapi[6].xpos = al_x + 100
lws_pointapi[6].ypos = al_y + 0

Polygon(al_dc, lws_pointapi, 6)


//写几个字
string ls_text
//gl_once = gl_once + 1

ls_text = '当前的文本是画出来的'
//ls_text = string(gl_once)

ws_rect lws_rect

lws_rect.left = al_x - 100
lws_rect.top = al_y + 130
lws_rect.right = al_w - 220
lws_rect.bottom = al_h
DrawText(al_dc, ls_text, lenA(ls_text), lws_rect, 1)

//画个饼图
al_x += 150
Pie(al_dc, al_x, al_y, al_x + 100, al_y + 100, al_x + 50, al_y + 50, al_x + 20, al_y + 20)

//画一个长方体
al_x += 50
al_y += 80

//画正面
lws_pointapi[1].xpos = al_x - 20
lws_pointapi[1].ypos = al_y + 20

lws_pointapi[2].xpos = al_x + 40
lws_pointapi[2].ypos = al_y + 20

lws_pointapi[3].xpos = al_x + 40
lws_pointapi[3].ypos = al_y + 100

lws_pointapi[4].xpos = al_x - 20
lws_pointapi[4].ypos = al_y + 100
Polygon(al_dc, lws_pointapi, 4)

//deleteobject(ll_brush)
//ll_brush = CreateSolidBrush(rgb(252, 213, 180))
//SelectObject(al_dc, ll_brush)

//画上边
lws_pointapi[1].xpos = al_x
lws_pointapi[1].ypos = al_y

lws_pointapi[2].xpos = al_x - 20
lws_pointapi[2].ypos = al_y + 20

lws_pointapi[3].xpos = al_x + 40
lws_pointapi[3].ypos = al_y + 20

lws_pointapi[4].xpos = al_x + 60
lws_pointapi[4].ypos = al_y
Polygon(al_dc, lws_pointapi, 4)

//画侧面
lws_pointapi[1].xpos = al_x + 60
lws_pointapi[1].ypos = al_y

lws_pointapi[2].xpos = al_x + 40
lws_pointapi[2].ypos = al_y + 20

lws_pointapi[3].xpos = al_x + 40
lws_pointapi[3].ypos = al_y + 100

lws_pointapi[4].xpos = al_x + 60
lws_pointapi[4].ypos = al_y + 80
Polygon(al_dc, lws_pointapi, 4)

 

//释放画笔和画刷
deleteobject(ll_pen)
deleteobject(ll_brush)

return true
end function

 

 

你可能感兴趣的:(Powerbuild12.5)