绘制CTreeCtrl的+/-展开按钮

绘制CTreeCtrl的+/-展开按钮的代码.
None.gif void DrawExpandButton( HDC hdc, LONG x, LONG y, BOOL bExpand, BOOL bFill )
ExpandedBlockStart.gif {
InBlock.gif    const int PROPTREEITEM_EXPANDBOX        = 9;            // 按钮大小
InBlock.gif
    const int PROPTREEITEM_EXPANDBOXHALF    = (PROPTREEITEM_EXPANDBOX / 2);
InBlock.gif
InBlock.gif    HPEN hPen;
InBlock.gif    HPEN oPen;
InBlock.gif    HBRUSH oBrush;
InBlock.gif
InBlock.gif    hPen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW));
InBlock.gif    oPen = (HPEN)SelectObject(hdc, hPen);
InBlock.gif    oBrush = (HBRUSH)SelectObject(hdc, GetStockObject(bFill ? WHITE_BRUSH : NULL_BRUSH));
InBlock.gif
InBlock.gif    Rectangle(hdc, x, y, x + PROPTREEITEM_EXPANDBOX, y + PROPTREEITEM_EXPANDBOX);
InBlock.gif    SelectObject(hdc, GetStockObject(BLACK_PEN));
InBlock.gif
InBlock.gif    if (!bExpand)
ExpandedSubBlockStart.gif    {
InBlock.gif        MoveToEx(hdc, x + PROPTREEITEM_EXPANDBOXHALF, y + 2, NULL);
InBlock.gif        LineTo(hdc, x + PROPTREEITEM_EXPANDBOXHALF, y + PROPTREEITEM_EXPANDBOX - 2);
ExpandedSubBlockEnd.gif    }
InBlock.gif
InBlock.gif    MoveToEx(hdc, x + 2, y + PROPTREEITEM_EXPANDBOXHALF, NULL);
InBlock.gif    LineTo(hdc, x + PROPTREEITEM_EXPANDBOX - 2, y + PROPTREEITEM_EXPANDBOXHALF);
InBlock.gif
InBlock.gif    SelectObject(hdc, oPen);
InBlock.gif    SelectObject(hdc, oBrush);
InBlock.gif    DeleteObject(hPen);
ExpandedBlockEnd.gif}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值