문제

나는있다 CMFCToolBar-유래 클래스와 그 삽입은 CDockablePane-유래 수업.

VisualStudiodemo 샘플을보고 지금 까지이 작업을 수행하는 방법을 확인했습니다.

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)가 보입니다. 나는 툴바에 마스크를 인식하도록 지시 할 수있는 방법을 모른다.
이것이 가능합니까?

도움이 되었습니까?

해결책

매번 이것이 작동하는지 모르겠지만 사용합니다. RGB(192, 192, 192) 마스크 색상으로 인식됩니다.

(CMFCToolbar 컨트롤이 사용할 준비가 된 것 같습니다. ::GetSysColor(COLOR_BTNFACE) 투명한 색으로 ...)

다른 팁

방금 해결 방법은 알파 채널과 함께 32 비트 이미지를 사용하는 것임을 알았습니다. 32 비트 이미지를 이전에 사용하려고 시도했지만 다른 이유로 작동하지 않았고 32 비트 이미지가 작동하지 않는다고 생각했습니다.

32 비트 이미지를 사용하려면 사용하지 마십시오. CBitmap 대신 사용하십시오 ATL::CImage 또는 CPNGImage object 로드 대응 resource ID.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top