亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? linenumberedit.cpp

?? 《MFC窗口程序設(shè)計(jì)》書籍源碼 詳細(xì)講解MFC框架程序設(shè)計(jì)
?? CPP
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* ==========================================================================
	CLineNumberEdit
	Author :		Johan Rosengren, Abstrakt Mekanik AB
	Date :			2004-03-09
	Purpose :		CLineNumberEdit is a CEdit-derived class that displays 
					line numbers to the left of the text.
	Description :	The class uses the edit rect to make space for the line 
					numbers. The line numbers are relized through a special 
					CStatic-derived class, CLineNumberStatic. As soon as the 
					text is updated, the CLineNumberStatic is updated as 
					well.
	Usage :			The control can be dynamically created, or created from 
					a dialog template. The formatting string for the line 
					numbers can be set by calling SetLineNumberFormat (the 
					same format string as for CString::Format). By calling 
					SetMarginForegroundColor or SetMarginBackgroundColor 
					the fore- and background colors for the line number 
					display is set.
   ========================================================================
	Update :        Keith Bowes
	Date :          2004-04-13
	Purpose :       1. To allow CLineNumberEdit to properly change colour when
                       Enabled/Disabled or when system colours change.
                       Changing system colours only has a noticable effect when
                       a scheme such as Marine or Plum is chosen.
                    2. To allow a line number delta to be applied to the first
                       line number so the index does not have to start at zero.
                    3. To allow a max value to be specified to stop the line
                       count and to allow smarter size formatting.
	Description :   1. Added OnEnable and OnSysColorChange to detect when
                       a colour change is required. This allows the line number
                       area and CEdit area to update colours properly.
                       Added colour ref variables to hold enabled/disabled states
                       of the background/foreground colours.
                       In an attempt to allow previous functionality to take
                       precedence, if the colours are changed explicitly, the
                       system colours are no longer queried.
                    2. Added m_LineDelta, applied when line numbers are formatted.
                    3. Using m_maxval when > 0 to limit the max values and when
                       formatting colomn width.
						JRO: Added m_lineDelta as well.
    Usage :         1. Default behaviour is to change colours to reflect CEdit.
                       manually changing the colour will cause the colours to
                       only change to the specified colours.
                    2. SetLineNumberRange sets both min and max values.
                    3. SetLineNumberRange sets both min and max values.

    Comments :      - Perhaps line values should be stored as UINT's as negative
                      values may have unexpected results.
                    - CLineNumberEdit::m_format creates a duplicate of
                      CLineNumberStatic::m_format, is this needed?
						  JRO: Even though the the two classes are thightly coupled, 
						  this duplication of data makes it easier to decouple them. 
						  A small matter, but code reuse is Politically Correct,
						  and as such A Desirable Feature.
                    - Added options could allow different system colours to be
                      chosen and updated as system attributes are changed.
                    - if m_maxval is exceeded in the edit box, new lines
                      are added without line numbers. This might not be the
                      desired behaviour.
						JRO: I think this is rather nifty, actually. If I, as a 
						developer, sets the max number of lines to be numbered, 
						I also expect this to be the case :-)))
                    - It's not spelled wrong, just differently. ;0)
   ========================================================================
	Update :        Johan Rosengren
	Date :          2004-04-14
	Purpose		:	1. Allow deriving of CLineNumberEdit. 
	Description	:	1. Made the message handlers virtual.
	Usage :			1. Declare message handlers as virtual in derived 
					   classes. Note that CLineNumberEdit is not built to 
					   be derived from, however.
   ========================================================================
	Update :		Keith Bowes
	Date :			2004-04-22
	Purpose :		To allow processing of WM_LINESCROLL messages. 
	Description :	Added OnLineScroll to handle the message.
	Usage :			Now will call UpdateTopAndBottom if the message is
					received.
   ========================================================================
	Update :		Johan Rosengren
	Date :			2004-05-02
	Purpose :		Select complete line when a line-number is clicked
	Description :	Added registered user message, sent when the line-
					number static is clicked.
	Usage :			See urm_SELECTLINE in the code.
   ========================================================================*/

#include "stdafx.h"
#include "LineNumberEdit.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

// Registered message to allow selection of complete 
// lines by clicking the line number
UINT urm_SELECTLINE = ::RegisterWindowMessage( "_LINE_NUMBER_EDIT_SELECTLINE_" );

