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

 

 

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值