您的位置:程序门 -> vc/mfc -> 界面



vc6中如何制作256或真彩色的工具栏呀


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


vc6中如何制作256或真彩色的工具栏呀[已结贴,结贴人:kevin816]
发表于:2007-04-26 19:27:34 楼主
一个很漂亮的图片放到我工程中的工具栏时,一保存或运行,图片就变成16色的啦,我怎么处理才能工具栏显示的图片跟原来的图片一样呀,就是如何将16色的转换为256色或真彩色的呀????
各位兄弟帮帮忙呀,最后能有代码例子呀。
谢谢呀
发表于:2007-04-26 19:48:381楼 得分:20
int   cmainframe::oncreate(lpcreatestruct   lpcreatestruct)
{
        verify(cframewnd::oncreate(lpcreatestruct)==0);
       
        //创建并加载工具栏
        //
        verify(m_wndtoolbar.create(this));
        verify(m_wndtoolbar.loadtoolbar(idr_mainframe));

        //   加载工具栏位图   -   必须使用::loadimage映射颜色
        //   将(192,192,192)   映射到   color_3dface.
        //
        hbitmap   hbm   =   (hbitmap)::loadimage(afxgetinstancehandle(),
                makeintresource(idr_mainframe),
                image_bitmap,
                0,0,   //   cx,cy
                lr_createdibsection   ¦   lr_loadmap3dcolors   );
        cbitmap   bm;
        bm.attach(hbm);

        //   创建图像清单并设置工具栏
        //   256色图像必须使用ilc_color8!
        //
        m_iltoolbar.create(20,20,   ilc_color8,   4,   4);
        m_iltoolbar.add(&bm,(cbitmap*)null);
        m_wndtoolbar.gettoolbarctrl().setimagelist(&m_iltoolbar);

        verify(m_wndstatusbar.create(this));
        verify(m_wndstatusbar.setindicators(indicators,
                    sizeof(indicators)/sizeof(uint)));

        verify(m_wndview.create(_t( "press   a   button,   any   button. "),
                ws_visible ¦ws_child ¦ss_centerimage ¦ss_center,
                crect(0,0,0,0),   this,   afx_idw_pane_first));

        return   0;
}

发表于:2007-04-26 20:08:232楼 得分:10
不能直接贴到toolbar上,得用代码加载图片,用什么语句都可以!
发表于:2007-04-26 22:50:243楼 得分:20
codeproject上一大堆这样的文章,去看看


快速检索

最新资讯
热门点击