/////////////////////////////////////////////////////////////////////////////
// CLineNumberEdit
CLineNumberEdit::CLineNumberEdit()
/* ============================================================
	Function :		CLineNumberEdit::CLineNumberEdit
	Description :	constructor
     
	Return :		void
	Parameters :	none

	Usage :			

   ============================================================*/
{

	m_hWnd = NULL;
	m_line.m_hWnd = NULL;
	m_zero.cx = 0;
	m_zero.cy = 0;
	m_format = _T( "%05i" );
	m_LineDelta = 0;

	// Could default m_maxval to 99,999, but may cause problems 
	// if m_format is changed and m_maxval is not...
	m_maxval = 0;

	// Setting up so by defult the original hard-coded colour 
	// scheme is used when enabled and the system colours are 
	// used when disabled.
	m_bUseEnabledSystemColours = FALSE;
	m_bUseDisabledSystemColours = TRUE;
	m_EnabledFgCol = RGB( 0, 0, 0 );
	m_EnabledBgCol = RGB( 255, 255, 248 );
	m_DisabledFgCol = GetSysColor( COLOR_GRAYTEXT );
	m_DisabledBgCol = GetSysColor( COLOR_3DFACE );

	SetWindowColour();

}

CLineNumberEdit::~CLineNumberEdit()
/* ============================================================
	Function :		CLineNumberEdit::~CLineNumberEdit
	Description :	destructor
 
	Return :		void
	Parameters :	none

	Usage :			

   ============================================================*/
{
}

BEGIN_MESSAGE_MAP(CLineNumberEdit, CEdit)
	ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
	ON_WM_VSCROLL()
	ON_CONTROL_REFLECT(EN_VSCROLL, OnVscroll)
	ON_MESSAGE(WM_SETFONT, OnSetFont)
	ON_WM_SIZE()
	ON_MESSAGE(WM_SETTEXT, OnSetText)
	ON_WM_SYSCOLORCHANGE()
	ON_WM_ENABLE()
	ON_MESSAGE(EM_LINESCROLL, OnLineScroll)
	ON_REGISTERED_MESSAGE(urm_SELECTLINE, OnSelectLine)
END_MESSAGE_MAP()

void CLineNumberEdit::PreSubclassWindow() 
/* ============================================================
	Function :		CLineNumberEdit::PreSubclassWindow
	Description :	This function is called before the control 
					is subclassed for a control on a dialog 
					template, and during creation for 
					dynamically created controls.

	Return :		void
	Parameters :	none

	Usage :			Called from MFC

   ============================================================*/
{

	// Unfortunately, we can't change to ES_MULTILINE
	// during run-time.
	ASSERT( GetStyle() & ES_MULTILINE );

	// Creating the line number control
	SetLineNumberFormat( m_format );

}

/////////////////////////////////////////////////////////////////////////////
// CLineNumberEdit message handlers

void CLineNumberEdit::OnSysColorChange() 
/* ============================================================
	Function :		CLineNumberEdit::OnSysColorChange
	Description :	Handles WM_SYSCOLORCHANGE. User has changed
					the system colours, want to refresh.
 
	Return :		void
	Parameters :	void

	Usage :			Called from Windows

   ============================================================*/
{

	CEdit::OnSysColorChange();

    // update the CStatic with the new colours
    SetWindowColour( IsWindowEnabled() );

}

LRESULT CLineNumberEdit::OnSetText( WPARAM wParam, LPARAM lParam )
/* ============================================================
	Function :		CLineNumberEdit::OnSetText
	Description :	Handles WM_SETTEXT. We must update the line 
					numbers in the line number control as well.
 
	Return :		LRESULT			- From Def proc
	Parameters :	WPARAM wParam	- From Windows
					LPARAM lParam	- From Windows

	Usage :			Called from Windows

   ============================================================*/
{

	// Default processing
	LRESULT retval = DefWindowProc( WM_SETTEXT, wParam, lParam );
	UpdateTopAndBottom();
	return retval;

}

void CLineNumberEdit::OnChange() 
/* ============================================================
	Function :		CLineNumberEdit::OnChange
	Description :	Mapped to EN_CHANGE. We must handle 
					EN_CHANGE to let the line-number control 
					reflect changes to the edit box content.
 
	Return :		void
	Parameters :	none

	Usage :			Called from Windows

   ============================================================*/
{

	UpdateTopAndBottom();

}

void CLineNumberEdit::OnVscroll() 
/* ============================================================
	Function :		CLineNumberEdit::OnVscroll
	Description :	Mapped to EN_VSCROLL. We update the line 
					numbers in the line number control
 
	Return :		void
	Parameters :	none

	Usage :			Called from Windows

   ============================================================*/
{

	UpdateTopAndBottom();

}

void CLineNumberEdit::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar ) 
/* ============================================================
	Function :		CLineNumberEdit::OnVScroll
	Description :	Handles WM_VSCROLL. We handle WM_VSCROLL 
					in addition to the notification EN_VSCROLL, 
					to handle scrollbar dragging as well
 
	Return :		void
	Parameters :	UINT nSBCode			- From Windows
					UINT nPos				- From Windows
					CScrollBar* pScrollBar	- From Windows

	Usage :			Called from Windows

   ============================================================*/
{

	CEdit::OnVScroll( nSBCode, nPos, pScrollBar );
	UpdateTopAndBottom();

}

LRESULT CLineNumberEdit::OnLineScroll( WPARAM wParam, LPARAM lParam ) 
/* ============================================================
	Function	:	CLineNumberEdit::OnLineScroll
	Description	:	Mapped to EM_LINESCROLL. We update the line 
					numbers in the line number control.
     
	Return		:	void
	Parameters	:	none
	Usage		:	Called from Windows
   ============================================================*/
{

	// Default processing
	LRESULT retval = DefWindowProc( EM_LINESCROLL, wParam, lParam );
	UpdateTopAndBottom();
	return retval;

}

LRESULT CLineNumberEdit::OnSetFont( WPARAM wParam, LPARAM lParam )
/* ============================================================
	Function :		CLineNumberEdit::OnSetFont
	Description :	Mapped to WM_SETFONT. We must recalculate 
					the line number control size as well.
 
	Return :		LRESULT			- Always 0
	Parameters :	WPARAM wParam	- From Windows
					LPARAM lParam	- From Windows

	Usage :			Called from Windows

   ============================================================*/
{

	DefWindowProc( WM_SETFONT, wParam, lParam );
	// We resize the line-number
	// field
	Prepare();
	return 0;

}

void CLineNumberEdit::OnSize( UINT nType, int cx, int cy ) 
/* ============================================================
	Function :		CLineNumberEdit::OnSize
	Description :	Handles WM_SIZE. Recalculates the line 
					number control size as well.
 
	Return :		void
	Parameters :	UINT nType	- From Windows
					int cx		- From Windows
					int cy		- From Windows

	Usage :			Called from Windows

   ============================================================*/
{

	CEdit::OnSize( nType, cx, cy );

	// If we have the line-number
	// control, it must be resized 
	// as well.
	if( m_line.m_hWnd )
		Prepare();
 
}

void CLineNumberEdit::OnEnable( BOOL bEnable ) 
/* ============================================================
	Function :		CLineNumberEdit::OnEnable
	Description :	Handles WM_ENABLE. Calls to set colours.
 
	Return :		void
	Parameters :	BOOL bEnable - From Windows

	Usage :			Called from Windows.

   ============================================================*/
{

	CEdit::OnEnable( bEnable );
    SetWindowColour( bEnable );

}

LRESULT CLineNumberEdit::OnSelectLine(WPARAM wParam, LPARAM /*lParam*/ )
/* ============================================================
	Function :		CLineNumberEdit::OnSelectLine
	Description :	Handler for the urm_SELECTLINE registered
					message. Will select the line in wParam.
					
	Return :		LRESULT			-	Not used
	Parameters :	WPARAM wParam	-	The line to select
					LPARAM lParam	-	Not used
					
	Usage :			Called from MFC. Use 
					SendMessage( urm_SELECTLINE, line ) from 
					code.

   ============================================================*/
{

	// Calc start and end position of the line
	int lineno = wParam + GetScrollPos( SB_VERT );
	int start = LineIndex( lineno );
	int end = LineIndex( lineno + 1 );
	SetSel( start, end - 1 );
	return 0;

}

void CLineNumberEdit::SetWindowColour( BOOL bEnable /*= TRUE*/ )
/* ============================================================
	Function :		CLineNumberEdit::SetWindowColour
	Description :	Handles changing window colours.
 
	Return :		void
	Parameters :	BOOL bEnable -	flag if set enabled/disabled 
									colours

	Usage :			Called to change colours in the edit box.

   ============================================================*/
{

    if (m_bUseEnabledSystemColours)
    {
		// re-query the system colours in case they have changed.
		m_EnabledFgCol = GetSysColor( COLOR_WINDOWTEXT );
		m_EnabledBgCol = GetSysColor( COLOR_WINDOW );
    }

    if (m_bUseDisabledSystemColours)
    {
		// re-query the system colours in case they have changed.
		m_DisabledFgCol = GetSysColor( COLOR_GRAYTEXT );
		m_DisabledBgCol = GetSysColor( COLOR_3DFACE );
    }

    // change the colour based on bEnable
    if (bEnable)
    {
        m_line.SetFgColor( m_EnabledFgCol, TRUE );
        m_line.SetBgColor( m_EnabledBgCol, TRUE );
    } else {
        m_line.SetFgColor( m_DisabledFgCol, TRUE );
        m_line.SetBgColor( m_DisabledBgCol, TRUE );
    }

}

void CLineNumberEdit::UseSystemColours( BOOL bUseEnabled /*= TRUE*/, BOOL bUseDisabled /*= TRUE*/ )
/* ============================================================
	Function :		CLineNumberEdit::UseSystemColours
	Description :	Sets the Use*SystemColours flags.
 
	Return :		void
	Parameters :	BOOL bEnabled	-	flag if to use enabled 
										system colours
					BOOL bDisabled	-	flag if to use disabled 
										system colours

	Usage :			Called to change colours in the edit box

   ============================================================*/
{

    m_bUseEnabledSystemColours = bUseEnabled;
    m_bUseDisabledSystemColours = bUseDisabled;
    BOOL bEnable = TRUE;
    if (::IsWindow(m_hWnd))
        bEnable = IsWindowEnabled();

    SetWindowColour( bEnable );

}

/////////////////////////////////////////////////////////////////////////////
// CLineNumberEdit private implementation

