Thread View: cn.bbs.comp.program
1 messages
1 total messages
Started by �ϵ�
Sun, 19 Apr 1998 00:00
vc���ָ��68ƪ(4)
Author: �ϵ�
Date: Sun, 19 Apr 1998 00:00
Date: Sun, 19 Apr 1998 00:00
143 lines
7402 bytes
7402 bytes
2m������:m TINA (�ռ�����)
2m�� ��:m RAD
2m�� ��:m VC��̼���68ƪ(4)
2m����վ:m '3m�Ͻ�ɺ�m' (Mon Apr 6 08:34:56 1998) , 5mվ���ż�m
[������ҳ] [����������] [ȫ��������]
������: Zeemon (������), ����: Visual
�� ��: vc���ָ��68ƪ(4)
����վ: BBS ˮľ�廪վ (Wed Oct 22 21:14:47 1997)
21����ε������˴��ڱ��������������ʹ�����ƶ�
��������Ҫȷ�����λ��ʱWindows�ڷ���WM_NCHITTEST��Ϣ�����Դ���
����ϢʹWindows��Ϊ����ڴ��ڱ����ϡ����ڶԻ���ͻ��ڶԻ���Ӧ�ó���
��ʹ��ClassWizard�������Ϣ�����û��ຯ�� ������HTCLIENT �����
����ڿͷ�������HTCAPTION���������Windows�ı������С�
UINT CSampleDialog : : OnNcHitTest (Cpoint point )
{
UINT nHitTest =Cdialog: : OnNcHitTest (point );
return (nHitTest = =HTCLIENT)? HTCAPTION : nHitTest ;
}
�������������㲻��֮���� ��һ���ڴ��ڵĿͻ�����˫��ʱ�� ���ڽ�����
����� ���ʺϰ���Ӵ������ڡ�����һ�ַ��������û�����������
ʹ������Ϊ������䴰�ڱ����ϣ�ʹ��ClassWizard���Ӵ��д���WM_LBUTTODOWN
��Ϣ�������ڷ���һ��WM_NCLBUTTONDOWN��Ϣ��һ����������HTCAPTION��
void CSampleView : : OnLButtonDown (UINT nFlags , Cpoint point )
{
CView : : OnLButtonDow (nFlags , pont );
//Fool frame window into thinking somene clicked on
its caption bar .
GetParentFrame ( ) ��> PostMessage (
WM_NCLBUTTONDOWN , HTCAPTION , MAKELPARAM (poitn .x , point .y) );
}
�ü���Ҳ�����ڶԻ���ͻ��ڶԵ�Ӧ�ó���ֻ�Dz��ص���CWnd : :
GetParentFrame ��
void CSampleDialog : : OnLbuttonDown (UINT nFlags, Cpoint point )
{
Cdialog : : OnLButtonDow (nFlags, goint );
//Fool dialog into thinking simeone clicked on its caption bar .
PostMessage (WM_NCLBUTTONDOWN , HTCAPTION , MAKELPARM (point.x , point. y
) )
}
22����θı��Ӵ��ı�����ɫ
Windows�ڷ���һ��WM_ERASEBKGND��Ϣ֪ͨ�ô��ڲ��������ʹ��
ClassWizard���ظ���Ϣ��ȱʡ��������������ʵ���ǻ�����������TRUE��
��ֹWindows����ڡ�
//Paint area that needs to be erased.
BOOL CSampleView : : OnEraseBkgnd (CDC* pDC)
{
// Create a pruple brush.
CBrush Brush (RGB (128 , 0 , 128) );
// Select the brush into the device context .
CBrush* pOldBrush = pDC��>SelcetObject (&brush);
// Get the area that needs to be erased .
CRect reClip ;
pDC��>GetCilpBox (&rcClip);
//Paint the area.
pDC��> PatBlt (rcClip.left , rcClip.top ,
rcClip.Width ( ) , rcClip.Height ( ) , PATCOPY );
//Unselect brush out of device context .
pDC��>SelectObject (pOldBrush );
// Return nonzero to half fruther processing .
return TRUE;
}
23����θı䴰�ڱ���
����CWnd : : SetWindowText���Ըı��κδ��ڣ������ؼ����ı��⡣
//Set title for application's main frame window .
AfxGetMainWnd ( ) ��> SetWindowText (_T("Application title") );
//Set title for View's MDI child frame window .
GetParentFrame ( ) ��> SetWindowText ("_T ("MDI Child Frame new title") );
//Set title for dialog's push button control.
GetDigitem (IDC_BUTTON) ��> SetWindowText (_T ("Button new title ") );
�����Ҫ�����Ĵ��ڵı��⣨ע���ؼ�Ҳ�Ǵ��ڣ���Ӧ�ÿ���ʹ�ð��ĵ���
�ĺ���AfxSetWindowText���ú�����AFXPRIV.H��˵������WINUTIL.CPP��ʵ�֣���
����������Ҳ���������AFXPRIV.H�а��ĵ����� ���Ժ��е�MFC�н��ĵ�����
AfxSetWindowText��ʵ�����£�
voik AFXAPI AfxSetWindowText (HWND hWndCtrl , LPCTSTR IpszNew )
{
itn nNewLen= Istrlen (Ipaznew);
TCHAR szOld [256];
//fast check to see if text really changes (reduces flash in the
controls )
if (nNewLen >_contof (szOld) ���
: : GetWindowText (hWndCrtl , szOld , _countof (szOld) !=nNewLen
���
Istrcmp (szOld , IpszNew )! = 0
{
//change it
: : SetWindowText (hWndCtrl , IpszNew );
}
}
24����η�ֹ��������˵������ʾ����ĵ���
�������ں�MDI�Ӵ��ڽ�ͨ������FWS_ADDTOTITLE���λ�� ���ϣ����
˵�����Զ�����ĵ��� �����ֹ�÷��λ�� ����ʹ��ClassWizard����
CWnd: : PreCreateWindow���ر�FWS_ADDTOTITLE���
BOOL CMainFrame : : PreCreateWindow (CREATESTRUCT&cs)
{
//Turn off FWS_ADDTOTITLE in main frame .
cs.styel & = ~FWS_ADDTOTITLE ;��
return CMDIFrameWnd : : PreCreateWindow (cs );
}
�ر�MDI�Ӵ��ڵ�FWS _ADDTOTITLE�����һ�����пձ���Ĵ��ڣ����Ե�
��CWnd: : SetWindowText�����ñ��⡣��ס�Լ����ñ���ʱҪ��ѭ�ӿڷ��ָ�ϡ�
25����λ�ȡ�йش������ڴ���ĵ�ǰ��Ϣ����Ϣ
����CWnd: : GetCurrentMessage���Ի�ȡһ��MSGָ�롣���磬����ʹ��
ClassWizard�������˵�������ӳ�䵽һ�������У�Ȼ�����GetCurrentMessage
��ȷ����ѡ�еIJ˵��
viod CMainFrame : : OnCommmonMenuHandler ( )
{
//Display selected menu item in debug window .
TRACE ("Menu item %u was selected . \n" ,
GetCruuentMessage ( ) ��> wParam );
}
--
�� ��Դ:��BBS ˮľ�廪վ bbs.net.tsinghua.edu.cn��[FROM: sapphire.ncic.a]
[������ҳ] [����������] [ȫ��������]
--
m;37m�� ��Դ:���Ͻ�ɺ� bbs.njupt.edu.cn��[FROM: pc05.info.njupt]m
--
[m[1;33m�� ��Դ:���ϴ�С�ٺ���Ϣ����վ bbs.nju.edu.cn��[FROM: a507yjh.nju.edu][m
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads