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

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

?? formatbar.shtml

?? mfc資源大全包含MFC編程各個方面的源碼
?? SHTML
?? 第 1 頁 / 共 2 頁
字號:
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Zafir Anjum">
   <TITLE>Rich Edit Control - Providing a Format toolbar</TITLE>
</HEAD>
<body background="../fancyhome/back.gif" bgcolor="#FFFFFF" link="#B50029" vlink="#8E2323" alink="#FF0000" bgproperties="fixed">
<table WIDTH="100%">
<tr WIDTH="100%">
<td align=center><!--#exec cgi="/cgi/ads.cgi"--><td>
</tr>
</table>


<CENTER>
<H3>
<FONT COLOR="#AOAO99">Providing a Format toolbar</FONT></H3></CENTER>

<HR>

A rich edit control without UI to change the character and paragraph formatting is not really very useful as a rich text editor. In this section we will develop code for a Format toolbar that can be used with a CRichEditView derivative. There is no hard link between the toolbar itself and the CRichEditView, so we can even use this toolbar with a sub-class of CRichEditCtrl. The only extra work would be to make sure that some of the notifications sent by the toolbar gets forwarded to the control.

<P>There is a huge scope for improvement in the code given here, but intergrating this in your application should be fairly easy. When you feel that you need more functionality out of the Format toolbar, take a look at the WordPad sample that comes with your Visual C++ CD. This sample is the actual source code for the WordPad applet that ships with Windows. Be warned though, it takes a little time to understand the code. 

<H4>Step 1: Create a toolbar control resource</H4>
The first thing we need to do is create a toolbar control resource. Actually you can create a toolbar from a bitmap but it is lot easier to work with a toolbar control. The resource editor has quite a good support for it.

<P>This is what the toolbar control looks like in the resource editor. Give the toolbar control resource the ID - IDR_FORMATBAR. Actually choose any name but you should be willing to replace all occurance of IDR_FORMATBAR in the code below with the new ID.


<P>The first two buttons are place holders for the Font Name combobox and the Font Size combobox. The other buttons are pretty obvious. Once we have the images, we should go ahead and set the properties. Besides specifying an ID for each button, we should also provide the prompt string. The prompt string is used for the help text that appears in the status bar and the tooltip text.



<P>The 'Toolbar Button Properties' dialog is shown above for the Font Name button. The table below lists suggested IDs and prompt strings - in the same sequence they appear in the toolbar.

<p>
<TABLE BORDER=1 WIDTH="100%" >
<TR><TD WIDTH="30%" BGCOLOR="#A0A0A0">ID</A></TD><TD WIDTH="70%" BGCOLOR="#A0A0A0">Prompt</TD></TR>
<TR><TD>IDC_FONTNAME</A></TD><TD>Changes the font of the selection\nFont</TD></TR>
<TR><TD>IDC_FONTSIZE</A></TD><TD>Changes the font size of the selection\nFont Size</TD></TR>
<TR><TD>ID_CHAR_BOLD</A></TD><TD>Makes the selection bold (toggle)\nBold</TD></TR>
<TR><TD>ID_CHAR_ITALIC</A></TD><TD>Makes the selection italics (toggle)\nItalic</TD></TR>
<TR><TD>ID_CHAR_UNDERLINE</A></TD><TD>Formats the selection with a continuous underline (toggle)\nUnderline</TD></TR>
<TR><TD>ID_CHAR_COLOR</A></TD><TD>Formats the selection with a color\nColor</TD></TR>
<TR><TD>ID_PARA_LEFT</A></TD><TD>Left-justifies paragraphs\nLeft Justify</TD></TR>
<TR><TD>ID_PARA_CENTER</A></TD><TD>Center-justifies paragraphs\nCenter Justify</TD></TR>
<TR><TD>ID_PARA_RIGHT</A></TD><TD>Right-justifies paragraph\nRight Justify</TD></TR>
<TR><TD>ID_INSERT_BULLET</A></TD><TD>Inserts a bullet on this line\nBullet</TD></TR>
</TABLE>


<H4>Step 2: Create a CFormatBar class</H4>
I used the Class Wizard to create this class. The class wizard did not have the option of specifying the CToolBar class as the base class, so I chose the CToolBarCtrl class as the base class and then in the source files, changed it to CToolBar. The advantage of using a CToolBar is that it is already hooked into the Doc-View architecture of MFC. This helps in updating the toolbar and the status bar.

