使用png图片是否可行?图片为透明的?
将窗口属性设置为透明

解决方案 »

  1.   

    底层为半透明窗口,顶层为正常窗口,设置child于底层窗口就行了。
      

  2.   

    一层窗口就行了,用在窗口DC中绘制所有的透明的背景和不透明的中间那显示区域,然后用UpdateLayeredWindow来设置显示
      

  3.   


    怎样用GDI+绘制 半透明和不透明,能不能展示点代码?
      

  4.   

    用PNG图片作为背景,边缘做成透明就可以了
      

  5.   

    哥用GDI+帮你做一下,不用控件,有图有真相。
    上代码:
    void CGdiTestDlg::OnPaint()
    {
    .................................................................
    .................................................................
    .................................................................
    //获取对话框尺寸
    CRect rect;
    GetClientRect(&rect);
            //构建GDI类
    Graphics graphics(GetSafeHwnd());
    //加载背景jpg图片(PNG/BMP均可)
    Image bkimage(filepath1.AllocSysString());
    //创建背景画刷
    TextureBrush bkbrush(&bkimage);
    //创建透明度画刷
    SolidBrush sbrush(Color(128, 0, 0, 0));//128/256=50%透明
    //画背景+画透明
    graphics.FillRectangle(&bkbrush,Rect(0,0,rect.Width(),rect.Height()));
    graphics.FillRectangle(&sbrush,Rect(0,0,rect.Width(),rect.Height()));
        //贴中间的文字(也是jpg/PNG/BMP等任意格式图片)
            Image txtimage(filepath2.AllocSysString());
    TextureBrush txtbrush(&txtimage);
           graphics.FillRectangle(&txtbrush,Rect(rect.CenterPoint().x-txtimage.GetWidth()/2 ,rect.CenterPoint().y-txtimage.GetHeight()/2,txtimage.GetWidth(),txtimage.GetHeight()));
    }
    看效果: