📄 256colors_in_toolbar.shtml.htm
字号:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="Zafir Anjum">
<TITLE>Toolbar - Using 256 color bitmaps in toolbar</TITLE>
</HEAD>
<body background="../fancyhome/back.gif" tppabs="http://www.codeguru.com/fancyhome/back.gif" bgcolor="#FFFFFF" link="#B50029" vlink="#8E2323" alink="#FF0000" bgproperties="fixed">
<table WIDTH="100%">
<tr WIDTH="100%">
<td><td>
</tr>
</table>
<CENTER><H3><FONT COLOR="#AOAO99">Using 256 color bitmaps in toolbar</FONT></H3></CENTER>
<HR>
This tip was contributed by <A HREF="mailto:kevinb@stargatenetworks.com">Kevin Bentley</A>.
He has tried this on a 256 color display as well.
<P>I recently needed to have 256 color toolbars in my app. If you create
256 color bitmaps in devstudio, and try to use them with CToolbar it
won't work.
<P>The problem is in the LoadBitmap() member or CToolbar. Appwizard will
create the following line in your CMainFrame class:
<PRE><TT><FONT COLOR="#990000">
m_wndToolBar.LoadBitmap(IDR_MAINFRAME)
</FONT></TT></PRE>
<P>Here is the fix, just replace the load bitmap call with a call to the
control itself:
<PRE><TT><FONT COLOR="#990000">
m_wndToolBar.GetToolBarCtrl().AddBitmap(iNumButtons,IDR_MAINFRAME);
</FONT></TT></PRE>
<P>It really is that easy, I found this solution after writing my own
toolbar class that used the tool control directly, and 256 color bitmaps
worked fine. I couldn't believe it, but it works!
<P>
<P>
<HR>
<TABLE BORDER=0 WIDTH="100%" >
<TR>
<TD WIDTH="33%"><FONT SIZE=-1><A HREF="../index.htm" tppabs="http://www.codeguru.com/">Goto HomePage</A></FONT></TD>
<TD WIDTH="33%">
<CENTER><FONT SIZE=-2>© 1997 Zafir Anjum</FONT> </CENTER>
</TD>
<TD WIDTH="34%">
<DIV ALIGN=right><FONT SIZE=-1>Contact me: <A HREF="mailto:zafir@home.com">zafir@home.com</A> </FONT></DIV>
</TD>
</TR>
</TABLE>
<CENTER><FONT SIZE=-2>6141</FONT></CENTER>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -