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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? inplace_edit.shtml.htm

?? 一套比較全的編輯框控制教程。。。附源代碼。
?? HTM
字號:
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="zafir anjum">
<title>edit controls - table of contents</title>
<meta name="description" content="source code for various windows controls">
<meta name="keywords" content="mfc source code edit controls">
</head>

<body background="../di2001.jpg"
tppabs="http://www.codeguru.com/fancyhome/back.gif" bgcolor="#ffffff">

<h3 align="center"><font color="#aoao99">inplace edit control</font></h3>

<hr>

<p>this code was contributed by <a href="mailto:marioc@computer.org">mario contestabile</a>.
</p>

<p>have you ever wanted to allow users of your mfc application to rename strings contained
in various controls? if so, you probably included a &quot;rename&quot; button next to your
control. take a listbox for example. when &quot;rename&quot; is pressed you retrieve the
current selection from the listbox, display it in a dialog for the user to modify, and
then modify the string in the listbox to the new string. not a very aesthetic or efficient
method. </p>

<p>a better solution is to dynamically create an edit control on top of the area where the
displayed string is, preferably following a double-click of the string in the listbox. you
could re-use this edit class throughout your application, thus removing the need for
&quot;rename&quot; buttons. this is common technique. </p>

<p>one method our smartedit can use to notify its parent that the user is done with it
(&lt;enter&gt; was pressed for example) is to send its parent a custom message. but how
does the parent (in our example, a dialog with a list control) know what new string the
user typed? we could pass &quot;this&quot; to our smartedit, which in turn could call a
dialog function passing it the new string. although convenient, this method would not make
our smartedit very re-usable, since it would have to know a) the type of cdialog our
parent is and b) every different parent dialog would need to implement this same function
to accept the new string. </p>

<p>the method i chose was to post a message to the parent, essentially telling it
&quot;hay, the user possibly modified this string you sent me. here it is, do as you
please.&quot; but right before posting this message to its parent, smartedit places the
text on the clipboard. this way, smartedit doesn't care what kind of window its parent is,
and the parent can handle it as it seems fit. </p>

<p>||||| <b>figure 1</b> &quot;mydialog.cpp lbn_dblclk handler&quot; </p>

<pre><tt><font color="#990000">
void mydialog::ondblclkstringinlistbox()
{
	const int nindex = m_ctl.getcursel();
	if(nindex == lb_err) return;
	cstring string;
	m_ctl.gettext(nindex, string);
	rect rect;
	int result = m_ctl.getitemrect(nindex, &amp;rect);
	if(result==lb_err) return;
	smartedit* pedit = new smartedit;
	rect.bottom += 4;
	pedit-&gt;create(ws_child | ws_visible | ws_border | es_autohscroll,
		rect, &amp;m_ctl, (uint)-1);
	pedit-&gt;setwindowtext(string);
	pedit-&gt;setfocus();
	pedit-&gt;limittext(mymax_len); // user defined maximum length of string
}
</font></tt></pre>

<p>figure 1 shows the on_lbn_dblclk handler from the mydialog class. this is the handler
called when the user double-clicks a string in the listbox. we first determine which, if
any, of the listbox strings is currently selected. note getcursel() can only be used with
a single-selection listbox. the actual string is then retrieved from the listbox. the
dimension of the item's rectangle is determined since this will be the size and position
of our smartedit. the smartedit is created on the heap, and its create() function called
which creates the windows edit control and attaches it to the cedit object. </p>

<p>||||| <b>figure 2</b> &quot;smartedit.cpp implementation&quot; </p>

<pre><tt><font color="#990000">
smartedit::smartedit()  : bescapekey(false)
{
}

begin_message_map(smartedit, cedit)
//{{afx_msg_map(smartedit)
on_wm_killfocus()
//}}afx_msg_map
end_message_map()


void smartedit::onkillfocus(cwnd*)
{
	postmessage(wm_close, 0, 0);
	if(!bescapekey){
		cstring str;
		getwindowtext(str);
		coledatasource *pds = new coledatasource;
		ptchar cp = (ptchar)globalalloc(gmem_fixed, (str.getlength() *
			sizeof(tchar)) + sizeof(tchar));
		_tcscpy(cp, str);
		pds-&gt;cacheglobaldata(cf_text, cp);
		pds-&gt;setclipboard();
		getowner()-&gt;postmessage(editclassmsg);
		trace1(&quot;smartedit::onkillfocus  posting message to my owner, i have put
			[%s] on the clipboard for him\n&quot;, cp);
	}
}

// &quot;override&quot; base class member function
void smartedit::postncdestroy()
{
	delete this;
}

// &quot;augment&quot; base class member function
bool smartedit::pretranslatemessage(msg* pmsg)
{
	if(pmsg-&gt;wparam == vk_return){
		postmessage(wm_close, 0, 0);
		return true;
	}else if(pmsg-&gt;wparam == vk_escape){
		postmessage(wm_close, 0, 0);
		return bescapekey = true;
	}
	
	return cedit::pretranslatemessage(pmsg);
}
</font></tt></pre>

<p>figure 2 shows smartedit's implementation. it is straightforward, but perhaps the
postncdestroy function needs further explanation. remember this object was created on the
heap with &quot;new&quot; in mydialog. that means someone must &quot;delete&quot; it.
since postncdestroy() is called after the window has been destroyed, it is a perfect time
to delete the object. modeless dialogs use this method of self-destruction. </p>

<p>the most important action occurs in its onkillfocus() handler. when the smartedit loses
focus by a means other than the <escape> key, it retrieves the new string with getwindowtext().
the string is then placed on the clipboard using a coledatasource. coledatasource is a
source actor in ole data transfer. notice i used ptchar, and _tcscpy() to allow the code
to be transparantly compiled in both ansi and unicode applications. after the string is
placed on the clipboard, it sends editclassmsg (simply #defined as wm_app + 100) to its
parent. </p>

<p>||||| <b>figure 3</b> &quot;mydialog.cpp editclassmsg handling code&quot; </p>

<pre><tt><font color="#990000">
bool mydialog::pretranslatemessage(msg* pmsg)
{
	if(editclassmsg == pmsg-&gt;message){
		coledataobject data;
		
		hclipboard()){           
			if(data.isdataavailable(cf_text)){ 
				hglobal hg;
				if(hg = data.getglobaldata(cf_text)){
					cstring str = (lpctstr)globallock(hg);
					trace1(&quot;mydialog::pretrans(editclassmsg)  this is on the clipboard [%s]\n&quot;, str);
					globalunlock(hg);
					newstring(str); // appropriate action
				}
			}
			data.release();
		}
		return true;
	}
	
	return cdialog::pretranslatemessage(pmsg);
}
</font></tt></pre>

<p>fogure 3 shows what mydialog does when handling a editclassmsg message. it knows
there's a string on the clipboard, so uses coledataobject to retrieve it. coledataobject
is the destination actor in ole data transfer. the string from the clipboard is simply
passed to a helper function, new string() in this case, which will decide a course of
action. to replace the string that was 'underneath' the string double-clicked in the
listbox, you would keep the item index obtained in ondblclkstringinlistbox(). for example,
&quot;const int nindex = m_ctl.getcursel();&quot; could be replaced by &quot;m_nindex =
m_ctl.getcursel();&quot; after which newstring() would use mydialog's member variable
'm_nidex' as the index for the new string. </p>

<p>we now have a fully functional smartedit capable of notifying its parent (using ole)
that it has accepted a string. one problem still remains. can you spot it? since the
smartedit object 'kills' itself using 'delete' in postncdestroy(), it *must* be created on
the heap using 'new'. if we don't enforce this, someone will inevitably use our smartedit
in a ddx_control(). this will cause serious havoc when the &quot;delete this;&quot; line
is executed. so what can we do? </p>

<p>the answer is simple. make the ~smartedit destructor protected. this still allows the
class to be used in inheritance, but prevents its usage on the stack. </p>

<p>posted: march, 8, 98 </p>
</body>
</html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品三级视频| 欧美日本视频在线| 精品一区二区精品| 五月婷婷激情综合| 视频一区免费在线观看| 一区二区三区四区蜜桃| 亚洲一区二区三区爽爽爽爽爽| 亚洲视频图片小说| 亚洲码国产岛国毛片在线| 亚洲欧美偷拍卡通变态| 樱花影视一区二区| 亚洲成人1区2区| 日精品一区二区| 国产在线视频不卡二| 国产suv精品一区二区三区| 成人小视频免费观看| 99精品视频中文字幕| 欧美在线观看一二区| 欧美高清激情brazzers| 精品国产伦理网| 中文字幕制服丝袜一区二区三区| 一区二区三区在线看| 日韩福利视频网| 国产福利一区二区三区| 一本久久a久久免费精品不卡| 欧洲中文字幕精品| 欧美一区二区三区视频在线 | 久久精品国产澳门| 国产一区二区三区电影在线观看| 国产福利一区二区| 欧美系列亚洲系列| 欧美精品一二三区| 国产欧美精品一区二区三区四区| 亚洲精选一二三| 欧美aaa在线| 99久久夜色精品国产网站| 8x福利精品第一导航| 日本一区二区三区dvd视频在线 | 亚洲1区2区3区4区| 国产精品亚洲一区二区三区在线 | 精品在线观看视频| 色欧美乱欧美15图片| 精品少妇一区二区三区在线视频| 国产精品大尺度| 久久99国产精品免费网站| 91丨国产丨九色丨pron| 精品国产电影一区二区| 一个色在线综合| 国产福利一区二区| 欧美变态tickle挠乳网站| 亚洲欧美日韩系列| 国产九色sp调教91| 日韩亚洲欧美在线观看| 亚洲精品乱码久久久久| 福利电影一区二区| 日韩你懂的在线观看| 亚洲一区在线播放| 91视视频在线观看入口直接观看www | 91精品国产一区二区| 综合久久一区二区三区| 国产夫妻精品视频| 亚洲精品一区在线观看| 人人精品人人爱| 4438x亚洲最大成人网| 亚洲精品午夜久久久| 成人av资源在线| 国产日韩av一区二区| 国内精品伊人久久久久av影院| 欧美肥妇bbw| 天天综合色天天综合| 欧美伊人精品成人久久综合97| 国产精品福利一区二区三区| 国产成人免费视频| 精品久久久三级丝袜| 久久精品国产免费| 精品成人一区二区三区| 国模冰冰炮一区二区| 精品久久久久av影院| 精品夜夜嗨av一区二区三区| 欧美成人一区二区三区| 久久狠狠亚洲综合| 久久蜜臀中文字幕| 丰满岳乱妇一区二区三区| 久久久av毛片精品| 成人黄色综合网站| 亚洲丝袜另类动漫二区| 色八戒一区二区三区| 亚洲自拍与偷拍| 91精品国产综合久久香蕉麻豆 | 久久九九久精品国产免费直播| 国产精品18久久久久久久网站| 久久九九国产精品| 99re热这里只有精品免费视频| 亚洲人吸女人奶水| 欧美精品成人一区二区三区四区| 亚洲6080在线| 久久久久久电影| 91社区在线播放| 天堂成人国产精品一区| 亚洲精品一区二区三区四区高清 | 99精品国产热久久91蜜凸| 一区二区三区中文字幕电影| 欧美日韩第一区日日骚| 久久国产精品第一页| 亚洲国产精品成人综合| 99re这里只有精品首页| 蜜臀久久99精品久久久画质超高清 | 欧美理论片在线| 极品尤物av久久免费看| 亚洲欧美日韩系列| 日韩精品专区在线影院观看| av中文字幕亚洲| 天天综合天天做天天综合| 欧美高清一级片在线观看| 欧美亚一区二区| 国产凹凸在线观看一区二区| 亚洲韩国一区二区三区| 久久久国际精品| 欧美日韩一区二区不卡| 懂色av一区二区三区蜜臀| 五月天一区二区三区| 国产欧美一区视频| 7777精品伊人久久久大香线蕉最新版| 国产精品亚洲成人| 日韩av午夜在线观看| 国产精品国产三级国产aⅴ中文 | 在线观看日韩毛片| 国产在线精品一区在线观看麻豆| 亚洲精品精品亚洲| 欧美国产精品劲爆| 久久综合国产精品| 91精品久久久久久久久99蜜臂| 色乱码一区二区三区88| 国产99久久久国产精品潘金| 青青草国产成人av片免费| 亚洲最色的网站| 亚洲视频电影在线| 国产精品高潮久久久久无| 国产日韩欧美精品在线| 日韩欧美久久久| 3atv一区二区三区| 欧美三区在线观看| 欧美怡红院视频| 欧美在线不卡视频| 色噜噜狠狠成人网p站| 91色|porny| 成人短视频下载| 成人黄色在线网站| 99久免费精品视频在线观看| 国产99精品视频| 国产91精品一区二区| 国产精品99久久久久久久vr | 色嗨嗨av一区二区三区| 91免费观看视频在线| 99在线精品观看| 99视频精品在线| 91免费精品国自产拍在线不卡| 成人福利在线看| 91论坛在线播放| 欧美性生活大片视频| 欧美午夜精品久久久| 欧美日韩一级黄| 欧美一级黄色录像| 久久嫩草精品久久久精品一| 中文字幕欧美激情一区| 国产精品你懂的在线| 一区二区三区丝袜| 日韩影院免费视频| 国产一区二区三区免费播放 | 亚洲综合色婷婷| 亚洲成人动漫精品| 久久国产精品99久久人人澡| 国产尤物一区二区| www.久久精品| 在线免费不卡电影| 日韩免费观看高清完整版| 久久亚洲综合av| 亚洲欧洲在线观看av| 亚洲成人激情自拍| 国产主播一区二区三区| 色综合av在线| 欧美一区二区三区人| 欧美激情一区二区三区在线| 亚洲精品日韩一| 蜜臀99久久精品久久久久久软件| 国产二区国产一区在线观看| 91老师国产黑色丝袜在线| 欧美一区二区网站| 国产精品久久久久久久蜜臀| 亚洲成人自拍偷拍| 成人免费毛片app| 欧美一区二区三区电影| 国产精品免费网站在线观看| 亚洲高清在线精品| 国产激情精品久久久第一区二区| 欧洲一区二区三区在线| 国产免费观看久久| 美女一区二区三区| 91高清视频在线| 国产精品免费免费|