<P>The code for the CFormatBar class header file is given below. You will notice that besides declaring the CFormatBar class, it also declares CHARNMHDR struct. This is used to send custom notification messages whenever the font name or the font size changes. The FN_SETFORMAT and FN_GETFORMAT defines are the custom notification message values. 

<P>The CFormatBar constructor takes a default value which is set to IDR_FORMATBAR. This is useful only if you already have a resource with the ID IDR_FORMATBAR that you are using for some other purpose.

<PRE><TT><FONT COLOR="#990000">#if !defined(AFX_FORMATBAR_H__76705223_1E1F_11D1_830C_5CB0BB000000__INCLUDED_)
#define AFX_FORMATBAR_H__76705223_1E1F_11D1_830C_5CB0BB000000__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// FormatBar.h : header file
//



/////////////////////////////////////////////////////////////////////////////
// CFormatBar window

struct CHARNMHDR : public NMHDR
{
	CHARFORMAT cf;
	CHARNMHDR() {cf.cbSize = sizeof(CHARFORMAT);}
};

// Define format notifications constant
#define FN_SETFORMAT	0x1000
#define FN_GETFORMAT	0x1001


class CFormatBar : public CToolBar
{
// Construction
public:
	enum { IDD = IDR_FORMATBAR };
	CFormatBar(UINT nID = IDD );

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFormatBar)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CFormatBar();

protected:
	void FillFontName( CDC *pDC );
	virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);


protected:
	CComboBox	m_cmbFontName;
	CComboBox	m_cmbFontSize;

	// Generated message map functions
protected:
	afx_msg void OnSelectFontName();
	afx_msg void OnSelectFontSize();

	//{{AFX_MSG(CFormatBar)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

private:
	UINT nToolbarID;
	static int CALLBACK EnumFontFamProc(ENUMLOGFONT *lpelf, 
					NEWTEXTMETRIC *lpntm,
					int nFontType,
					LPARAM lParam);

};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FORMATBAR_H__76705223_1E1F_11D1_830C_5CB0BB000000__INCLUDED_)
</FONT></TT></PRE>


<P>The code in the implementation file for CFormatBar now follows.

<PRE><TT><FONT COLOR="#990000">/////////////////////////////////////////////////////////////////////////////
// FormatBar.cpp : implementation file
//

#include "stdafx.h"
#include "RichEdit.h"
#include "FormatBar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFormatBar

// Declare const array of font sizes
const static int nFontSizes[] = 
	{8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72};


CFormatBar::CFormatBar(UINT nID )
{
	nToolbarID = nID;
}

CFormatBar::~CFormatBar()
{
}


BEGIN_MESSAGE_MAP(CFormatBar, CToolBar)
	//{{AFX_MSG_MAP(CFormatBar)
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
	ON_CBN_SELENDOK(IDC_FONTNAME, OnSelectFontName)
	ON_CBN_SELENDOK(IDC_FONTSIZE, OnSelectFontSize)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFormatBar message handlers

int CFormatBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CToolBar::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// Load the toolbar
	if( !LoadToolBar( nToolbarID ) )
		return -1;


	// Get the average char width
	CClientDC dc(this);

	// Determine the size required by the font comboboxes
	// We will use the DEFAULT_GUI_FONT
	HGDIOBJ hFont = GetStockObject( DEFAULT_GUI_FONT );
	CFont font;
	font.Attach( hFont );
	dc.SelectObject( font );

	TEXTMETRIC tm;
	dc.GetTextMetrics( &tm );
	int cxChar = tm.tmAveCharWidth;
	int cyChar = tm.tmHeight + tm.tmExternalLeading;


	// Create the Font Name combo
	CRect rect; 
	GetItemRect( CommandToIndex(IDC_FONTNAME), &rect );
	rect.right = rect.left + (LF_FACESIZE+4)*cxChar;
	rect.bottom = rect.top + 16*cyChar;

	SetButtonInfo( CommandToIndex(IDC_FONTNAME), IDC_FONTNAME, 
				TBBS_SEPARATOR, rect.Width() );

	UINT nCreateStyle = WS_TABSTOP|WS_VISIBLE|WS_VSCROLL;
	if (!m_cmbFontName.Create(nCreateStyle|CBS_DROPDOWNLIST|CBS_SORT, 
		rect, this, IDC_FONTNAME))
	{
		TRACE0("Failed to create Font Name combo-box\n");
		return -1;
	}


	// Create Font Size combo
	GetItemRect( CommandToIndex(IDC_FONTSIZE), &rect );
	rect.right = rect.left + 10*cxChar;
	rect.bottom = rect.top + 16*cyChar;

	SetButtonInfo( CommandToIndex(IDC_FONTSIZE), IDC_FONTSIZE, 
				TBBS_SEPARATOR, rect.Width() );

	if (!m_cmbFontSize.Create(nCreateStyle|CBS_DROPDOWN|WS_HSCROLL, 
		rect, this, IDC_FONTSIZE))
	{
		TRACE0("Failed to create Font Size combo-box\n");
		return -1;
	}
	m_cmbFontSize.LimitText(4);


	// Set the font for the combo boxes to DEFAULT_GUI_FONT
	m_cmbFontName.SetFont(&font);
	m_cmbFontSize.SetFont(&font);

	// Fill the Font names in the Font Name combo
	::EnumFontFamilies( dc.m_hDC, NULL, (FONTENUMPROC)EnumFontFamProc, 
				(LPARAM) this );

	// Fill the Font Size combo
	CString sSize;
	int nSizeCount = sizeof(nFontSizes) / sizeof(nFontSizes[0]);
	for( int i=0; i < nSizeCount; i++ )
	{
		sSize.Format("%d", nFontSizes[i] );
		m_cmbFontSize.AddString( sSize );
	}

	return 0;
}