void CLineNumberEdit::Prepare()
/* ============================================================
	Function :		CLineNumberEdit::Prepare
	Description :	Setting the edit rect for the control and 
					either create or move the line number 
					control. Also sets the top- and bottom 
					line numbers.

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费精品国自产拍在线不卡| 欧美韩日一区二区三区| 色偷偷88欧美精品久久久| 从欧美一区二区三区| 狠狠色2019综合网| 久久电影网电视剧免费观看| 秋霞电影网一区二区| 三级影片在线观看欧美日韩一区二区 | 久久精品国产免费| 水蜜桃久久夜色精品一区的特点| 午夜久久久影院| 视频一区欧美精品| 免费视频一区二区| 国内成人自拍视频| 国产91精品一区二区麻豆亚洲| 成人精品小蝌蚪| 一本大道久久精品懂色aⅴ| 在线欧美一区二区| 7777精品伊人久久久大香线蕉完整版 | 国产精品一级黄| 国产精品99久| 99这里只有精品| 色综合色狠狠综合色| 欧美亚洲国产一区二区三区va | 国产色婷婷亚洲99精品小说| 国产精品免费视频观看| 亚洲理论在线观看| 日韩中文欧美在线| 国产精品一区专区| 91麻豆免费在线观看| 欧美日韩国产中文| 欧美精品一区二区久久婷婷| 亚洲欧洲日韩综合一区二区| 亚洲国产精品一区二区www | 欧美久久久久久久久| 日韩精品在线看片z| 中文文精品字幕一区二区| 亚洲欧美一区二区三区久本道91| 天堂蜜桃91精品| 国产一区不卡在线| 91久久精品一区二区| 欧美成人综合网站| 综合久久给合久久狠狠狠97色| 天堂影院一区二区| 国产91高潮流白浆在线麻豆| 在线观看视频欧美| 久久免费的精品国产v∧| 亚洲视频你懂的| 麻豆国产精品777777在线| 成人精品亚洲人成在线| 欧美一区中文字幕| 日韩一区有码在线| 精品一区二区三区免费| 91香蕉视频在线| 日韩欧美一级特黄在线播放| 亚洲欧美激情小说另类| 精品亚洲成a人在线观看| 91精彩视频在线| 精品国产凹凸成av人网站| 亚洲欧美乱综合| 国产一区二区三区四区五区入口| 色婷婷国产精品久久包臀| 久久影院午夜论| 性感美女久久精品| av一二三不卡影片| 精品人伦一区二区色婷婷| 亚洲一区二区在线免费观看视频| 国产91精品在线观看| 日韩精品一区二区三区三区免费| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 亚洲va天堂va国产va久| 91在线小视频| 国产日产欧美一区| 久久99国产精品久久| 欧美日韩免费电影| 亚洲欧美日韩一区二区| 福利一区二区在线观看| 日韩一卡二卡三卡| 亚洲成a人片在线观看中文| 北条麻妃国产九九精品视频| 久久影院视频免费| 免费高清在线一区| 欧美日韩精品免费| 一区二区欧美在线观看| 成人在线视频首页| 国产欧美1区2区3区| 久久99久久精品| 日韩一区二区三区观看| 亚洲国产日韩av| 91成人在线免费观看| 亚洲日本电影在线| av在线播放成人| 国产精品免费看片| 国产69精品久久777的优势| 久久综合九色综合97婷婷女人| 老司机免费视频一区二区三区| 91麻豆精品国产自产在线| 亚洲大型综合色站| 欧美日韩免费不卡视频一区二区三区| 夜夜嗨av一区二区三区网页| 色综合夜色一区| 亚洲黄色小说网站| 欧美在线不卡视频| 亚洲高清视频中文字幕| 欧美日韩免费一区二区三区| 亚洲一区二区av在线| 欧美三级乱人伦电影| 日日嗨av一区二区三区四区| 69堂亚洲精品首页| 蜜桃一区二区三区在线观看| 欧美成人女星排名| 国产成人在线网站| 国产精品乱人伦| 99久久国产综合精品色伊| 成人免费在线播放视频| 91麻豆国产精品久久| 亚洲国产成人91porn| 欧美一级二级三级蜜桃| 六月婷婷色综合| 久久久亚洲综合| 波多野结衣视频一区| 一区二区三区电影在线播| 91精品一区二区三区久久久久久| 日本女优在线视频一区二区| 精品国产乱码久久久久久免费| 国产激情一区二区三区桃花岛亚洲| 国产欧美视频一区二区三区| 97超碰欧美中文字幕| 五月激情综合色| 久久久影视传媒| 91论坛在线播放| 日本欧美一区二区三区| 国产女人18毛片水真多成人如厕 | 欧美色老头old∨ideo| 青青青伊人色综合久久| 久久精品亚洲精品国产欧美kt∨| 97精品国产露脸对白| 免费观看久久久4p| 国产精品乱人伦| 91精品国产综合久久福利| 国产又粗又猛又爽又黄91精品| 综合久久一区二区三区| 在线播放欧美女士性生活| 国产成人精品在线看| 亚洲高清在线精品| 久久久99精品免费观看| 日本二三区不卡| 国产在线乱码一区二区三区| 亚洲乱码国产乱码精品精小说| 欧美一区二区视频在线观看2020 | 国产欧美一区二区精品婷婷| 欧美综合在线视频| 国产伦精品一区二区三区免费| 亚洲男女一区二区三区| 精品国产三级电影在线观看| 色综合天天综合网国产成人综合天 | 国产精品久久久久久久久免费桃花 | 7777精品伊人久久久大香线蕉完整版 | 欧美专区日韩专区| 精品写真视频在线观看 | 99久久国产免费看| 另类小说一区二区三区| 又紧又大又爽精品一区二区| 久久久www免费人成精品| 欧美日韩中文一区| 成人app下载| 韩国女主播成人在线观看| 亚洲va中文字幕| 亚洲欧美一区二区三区久本道91| 精品粉嫩超白一线天av| 欧美在线一二三| av在线播放一区二区三区| 国产一区免费电影| 午夜精品aaa| 一区二区三区四区亚洲| 国产农村妇女毛片精品久久麻豆 | 久久免费电影网| 欧美理论在线播放| 色噜噜狠狠成人网p站| 国产v综合v亚洲欧| 久久99精品久久久久久动态图| 亚洲一区二区免费视频| 一区在线观看免费| 中文字幕精品一区| 久久嫩草精品久久久精品一| 日韩欧美国产一区在线观看| 欧美性受xxxx| 日本道色综合久久| 91性感美女视频| 成年人午夜久久久| 国产激情视频一区二区在线观看| 久久精品72免费观看| 日韩成人一级片| 天堂影院一区二区| 五月开心婷婷久久| 石原莉奈在线亚洲二区| 蜜臀av一区二区三区| 丝袜脚交一区二区| 香蕉乱码成人久久天堂爱免费| 亚洲国产日韩一区二区|