메인 프레임 내부에 내 툴바를 만드는 데 문제가 있습니다. 내 툴바에 사용하고 싶은 버튼의 비트 맵을 가지고 있지만 툴바가 내 SDI 응용 프로그램보기 내에 표시된다는 문제가 있습니다. 다음은 잘못 표시된 툴바 그림입니다. 여기 메인 프레임 클래스 내에서 내 도구 모음을 만들려고합니다. VS 6.0
http://www.flickr.com/photos/[email protected]/3409050475/
는 메인 프레임 클래스의 한 OnCreate 함수 내부의 코드는 다음과 같습니다, 나는 또한 제대로 그린 그린 여부되지 않는 것 같습니다 당신의 이미지에서// CToolBarCtrl m_wndToolBar; declared inside the MainFrame.h class.
if(m_wndToolBar.Create(WS_CHILD | TBSTYLE_FLAT | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC
,CRect(0,0,250,50),this,0))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
TBBUTTON tbbutton[3] = {0};
CSize button_size(90,90);
CSize bitmap_size(80,80);
//m_wndToolBar.AddStrings("String 1\0String 2\0String 3\0");
tbbutton[0].iBitmap = 0;
tbbutton[0].idCommand = ID_CONNECT;
tbbutton[0].fsState = TBSTATE_ENABLED;
tbbutton[0].fsStyle = TBSTYLE_BUTTON;
tbbutton[0].dwData = 0;
tbbutton[0].iString = 0;
tbbutton[1].iBitmap = 1;
tbbutton[1].idCommand = ID_DISCONNECT;
tbbutton[1].fsState = TBSTATE_ENABLED;
tbbutton[1].fsStyle = TBSTYLE_BUTTON;
tbbutton[1].dwData = 0;
tbbutton[1].iString = 1;
tbbutton[2].iBitmap = 2;
tbbutton[2].idCommand = ID_STOP;
tbbutton[2].fsState = TBSTATE_ENABLED;
tbbutton[2].fsStyle = TBSTYLE_BUTTON ;
tbbutton[2].dwData = 0;
tbbutton[2].iString = 2;
m_wndToolBar.SetButtonSize(button_size);
m_wndToolBar.SetBitmapSize(bitmap_size);
m_wndToolBar.AddButtons(3,tbbutton);
m_wndToolBar.AddBitmap(1,IDB_BITMAP1);
m_wndToolBar.AddBitmap(1,IDB_BITMAP2);
m_wndToolBar.AddBitmap(1,IDB_BITMAP3);
return TRUE;
조언 해 주셔서 감사합니다. 먼저 AddBitmap 메서드를 호출 할 때 제안한 것을 시도해 보았습니다.하지만 AddButtons를 호출하는 중 어떤 작업이 수행되는지는 툴바가 작동 중이지만보기 또는 클라이언트 영역 내에 있고 메뉴 바로 아래에있는 프레임의 일부가 아닙니다. –
죄송합니다. 저는 VC 6을 가지고 있지 않습니다. 내가 할 수있는 것은 새로운 MFC SDI 프로젝트를 도구 모음으로 만든 다음 MFC 마법사에서 사용하는 플래그와 초기화 코드를 복사하는 것입니다. – Ismael