Recessed Status Bar
Prashant Patel -- prpatel@usr.com
Monday, October 07, 1996
Environment: VC++ 1.52, Win 3.1
Does anyone know how to create a recessed status bar like in the VC++
1.52 environment. I want to create that type of status bar in my
application and I was wondering if anyone had sample source code or a
link to somewhere where I can get info on how to do this.
Thanks
Prashant
prpatel@usr.com
Glenn T. Jayaputera -- gtj@nunkeen.apana.org.au
Tuesday, October 08, 1996
[Mini-digest: 3 responses]
>
> Environment: VC++ 1.52, Win 3.1
>
> Does anyone know how to create a recessed status bar like in the VC++
> 1.52 environment. I want to create that type of status bar in my
> application and I was wondering if anyone had sample source code or a
> link to somewhere where I can get info on how to do this.
If my memory serves my right, there are some source code on Compuserve. So if you have a
Compuserve account, you should be able to pull it down
glenn tesla
-----From: Amir Salzberg
Look at the example in c:\msvc\mfc\samples\ctrlbars\mainfrm.cpp
Hope this helps, Amir.
-----From: Alun
This is the OnCreate I use in an MFC application, it provides a toolbar and
status bar.
m_wndToolBar and m_wndStatusBar are members of CMainWnd, derived from
CToolBar and CStatusBar respectively.
Declare before the OnCreate function for the MainFrame window
/* menu commands in toolbar */
static UINT BASED_CODE buttons[] =
{
IDC_FILE_EXIT,
ID_SEPARATOR,
IDC_TEST_SETUP,
IDC_TEST_RUN,
ID_SEPARATOR,
IDC_HELP_ABOUT,
};
/* indicator panes in status bar */
static UINT BASED_CODE indicators[] =
{
ID_SEPARATOR,
};
int CMainWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
/* create, setup and attach toolbar to the frame window */
if (!m_wndToolBar.Create(this))
{
TRACE("Failed to create toolbar\n");
return -1; // fail to Create
}
if(!m_wndToolBar.LoadBitmap(IDB_TOOLBAR))
{
TRACE("Failed load toolbar bitmap\n");
return -1; // fail to LoadBitmap
}
if(!m_wndToolBar.SetButtons(buttons, sizeof(buttons)/sizeof(UINT)))
{
TRACE("Failed to set toolbar buttons\n");
return -1; // fail to SetButtons
}
/* create, setup and attach status bar to the frame window */
if (!m_wndStatusBar.Create(this))
{
TRACE("Failed to create status bar\n");
return -1; // fail to Create
}
f(!m_wndStatusBar.SetIndicators(indicators,sizeof(indicators)/sizeof(UINT)))
{
TRACE("Failed to set status bar indicators\n");
return -1; // fail to SetIndicators
}
_wndStatusBar.SetPaneInfo(0,m_wndStatusBar.GetItemID(0),SBPS_STRETCH,NULL);
// give the first pane a 3D look (the SBPS_STRETCH flag sets the first pane
to 3D (recessed))
/* all successful */
return 0;
}
Hope this helps.
The Loon
WnDBSoft@aol.com
Thursday, October 10, 1996
In a message dated 96-10-07 20:27:53 EDT, prpatel@usr.com writes:
>Does anyone know how to create a recessed status bar like in the VC++
> 1.52 environment. I want to create that type of status bar in my
> application and I was wondering if anyone had sample source code or a
> link to somewhere where I can get info on how to do this.
Sample source code for this procedure can be found in the
CMainFrame::OnCreate( ) function of the CTRLBARS sample program.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//...
// create toolbar
//...
//...
//create status bar
//...
UINT nID, nStyle;
int cxWidth;
m_wndStatusBar.GetPaneInfo(0, nID, nStyle, cxWidth);
m_wndStatusBar.SetPaneInfo(0, nID, SPBS_STRETCH|SPBS_NORMAL,
cxWidth);
return 0;
}
Good luck!
| Вернуться в корень Архива
|