您的位置:程序门 -> delphi -> windows sdk/api



xp操作系统-资源管理器 选文件的透明拉框,如何做出来呀


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


xp操作系统-资源管理器 选文件的透明拉框,如何做出来呀
发表于:2007-11-30 00:09:13 楼主
请高手们先看一下效果,再回答
发表于:2007-11-30 08:44:591楼 得分:0

procedure   tc_reportf.drawshape(topleft,   bottomright:   tpoint;   amode:   tpenmode);
begin
    with   scrn_rect   do
    begin
        pen.mode   :=   amode;
        rectangle(topleft.x,   topleft.y,   bottomright.x,   bottomright.y);
    end;
end;

procedure   tc_reportf.imagemousedown(sender:   tobject;   button:   tmousebutton;
    shift:   tshiftstate;   x,   y:   integer;   layer:   tcustomlayer);
begin
    if   button   =   mbright   then
    begin
        mousedragging   :=   true;
        image.cursor   :=   crhandpoint;
        oldmousepos   :=   point(x,   y);
    end;
    mx   :=   mouse.cursorpos.x;
    my   :=   mouse.cursorpos.y;
    bx   :=   x;
    by   :=   y;
    if   (not   picdraging)   and   (button   =   mbleft)   then
    begin
        mouse2down   :=   true;
        origin   :=   mouse.cursorpos;                     //   clienttoscreen(point(x,   y));
        movept   :=   origin;
    end;
end;

procedure   tc_reportf.imagemousemove(sender:   tobject;   shift:   tshiftstate;   x,
    y:   integer;   layer:   tcustomlayer);
begin
    if   mouse2down   then
    begin
        if   (x   >   bx)   and   (y   >   by)   then
            scrn_rect.pen.color   :=   color_kuang_big
        else
            scrn_rect.pen.color   :=   color_kuang_auto;

        drawshape(origin,   movept,   pmnotxor);
        origin   :=   mouse.cursorpos;
        drawshape(origin,   movept,   pmnotxor);
    end;

    if   mousedragging   or   picdraging   then
    begin
        image.scroll(oldmousepos.x   -   x,   oldmousepos.y   -   y);
        oldmousepos   :=   point(x,   y);
        image.update;
    end;

end;

procedure   tc_reportf.imagemouseup(sender:   tobject;   button:   tmousebutton;
    shift:   tshiftstate;   x,   y:   integer;   layer:   tcustomlayer);
var
    dx,   dy                         :   integer;
    rx,   ry,   r                   :   single;
    ux,   uy                         :   integer;
    cw,   ch,   pw,   ph         :   integer;
    nowscale                     :   single;
begin
    if   mouse2down   then
    begin
        mouse2down   :=   false;
        drawshape(origin,   movept,   pmnotxor);
    end;

    if   button   =   mbright   then
    begin
        mousedragging   :=   false;
        if   picdraging   then
            image.cursor   :=   crhandpoint
        else
            image.cursor   :=   crdefault
    end;

    if   (not   picdraging)   and   (button   =   mbleft)   and   (image.bitmap.width   >   10)   then
    begin
        nowscale   :=   image.scale;

        ux   :=   mouse.cursorpos.x;
        uy   :=   mouse.cursorpos.y;

        if   (ux   >   mx)   and   (uy   >   my)   then           //向右下脚划,放大图片。
        begin
            dx   :=   ux   -   mx;
            dy   :=   uy   -   my;

            rx   :=   image.width   /   dx;
            ry   :=   image.height   /   dy;

            if   rx   <=   ry   then   r   :=   rx   else   r   :=   ry;

            nowscale   :=   image.scale   *   r;

            scalebar.repaint;
            if   (nowscale   <   power(10,   scalebar.maxvalue   /   100))   then
            begin
                  //image.scale   :=   nowscale;
                scalebar.position   :=   round(logn(10,   nowscale)   *   100);
            end;
            image.scroll(round(((bx   +   dx   div   2)   -   image.width   div   2)   *   r),   round(((by   +   dy   div   2)   -   image.height   div   2)   *   r));
        end
        else
        begin
            nowscale   :=   image.width   /   image.bitmap.width;
            if   nowscale   >   (image.height   /   image.bitmap.height)   then
                nowscale   :=   (image.height   /   image.bitmap.height);
            image.scale   :=   nowscale;
            scalebar.position   :=   round(logn(10,   image.scale)   *   100);
        end;
    end;
end;
发表于:2007-12-01 13:31:502楼 得分:0
非常感谢你的回答,这段代码和xp资源管理器上的效果一样吗?我说的透明不是只有pen还有brush填充的,也就是说要填充这个矩形,但要透明,可以在xp资源管理器上试试,你拉框选文件时的矩形框
发表于:2007-12-08 21:20:343楼 得分:0
不太明白这是什么意思
发表于:2007-12-08 21:29:204楼 得分:0
这样做有何目的哦?


快速检索

最新资讯
热门点击