int CALLBACK CFormatBar::EnumFontFamProc(ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm,
					int nFontType, LPARAM lParam)
{
	CFormatBar* pWnd = (CFormatBar*)lParam;

	// Add the font name to the combo
	pWnd->m_cmbFontName.AddString(lpelf->elfLogFont.lfFaceName);

	return 1;		// 1 to continue enumeration
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区国产精华| 日韩高清不卡一区| 经典一区二区三区| 日本久久一区二区| 中文字幕一区二区日韩精品绯色| 国产成人精品亚洲午夜麻豆| 亚洲国产激情av| 91丨porny丨在线| 亚洲精选视频在线| 91精品国产91久久久久久一区二区| 日韩激情视频网站| 欧美经典一区二区| 欧美日韩在线三区| 成人一级视频在线观看| 亚洲一二三区在线观看| 日韩一级完整毛片| 99在线热播精品免费| 国产一区二区三区日韩| 国产精品毛片久久久久久| 色婷婷国产精品| 久久国产三级精品| 亚洲女爱视频在线| 日韩欧美国产三级| 日本道在线观看一区二区| 国内国产精品久久| 一区二区三区在线免费| 久久蜜桃一区二区| 日韩视频免费直播| 9191精品国产综合久久久久久| 成人丝袜18视频在线观看| 亚洲免费观看高清| 精品成人一区二区| 欧美一级生活片| 欧美欧美午夜aⅴ在线观看| 国产一区二区三区免费| 久久电影国产免费久久电影 | 91福利国产精品| 成人免费视频视频在线观看免费 | 国内成人免费视频| 国产成人av一区| 国产精品一区免费视频| 日韩高清欧美激情| 麻豆精品一区二区三区| 麻豆精品视频在线观看免费| 日韩影院在线观看| 日韩精品久久久久久| 亚洲bt欧美bt精品| 精品一区二区三区免费| 高清国产午夜精品久久久久久| 国产成人av电影在线观看| 粉嫩绯色av一区二区在线观看| 亚洲精品国产a| 在线观看欧美精品| 欧美日韩在线亚洲一区蜜芽| 日韩精品一区二区三区中文精品| 日韩一区二区三区在线视频| 在线不卡免费av| 中文字幕av在线一区二区三区| av电影在线观看完整版一区二区| 成人午夜激情片| 色综合一区二区三区| 色拍拍在线精品视频8848| 91在线观看美女| 国产欧美精品一区aⅴ影院| 樱桃国产成人精品视频| 99re热视频这里只精品| 日韩欧美电影一区| 日韩一区二区三区电影在线观看 | 中文字幕精品一区二区精品绿巨人| 久久久影视传媒| 日韩美女精品在线| 一区二区三区四区五区视频在线观看| 国产在线不卡一区| 欧美美女一区二区三区| 国产精品丝袜一区| 精油按摩中文字幕久久| 欧美日韩卡一卡二| 日韩中文字幕区一区有砖一区| 国产一区二区三区日韩| 欧美日韩大陆一区二区| 亚洲天堂免费看| 成人一区二区三区中文字幕| 欧美性大战久久久久久久蜜臀| 一区二区三区精品视频| 成人动漫一区二区三区| 国产丝袜美腿一区二区三区| 国产美女在线精品| 国产欧美日韩在线看| 成人免费黄色在线| 欧美高清一级片在线观看| 亚洲mv在线观看| 欧美精品一区二| 99久久99久久久精品齐齐| 久久久久久影视| 欧美日韩中文字幕精品| 美女任你摸久久| 久久蜜桃av一区二区天堂| 高清不卡在线观看av| 亚洲精品日产精品乱码不卡| 欧美日韩精品专区| 美女www一区二区| 一卡二卡三卡日韩欧美| 欧美精品乱码久久久久久| 国产在线精品一区二区不卡了 | 亚洲一区二区三区免费视频| 欧美三级中文字幕在线观看| 国内精品国产成人国产三级粉色 | 日韩精品福利网| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 欧美一区二区在线不卡| av电影在线观看不卡| 免费人成黄页网站在线一区二区| 精品国产3级a| 精品国产一区二区三区久久影院| 成人精品免费视频| 琪琪一区二区三区| 中文字幕一区二区三区色视频| 日韩午夜激情电影| 欧美日韩免费在线视频| 久久99最新地址| 精品亚洲porn| 日本91福利区| 麻豆91在线播放| 蜜臀99久久精品久久久久久软件| 最新久久zyz资源站| 久久久久国色av免费看影院| 制服丝袜亚洲精品中文字幕| 91久久人澡人人添人人爽欧美| 国产成人日日夜夜| 成人黄色av网站在线| 成人精品国产一区二区4080| 成人免费视频一区二区| bt欧美亚洲午夜电影天堂| 精品在线免费视频| 成人视屏免费看| 欧美一级国产精品| 国产色产综合产在线视频| 亚洲成人免费av| 国产成人亚洲综合色影视| 欧美猛男男办公室激情| 国产精品每日更新在线播放网址 | 国产精品嫩草99a| 日韩电影免费在线观看网站| 国产一区二区成人久久免费影院| 成人午夜免费电影| 欧美日韩1区2区| 欧美成人video| 亚洲欧美日韩国产成人精品影院| 日本欧美一区二区三区乱码| 韩国理伦片一区二区三区在线播放| 国产成人综合网站| 欧美日韩三级视频| 国产午夜精品一区二区三区嫩草 | 欧美在线免费视屏| 国产日韩欧美精品在线| 日韩不卡一二三区| 欧美剧情片在线观看| 亚洲免费在线看| 国产69精品久久777的优势| 欧美一区二区视频在线观看2022| 国产精品国产三级国产aⅴ入口| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美性猛交xxxx黑人交| 亚洲综合小说图片| 99视频一区二区| 亚洲欧美成aⅴ人在线观看| 成人免费视频一区| 日韩毛片一二三区| 欧美私人免费视频| 男女男精品视频| 精品成人一区二区| 色综合欧美在线| 久久丝袜美腿综合| 一本大道久久精品懂色aⅴ| 椎名由奈av一区二区三区| 99久久精品免费看| 午夜伦欧美伦电影理论片| 精品国产91乱码一区二区三区| 极品美女销魂一区二区三区免费| 精品免费日韩av| 成人黄色综合网站| 亚洲国产成人高清精品| 91免费在线播放| 国产一区二区三区久久悠悠色av| 久久亚洲一区二区三区明星换脸 | 91麻豆swag| 视频一区二区三区中文字幕| 欧美日韩色一区| 在线观看日韩精品| 国产精品亚洲人在线观看| 亚洲欧美激情视频在线观看一区二区三区| 色老头久久综合| 紧缚奴在线一区二区三区| 国产精品传媒视频| 精品伦理精品一区| 欧美日韩高清一区| 91香蕉视频mp4| 国产aⅴ精品一区二区三区色成熟| 1024国产精品| **欧美大码日韩|