私はCMFCToolBar
由来のクラスを持ち、その義務はCDockablePane
由来のクラスのメンバーです。私はどのように行うの見ると、これまでにこれを持っているVisualStudioDemoサンプルを見CMFCToolBarでイメージマスクを認識させる方法を教えてください。
:
int CMyPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// Removed all "return -1 on error" code for better readability
CDockablePane::OnCreate(lpCreateStruct);
if(m_toolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_MY_TOOLBAR) &&
m_toolBar.LoadToolBar(IDR_MY_TOOLBAR, 0, 0, TRUE /* Is locked */))
{
if(theApp.m_bHiColorIcons) // Is true, i.e. following code is executed
{
m_toolBar.CleanUpLockedImages();
m_toolBar.LoadBitmap(IDB_MY_TOOLBAR_24, 0, 0, TRUE /*Locked*/);
}
m_toolBar.SetPaneStyle(m_toolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
m_toolBar.SetPaneStyle(m_toolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
m_toolBar.SetOwner(this);
// All commands will be routed via this control , not via the parent frame:
m_toolBar.SetRouteCommandsViaFrame(FALSE);
}
return 0;
}
ハイカラーの画像(24ビット)がロードされているが、マゼンタマスク(R255 G0 B255)が表示されます。ツールバーにマスクを認識させる方法がわかりません。
これも可能ですか?
これは、24bitイメージの解決策である可能性があるため、これを回答として受け入れます。これは質問の内容です。私の解決策は異なりますが、これは24ビットイメージを使用する必要がある他の人に役立つかもしれません。 – foraidt
私はそれが完璧な解決策ではないと認めます。ユーザーがボタンの顔の色を変更すると、透明度はおそらく消えてしまいます。 – djeidot