本帖最后由 feng9330 于 2011-09-05 20:15:13 编辑

解决方案 »

  1.   

    有点遮罩层的概念,前景图当mask,和背景图大小不一样,这样拖动起来,能看见效果
      

  2.   

    ondraw里画一下。相当简单。效率还好。
    之前一个同事做的一个这样的东西。后来由于控件放的不是一个两个。而是几十个就出现了问题。
    后来我帮忙用draw的方法。挺简单,也比较容易搞定。用控件反而复杂。
      

  3.   

    我之前也有这样一个需求,使用Transparent在某些情况下绘制是很慢的。
    思路:使用GDI,前景可以是一个画布(你画什么都可以), 背景也是一个画布,用户在拖拽的时候,你只去重绘背景的画布,然后把俩个画布一起显示,用双缓存。具体不知道在拖拽的时候会不会闪烁。 我觉得可以试试。
      

  4.   

    我也觉得这么个思路走下去的话有点问题,我准备用gdi来尝试下,但是对这方面又不是很熟悉;
    希望有相关经验的兄弟姐妹帮忙指点下,或许你有好的思路,还望多指点
      

  5.   

    你可以试试用滤镜来做啊 用静态HTML 通过JS来与后台进行交互 
      

  6.   

    自己做个控件吧,自己实现Draw方法
      

  7.   

    费劲  伪善不直接把两个图会在一个控件上 非得要两个空间呢
    还有两个控件 一前一后 为什么要把前景图放在背景图空间里面呢? 两个控件可以由同一个parent嘛 只是定位的时候用代码 别用鼠标拖拽
      

  8.   

    在conBack的拖动事件过程中,根据conBack在屏幕中的位置,计算并设置conForn的位置,使它看上去不动.
      

  9.   


    private void pictureBox1_Paint(object sender, PaintEventArgs e)
            {
                if (pictureBox1.Image == null) return;
                try
                {
                    ControlPaint.DrawSelectionFrame(e.Graphics, true, this.pictureBox1.ClientRectangle, GetClipRectangle(), Color.Black);
                    e.Graphics.DrawRectangle(new Pen(Color.Yellow, 2), this.conFront.ClientRectangle);
                    ControlPaint.DrawFocusRectangle(e.Graphics, this.conFront.ClientRectangle, Color.OrangeRed, Color.Silver);
                }
                catch //(Exception exp)
                {
                }            
          }
      

  10.   

    GetClipRectangle()
    =>
    this.conFront.ClientRectangle
      

  11.   

    期待结果O(∩_∩)O~
    百思不得其解的是这个需求⊙﹏⊙b汗
      

  12.   

    wpf里面都有opacity了 
    直接拉了两幅图上去 要怎么整三年级小学生都会了
    GDI GDI+实在麻烦的很 绘完一看 又没有模板的概念 完蛋了 需求更改 又要两晚通宵了
      

  13.   

    JS+CSS的问题,
    真的需要很高的手才能解决吗.....
      

  14.   

    没弄过,也么研究过,问问那些CSS JS高手
      

  15.   

    看看是你要的效果吗.....
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>test</title>
    <script type="text/javascript" src="jquery-1.3.2.js" ></script>
    <script type="text/javascript">
    function on_mousemove(id) {
        if (event.button == 1) {
            if (x != 0) {
                x = event.clientX - x1;
                y = event.clientY - y1;
    //alert(document.getElementById(id));
                $("#" + id).css("left", ($("#" + id).position().left + x) + "px");
                $("#" + id).css("top", ($("#" + id).position().top + y) + "px");
                x1 = event.clientX;
                y1 = event.clientY;
            } else {
                x = x1 = event.clientX;
                y = y1 = event.clientY;
            }
        } else {
            x = x1 = y = y1 = 0;
        }
        return false;

    </script>
    </head>
    <body style="width:1000px; height:800px;">
    <div id="imgObj" style="position:absolute;"><img style="width:600px; height:400px;"  src="lilies.jpg"></img></div>
        <div id="loadDiv" onmousemove="on_mousemove('imgObj');" style="position:absolute; FILTER:alpha(opacity=40); BACKGROUND-COLOR:#666; opacity:0.7; width:800px; height:600px; text-align:center;">
            <table style="width:100%; margin-top:100px">
                <tr align="center" style="height:100px; width:100%">
                    <td style="width:40%"></td>
                    <td style="width:20%; background-color: White;">
                    </td>
                    <td style="width:40%"></td>
                </tr>
            </table>
        </div>
    </body>
    </html>
      

  16.   

    干,怎么是C#板块的....
    我以为是ASP.NET的....
      

  17.   

    拖了好久才结贴,不好意思,一直没什么时间,大家都很给力,分不多,感谢!没有找到好的方法,最后还用用Onpaint来重绘前景控件,将背景控件对应位置的图截取出来作为前景控件的背景图,稍微有点延迟。有空会研究下gdi+, 其实这个问题比较纠结,就是winform中为什么没有绝对透明呢