vc中的Output窗口是怎么做的? 这个窗口下面有一串标签Build,Debug,Find in Files 1,Find in Files 2 ,Result,SQL Debugging,分别显示不同的内容.这好象不是CTabCtrl控件,也不是工具栏,象是某种视图,请教各位大侠这是怎么做的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 VCKBASE上面有篇文章“轻松实现类VC界面”,看了你就知道怎么做到这样的界面,很简单!用一个类似于工具栏的控件,上面放一个类似于CTabCtrl的控件,然后AddPage()就可以 我有代码,留下邮箱[email protected] class CMyBarBottom : public CControlBar{// Constructionpublic: CMyBarBottom();// Attributespublic: CListCtrl m_ListCtrl;// Operationspublic:// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMyBarBottom) //}}AFX_VIRTUAL// Implementationpublic: void SetLVCheck(WPARAM ItemIndex, BOOL bCheck); void FormatList(CString* csText); void BuildColumns(int nCols, int * nWidth, int * iCol); void AddExStyle(DWORD dwNewStyle); virtual ~CMyBarBottom();// Generated message map functionsprotected: //{{AFX_MSG(CMyBarBottom) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos); //}}AFX_MSG DECLARE_MESSAGE_MAP()};--------------------------------------------------------------------------------#include "stdafx.h"#include "MyBarBottom.h"#include "Resource.h"CMyBarBottom::CMyBarBottom(){ // TODO: add construction code here.}CMyBarBottom::~CMyBarBottom(){ // TODO: add destruction code here.}#define IDC_LIST_CTRL 1000BEGIN_MESSAGE_MAP(CMyBarBottom, CControlBar) //{{AFX_MSG_MAP(CMyBarBottom) ON_WM_CREATE() ON_WM_WINDOWPOSCHANGED() //}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CMyBarBottom message handlersstatic int _gColText[] ={ IDS_COL_1, IDS_COL_2, IDS_COL_3};static int _gColSize[] ={ 100, 250, 250};static CString _gListText[] ={ _T("test one"), _T("test two"), _T("test three")};int CMyBarBottom::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CControlBar::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here if (!m_ListCtrl.Create (WS_CHILD|WS_VISIBLE|LVS_REPORT, CRect(0,0,0,0), this, IDC_LIST_CTRL)) { TRACE0("Failed to create view for CMyBarLeft\n"); return -1; } m_ListCtrl.ModifyStyleEx(0, WS_EX_CLIENTEDGE); AddExStyle (LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES); BuildColumns(3, _gColSize, _gColText); for (int i = 0; i < 5; ++i) FormatList (_gListText); return 0;}void CMyBarBottom::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) { CControlBar::OnWindowPosChanged(lpwndpos); // TODO: Add your message handler code here if (IsFloating()) { m_ListCtrl.MoveWindow( 5, 5, lpwndpos->cx-10, lpwndpos->cy-10 ); } else if (IsHorzDocked()) { m_ListCtrl.MoveWindow( 17, 3, lpwndpos->cx-25, lpwndpos->cy-17 ); } else { m_ListCtrl.MoveWindow( 3, 17, lpwndpos->cx-17, lpwndpos->cy-30 ); }}void CMyBarBottom::AddExStyle(DWORD dwNewStyle){ // Returns the current extended style ( a DWORD ). DWORD dwStyle = ::SendMessage (m_ListCtrl.m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); // Add the full row select and grid line style to the existing extended styles. dwStyle |= dwNewStyle; // Sets the current extended style ( a DWORD ). ::SendMessage (m_ListCtrl.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);}void CMyBarBottom::BuildColumns(int nCols, int * nWidth, int * iCol){ ASSERT(nCols); ASSERT(nWidth); ASSERT(iCol); ASSERT(m_ListCtrl); //insert columns int i; LV_COLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; CString strTemp; for(i = 0; i < nCols; i++) { lvc.iSubItem = i; strTemp.LoadString(iCol[i]); lvc.pszText = (char*)(LPCTSTR)strTemp; lvc.cx = nWidth[i]; lvc.fmt = LVCFMT_LEFT; m_ListCtrl.InsertColumn(i,&lvc); }}void CMyBarBottom::FormatList(CString * csText){ int nI = m_ListCtrl.GetItemCount(); LV_ITEM lvi; if (csText) { lvi.mask = LVIF_TEXT | LVIF_STATE; lvi.iItem = nI; lvi.iSubItem = 0; lvi.iImage = 0; lvi.stateMask = LVIS_STATEIMAGEMASK; lvi.state = INDEXTOSTATEIMAGEMASK(1); lvi.pszText = (char*)(LPCTSTR)csText[0]; int result = m_ListCtrl.InsertItem(&lvi); if (result != -1) { SetLVCheck (nI, TRUE); m_ListCtrl.SetItemText(nI, 1, csText[1]); m_ListCtrl.SetItemText(nI, 2, csText[2]); } }}void CMyBarBottom::SetLVCheck(WPARAM ItemIndex, BOOL bCheck){ LV_ITEM lvi; lvi.stateMask = LVIS_STATEIMAGEMASK; lvi.state = UINT((int(bCheck) + 1) << 12); ::SendMessage (m_ListCtrl.m_hWnd, LVM_SETITEMSTATE, (WPARAM)ItemIndex, (LPARAM)(LV_ITEM FAR*)&lvi);} CMyBarBottom m_wndOutput;// MainFrm.h int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)中添加: m_wndOutput.SetBtnImageList (&m_ImageList); m_wndOutput.SetMenuID(IDR_POPUP); // Initialize dialog bar m_wndOutput if (!m_wndOutput.Create(this, CG_ID_VIEW_OUTPUT, _T("Output"), CSize(200,100))) { TRACE0("Failed to create dialog bar m_wndOutput\n"); return -1; // fail to create } // allow bar to be resized when floating m_wndOutput.SetBarStyle(m_wndOutput.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndOutput, AFX_IDW_DOCKBAR_BOTTOM); CContrlBar里有纯虚函数virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler) = 0;上面的编译不过我邮箱是[email protected],非常感谢 VCKBASE上面那篇文章“轻松实现类VC界面”我看了,vc的output窗不像是Ctoolbar,点alt+f6(就是windows菜单下的docking view),这个窗口竟然变成一个正常的视窗。 建议楼主下载CJ60Lib,他这里面的有一个现成的例子源程序 在平面图像上画出一些线,然后将这个平面投影到一个球面上,使得球面上得到的这些线是相互垂直的,请问在平面上构成那些线的点的坐标如何计算?? IViewObject::Draw怎么用啊? error LNK2005的问题。 C和C++编程出现问题!!! 全部家当求解答 ATL库和 CJ60lib 冲突的问题 (在线等待。。。) 请教一些关于32BITS和64BITS的BMP图象。 线程函数出错,为什么? sql查询,包含值就取是不是用LIKE?怎么用?给一个例子,马上给分 VC程序控制 Excel 画表格线 ? 一个数据交换问题. 请问如何改变CListView中的字体大小和行高?
[email protected]
{
// Construction
public:
CMyBarBottom();// Attributes
public:
CListCtrl m_ListCtrl;// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyBarBottom)
//}}AFX_VIRTUAL// Implementation
public:
void SetLVCheck(WPARAM ItemIndex, BOOL bCheck);
void FormatList(CString* csText);
void BuildColumns(int nCols, int * nWidth, int * iCol);
void AddExStyle(DWORD dwNewStyle);
virtual ~CMyBarBottom();// Generated message map functions
protected:
//{{AFX_MSG(CMyBarBottom)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
--------------------------------------------------------------------------------
#include "stdafx.h"
#include "MyBarBottom.h"
#include "Resource.h"
CMyBarBottom::CMyBarBottom()
{
// TODO: add construction code here.
}CMyBarBottom::~CMyBarBottom()
{
// TODO: add destruction code here.
}#define IDC_LIST_CTRL 1000BEGIN_MESSAGE_MAP(CMyBarBottom, CControlBar)
//{{AFX_MSG_MAP(CMyBarBottom)
ON_WM_CREATE()
ON_WM_WINDOWPOSCHANGED()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CMyBarBottom message handlersstatic int _gColText[] =
{
IDS_COL_1,
IDS_COL_2,
IDS_COL_3
};static int _gColSize[] =
{
100,
250,
250
};static CString _gListText[] =
{
_T("test one"),
_T("test two"),
_T("test three")
};int CMyBarBottom::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CControlBar::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
if (!m_ListCtrl.Create (WS_CHILD|WS_VISIBLE|LVS_REPORT,
CRect(0,0,0,0), this, IDC_LIST_CTRL))
{
TRACE0("Failed to create view for CMyBarLeft\n");
return -1;
} m_ListCtrl.ModifyStyleEx(0, WS_EX_CLIENTEDGE);
AddExStyle (LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES);
BuildColumns(3, _gColSize, _gColText); for (int i = 0; i < 5; ++i)
FormatList (_gListText); return 0;
}void CMyBarBottom::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
{
CControlBar::OnWindowPosChanged(lpwndpos);
// TODO: Add your message handler code here
if (IsFloating()) {
m_ListCtrl.MoveWindow( 5, 5, lpwndpos->cx-10, lpwndpos->cy-10 );
} else if (IsHorzDocked()) {
m_ListCtrl.MoveWindow( 17, 3, lpwndpos->cx-25, lpwndpos->cy-17 );
} else {
m_ListCtrl.MoveWindow( 3, 17, lpwndpos->cx-17, lpwndpos->cy-30 );
}
}void CMyBarBottom::AddExStyle(DWORD dwNewStyle)
{
// Returns the current extended style ( a DWORD ).
DWORD dwStyle = ::SendMessage (m_ListCtrl.m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); // Add the full row select and grid line style to the existing extended styles.
dwStyle |= dwNewStyle; // Sets the current extended style ( a DWORD ).
::SendMessage (m_ListCtrl.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
}void CMyBarBottom::BuildColumns(int nCols, int * nWidth, int * iCol)
{
ASSERT(nCols);
ASSERT(nWidth);
ASSERT(iCol);
ASSERT(m_ListCtrl); //insert columns
int i;
LV_COLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
CString strTemp;
for(i = 0; i < nCols; i++)
{
lvc.iSubItem = i;
strTemp.LoadString(iCol[i]);
lvc.pszText = (char*)(LPCTSTR)strTemp;
lvc.cx = nWidth[i];
lvc.fmt = LVCFMT_LEFT;
m_ListCtrl.InsertColumn(i,&lvc);
}
}void CMyBarBottom::FormatList(CString * csText)
{
int nI = m_ListCtrl.GetItemCount();
LV_ITEM lvi; if (csText)
{
lvi.mask = LVIF_TEXT | LVIF_STATE;
lvi.iItem = nI;
lvi.iSubItem = 0;
lvi.iImage = 0;
lvi.stateMask = LVIS_STATEIMAGEMASK;
lvi.state = INDEXTOSTATEIMAGEMASK(1);
lvi.pszText = (char*)(LPCTSTR)csText[0];
int result = m_ListCtrl.InsertItem(&lvi);
if (result != -1)
{
SetLVCheck (nI, TRUE);
m_ListCtrl.SetItemText(nI, 1, csText[1]);
m_ListCtrl.SetItemText(nI, 2, csText[2]);
}
}
}void CMyBarBottom::SetLVCheck(WPARAM ItemIndex, BOOL bCheck)
{
LV_ITEM lvi;
lvi.stateMask = LVIS_STATEIMAGEMASK;
lvi.state = UINT((int(bCheck) + 1) << 12);
::SendMessage (m_ListCtrl.m_hWnd, LVM_SETITEMSTATE, (WPARAM)ItemIndex,
(LPARAM)(LV_ITEM FAR*)&lvi);
}
m_wndOutput.SetMenuID(IDR_POPUP); // Initialize dialog bar m_wndOutput
if (!m_wndOutput.Create(this, CG_ID_VIEW_OUTPUT,
_T("Output"), CSize(200,100)))
{
TRACE0("Failed to create dialog bar m_wndOutput\n");
return -1; // fail to create
} // allow bar to be resized when floating
m_wndOutput.SetBarStyle(m_wndOutput.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndOutput, AFX_IDW_DOCKBAR_BOTTOM);
我邮箱是[email protected],非常感谢