?? online.cpp
字號:
// Online.cpp: implementation of the COnline class.
//
//////////////////////////////////////////////////////////////////////
//*************************************************************
//作者:趙明
//EMAIL:zmpapaya@hotmail.com;papaya_zm@sina.com
//主頁:http://h2osky.126.com
/********************************************************/
#include "stdafx.h"
#include "client1.h"
#include "Online.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
COnLine::COnLine()
{
}
COnLine::~COnLine()
{
delete m_ListCtrl;
}
BEGIN_MESSAGE_MAP(COnLine, CDialogBar)
//{{AFX_MSG_MAP(COnLine)
ON_WM_CREATE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COnLine message handlers
int COnLine::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialogBar::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rect;
//獲得窗口客戶區(qū)的大小。
GetClientRect(&rect);
//左邊留出了8個單位的空余。
rect.left += 8;
//上邊留出了15個單位的空余。
rect.top += 15;
//右邊留出了8個單位的空余。
rect.right -= 8;
//底邊留出了8個單位的空余。
rect.bottom -= 8;
m_ListCtrl = new COnlineList;
//創(chuàng)建一個List控件子窗口。
if (!m_ListCtrl->Create(WS_CHILD |WS_VISIBLE|LVS_REPORT,rect,this,IDC_LIST1))
{
TRACE0("Failed to create view for CMyBarLeft\n");
return -1;
}
//由于此類被用于兩個不同的對話框,其中的List控件有不同的columns,所以,
//向List控件中插入columns的代碼不能放在這里。
return 0;
}
void COnLine::OnSize(UINT nType, int cx, int cy)
{
// CDialogBar::OnSize(nType, cx, cy);
//下面的這兩句代碼有什么用?
//答:根據(jù)我的觀察,我發(fā)現(xiàn)執(zhí)行了下面的代碼后,List控件發(fā)生了移位,向右下角移動了幾個像素。
//可是,當我改變了坐標值后,沒有任何的變化。我去掉了SWP_NOZORDER后,發(fā)現(xiàn)外觀變了,所以,
//我斷定,四個坐標值是沒有用的,其作用的是SWP_NOZORDER這個Flag。
//SWP_NOZORDER Retains current ordering (ignores pWndInsertAfter).
//A window can be moved to the top of the Z-order either by setting the pWndInsertAfter
//parameter to &wndTopMost and ensuring that the SWP_NOZORDER flag is not set or by
//setting a window's Z-order so that it is above any existing topmost windows. When a
//nontopmost window is made topmost, its owned windows are also made topmost. Its
//owners are not changed.
//如果不設(shè)定上SWP_NOZORDER標記,那么List控件內(nèi)部的子窗口就會向左上角偏移幾個像素,不知是
//為什么。這個問題牽扯到List控件內(nèi)部的顯示、布局問題,有待考證。
//有一個辦法可以研究一下這個問題,就是建立一個對話框項目,然后在對話框模板上添加一個
//List控件,調(diào)整它的屬性,達到你想要的外觀。然后,你就可以用記事本之類的軟件打開.rc文件,
//找到List控件的部分,研究一下它的窗口屬性的Flags就可以了。這樣就會發(fā)現(xiàn)SWP_NOZORDER的
//用法了。
// if(m_ListCtrl->m_hWnd)
// m_ListCtrl->SetWindowPos(this,0,0,cx-15,cy-25,SWP_NOZORDER|SWP_NOMOVE);
// m_ListCtrl->SetWindowPos(this,99,99,cx-10,cy-20,0);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -