您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetFontHeight函数代码示例

51自学网 2021-06-01 21:08:16
  C++
这篇教程C++ GetFontHeight函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetFontHeight函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFontHeight函数的具体用法?C++ GetFontHeight怎么用?C++ GetFontHeight使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetFontHeight函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetFont

// ---------------------------------------------------------------// Draw//// Draws information about the SlideShowConfigTranslator to this view.//// Preconditions://// Parameters: area,	not used//// Postconditions://// Returns:// ---------------------------------------------------------------voidSlideShowConfigView::Draw(BRect area){	SetFont(be_bold_font);	font_height fh;	GetFontHeight(&fh);	float xbold, ybold;	xbold = fh.descent + 1;	ybold = fh.ascent + fh.descent * 2 + fh.leading;	char title[] = "SlideShow Screen Saver";	DrawString(title, BPoint(xbold, ybold));	SetFont(be_plain_font);	font_height plainh;	GetFontHeight(&plainh);	float yplain;	yplain = plainh.ascent + plainh.descent * 2 + plainh.leading;	char writtenby[] = "Written by Michael Wilber";	DrawString(writtenby, BPoint(xbold, yplain * 1 + ybold));	// Draw current folder	BString strFolder;	fSettings->GetString(SAVER_SETTING_DIRECTORY, strFolder);	strFolder.Prepend("Image folder: ");	DrawString(strFolder.String(), BPoint(10, yplain * 9 + ybold));}
开发者ID:DonCN,项目名称:haiku,代码行数:41,


示例2: ui_color

// DrawvoidListLabelView::Draw(BRect updateRect){	rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);	rgb_color lightenMax = tint_color(base, B_LIGHTEN_MAX_TINT);	rgb_color darken2 = tint_color(base, B_DARKEN_2_TINT);	BRect r(Bounds());	BeginLineArray(3);		AddLine(BPoint(r.left, r.bottom - 1),				BPoint(r.left, r.top), lightenMax);		AddLine(BPoint(r.right, r.top),				BPoint(r.right, r.bottom), darken2);		AddLine(BPoint(r.right - 1, r.bottom),				BPoint(r.left, r.bottom), darken2);	EndLineArray();	r.left += 1;	r.right -= 1;	r.bottom -= 1;	SetLowColor(base);	FillRect(r & updateRect, B_SOLID_LOW);	font_height fh;	GetFontHeight(&fh);	SetHighColor(0, 0, 0, 255);	BPoint labelPos;	labelPos.x = 5;	labelPos.y = r.top + floorf((r.Height() + fh.ascent) / 2.0);	DrawString(fLabel.String(), labelPos);}
开发者ID:stippi,项目名称:Clockwerk,代码行数:35,


示例3: _MonitorBounds

voidMonitorView::Draw(BRect updateRect){	rgb_color darkColor = {160, 160, 160, 255};	rgb_color blackColor = {0, 0, 0, 255};	rgb_color redColor = {228, 0, 0, 255};	rgb_color whiteColor = {255, 255, 255, 255};	BRect outerRect = _MonitorBounds();	SetHighColor(fBackgroundColor);	FillRect(updateRect);	SetDrawingMode(B_OP_OVER);	// frame & background	SetHighColor(darkColor);	FillRoundRect(outerRect, 3.0, 3.0);	SetHighColor(blackColor);	StrokeRoundRect(outerRect, 3.0, 3.0);	SetHighColor(fDesktopColor);	BRect innerRect(outerRect.InsetByCopy(4, 4));	FillRoundRect(innerRect, 2.0, 2.0);	SetHighColor(blackColor);	StrokeRoundRect(innerRect, 2.0, 2.0);	SetDrawingMode(B_OP_COPY);	// power light	SetHighColor(redColor);	BPoint powerPos(outerRect.left + 5, outerRect.bottom - 2);	StrokeLine(powerPos, BPoint(powerPos.x + 2, powerPos.y));	// DPI	if (fDPI == 0)		return;	font_height fontHeight;	GetFontHeight(&fontHeight);	float height = ceilf(fontHeight.ascent + fontHeight.descent);	char text[64];	snprintf(text, sizeof(text), B_TRANSLATE("%ld dpi"), fDPI);	float width = StringWidth(text);	if (width > innerRect.Width() || height > innerRect.Height())		return;	SetLowColor(fDesktopColor);	SetHighColor(whiteColor);	DrawString(text, BPoint(innerRect.left + (innerRect.Width() - width) / 2,		innerRect.top + fontHeight.ascent + (innerRect.Height() - height) / 2));}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:60,


示例4: GetFontHeight

BSizeBButton::_ValidatePreferredSize(){	if (fPreferredSize.width < 0) {		// width		float width = 20.0f + (float)ceil(StringWidth(Label()));		if (width < 75.0f)			width = 75.0f;		if (fDrawAsDefault)			width += 6.0f;		fPreferredSize.width = width;		// height		font_height fontHeight;		GetFontHeight(&fontHeight);		fPreferredSize.height			= ceilf((fontHeight.ascent + fontHeight.descent) * 1.8)				+ (fDrawAsDefault ? 6.0f : 0);		ResetLayoutInvalidation();	}	return fPreferredSize;}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:27,


示例5: DrawEditorInfoBox

//Kris://This is a new function which duplicates the older "yellow info boxes" that//are common throughout the editor.  This draws the yellow box with the indentation//look.void DrawEditorInfoBox( UINT16 *str, UINT32 uiFont, UINT16 x, UINT16 y, UINT16 w, UINT16 h ){	UINT16 usFillColorDark, usFillColorLight, usFillColorBack;	UINT16 x2, y2;	UINT16 usStrWidth;	x2 = x + w;	y2 = y + h;	usFillColorDark = Get16BPPColor(FROMRGB(24, 61, 81));	usFillColorLight = Get16BPPColor(FROMRGB(136, 138, 135));	usFillColorBack = Get16BPPColor(FROMRGB(250, 240, 188));	ColorFillVideoSurfaceArea(ButtonDestBuffer, x, y, x2, y2, usFillColorDark);	ColorFillVideoSurfaceArea(ButtonDestBuffer, x + 1, y + 1, x2, y2, usFillColorLight);	ColorFillVideoSurfaceArea(ButtonDestBuffer, x + 1, y + 1, x2 - 1, y2 - 1, usFillColorBack);	usStrWidth = StringPixLength( str, uiFont );	if( usStrWidth > w )	{ //the string is too long, so use the wrapped method		y += 1;		DisplayWrappedString( x, y, w, 2, uiFont, FONT_BLACK, str, FONT_BLACK, TRUE, CENTER_JUSTIFIED );		return;	}	//center the string vertically and horizontally.	SetFont( uiFont );	SetFontForeground( FONT_BLACK );	SetFontShadow( FONT_BLACK );	x += (w - (UINT16)StringPixLength( str, uiFont )) / 2;	y += (h - (UINT16)GetFontHeight( uiFont)) / 2;	mprintf( x, y, L"%s", str );	InvalidateRegion( x, y, x2, y2 );}
开发者ID:lchsk,项目名称:jaggedalliance2,代码行数:37,


示例6: GetFontHeight

voidBRadioButton::Draw(BRect updateRect){	// its size depends on the text height	font_height fontHeight;	GetFontHeight(&fontHeight);	rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);	uint32 flags = be_control_look->Flags(this);	if (fOutlined)		flags |= BControlLook::B_CLICKED;	BRect knobRect(_KnobFrame(fontHeight));	BRect rect(knobRect);	be_control_look->DrawRadioButton(this, rect, updateRect, base, flags);	BRect labelRect(Bounds());	labelRect.left = knobRect.right + 1		+ be_control_look->DefaultLabelSpacing();	const BBitmap* icon = IconBitmap(		B_INACTIVE_ICON_BITMAP | (IsEnabled() ? 0 : B_DISABLED_ICON_BITMAP));	be_control_look->DrawLabel(this, Label(), icon, labelRect, updateRect,		base, flags);}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:27,


示例7: max_c

voidBIconButton::GetPreferredSize(float* width, float* height){	float minWidth = 0.0f;	float minHeight = 0.0f;	if (IsValid()) {		minWidth += fNormalBitmap->Bounds().IntegerWidth() + 1.0f;		minHeight += fNormalBitmap->Bounds().IntegerHeight() + 1.0f;	}	const float kMinSpace = 15.0f;	if (minWidth < kMinSpace)		minWidth = kMinSpace;	if (minHeight < kMinSpace)		minHeight = kMinSpace;	float hPadding = max_c(6.0f, ceilf(minHeight / 4.0f));	float vPadding = max_c(6.0f, ceilf(minWidth / 4.0f));	if (Label() != NULL && Label()[0] != '/0') {		font_height fh;		GetFontHeight(&fh);		minHeight += ceilf(fh.ascent + fh.descent) + vPadding;		minWidth += StringWidth(Label()) + vPadding;	}	if (width)		*width = minWidth + hPadding;	if (height)		*height = minHeight + vPadding;}
开发者ID:Barrett17,项目名称:Faber,代码行数:31,


示例8: _HasText

voidBStatusBar::_SetTextData(BString& text, const char* source,                         const BString& combineWith, bool rightAligned){    if (source == NULL)        source = "";    // If there were no changes, we don't have to do anything    if (text == source)        return;    bool oldHasText = _HasText();    text = source;    BString newString;    if (rightAligned)        newString << text << combineWith;    else        newString << combineWith << text;    if (oldHasText != _HasText())        InvalidateLayout();    font_height fontHeight;    GetFontHeight(&fontHeight);//	Invalidate(BRect(position, 0, position + invalidateWidth,//		ceilf(fontHeight.ascent) + ceilf(fontHeight.descent)));// TODO: redrawing the entire area takes care of the edge case// where the left side string changes because of truncation and// part of it needs to be redrawn as well.    Invalidate(BRect(0, 0, Bounds().right,                     ceilf(fontHeight.ascent) + ceilf(fontHeight.descent)));}
开发者ID:jessicah,项目名称:haiku-private,代码行数:34,


示例9: GetPreferredSize

void StaticString :: GetPreferredSize( float * w , float * h ){	font_height fh ;	GetFontHeight( &fh ) ;	*h = fh.ascent + fh.descent + fh.leading ;	*w = StringWidth( Text() ) * 1.1 ;}
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:7,


示例10: Cls_OnAdvInitDialog

//.........................................................BOOL Cls_OnAdvInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)//WM_INITDIALOG handler{	TCHAR			fontName[80],					charSet[64];	LPPROPSHEETPAGE	psp = (LPPROPSHEETPAGE)lParam;	LoadString(hInstance, IDS_TAB_FONT, fontName, SIZEOF_IN_CHAR(fontName));	LoadString(hInstance, IDS_CHAR_SET, charSet, SIZEOF_IN_CHAR(charSet));	hFont = CreateFont(GetFontHeight(hInstance, hwnd, IDS_FONT_HEIGHT), 0, 0, 0, FW_NORMAL, 				FALSE, FALSE, 0,			   CharSetFromString((LPTSTR)(const TCHAR *)charSet),			   OUT_DEFAULT_PRECIS,			   CLIP_DEFAULT_PRECIS,			DEFAULT_QUALITY, TMPF_TRUETYPE | FF_DONTCARE,			(const TCHAR *)fontName);	hPeripheral = (HPERIPHERAL)psp->lParam;	hAdvanced = hwnd;	OnInitAdvancedDialog();    return TRUE;}
开发者ID:mingpen,项目名称:OpenNT,代码行数:27,


示例11: memset

///////////////////////////////////////////////////////////////////////////////// SetFontvoid CXColorStatic::SetFont(LPCTSTR lpszFaceName, 							int nPointSize, 							BOOL bRedraw /*= TRUE*/){	// null face name is ok - we will use current font	LOGFONT lf;	memset(&lf, 0, sizeof(lf));	if (lpszFaceName == NULL)	{		CFont *pFont = GetFont();		ASSERT(pFont);		pFont->GetLogFont(&lf);	}	else	{		_tcsncpy(lf.lfFaceName, lpszFaceName, sizeof(lf.lfFaceName)/sizeof(TCHAR)-1);	}	m_nHeight = GetFontHeight(nPointSize);	lf.lfHeight = m_nHeight;	SetFont(&lf, bRedraw);}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:27,


示例12: GetEntryHeight

void ListedTextItems::Repaint( const WidgetPainter &painter ){    int entry_h = GetEntryHeight();    int font_h = GetFontHeight();    int shy = ( entry_h - font_h +1)/2;    if (!_items.Empty())    {        int shsel = (_shift<0)? (-_shift) : 0;        int shtxt = (_shift<0)? 0: _shift;        int i,n,y;        bool be_always_dirty = false;        for( i=0, n=_items.Size(), y=0; i<n; ++i )        {            __Item k = _items[i];             _skins.Select(k._state);            _skins.Paint( painter, Pos( shsel,y ), Rect(0,0,GetWidth(),entry_h)+Pos( shsel,y ) );            _fonts.Select(k._state);            _fonts.Paint( painter, k._caption, Pos(shtxt, y+shy) );                        be_always_dirty |= IsAlwaysDirty();            y += entry_h;        }                BeAlwaysDirty( be_always_dirty);    }}
开发者ID:BackupTheBerlios,项目名称:utgs-svn,代码行数:30,


示例13: GetFontHeight

voidBRadioButton::MouseDown(BPoint where){	if (!IsEnabled() || !QueryCurrentMouse(true, B_PRIMARY_MOUSE_BUTTON)) return;#if 0	font_height fontHeight;	GetFontHeight(&fontHeight);	float sHeight = fontHeight.ascent + fontHeight.descent;	BRect rect = Frame().OffsetToSelf(B_ORIGIN);	rect.InsetBy(5, (rect.Height() - sHeight) / 2);	if (rect.IsValid() == false) return;	rect.right = rect.left + rect.Height();	if (rect.Contains(where) == false) return;#endif	if ((Flags() &B_NAVIGABLE) && !IsFocus()) MakeFocus();//	SetValue((Value() == B_CONTROL_ON) ?B_CONTROL_OFF :B_CONTROL_ON);	if (Value() == B_CONTROL_ON) return;	SetValue(B_CONTROL_ON);	Invoke();}
开发者ID:D-os,项目名称:BeFree,代码行数:26,


示例14: StringWidth

voidSButton::GetContentPreferredSize(float *width, float *height){	if(!width && !height) return;	float string_width = 0, string_height = 0;	if(label)	{		string_width = StringWidth(label);		font_height fheight;		GetFontHeight(&fheight);		string_height = fheight.ascent + fheight.descent + fheight.leading;	}	if(!bitmap)	{		if(width) *width = string_width;		if(height) *height = string_height;	}	else	{		if(label) string_width += 3;		if(width) *width = string_width + bitmap->Bounds().Width();		if(height) *height = MAX(string_height, bitmap->Bounds().Height());	}}
开发者ID:Haiku-cn,项目名称:BeCJK,代码行数:28,


示例15: min

voidDropDownBase::Init(UINT16 sX, UINT16 sY){	mfMouseRegionsCreated = FALSE;	musStartX = sX;	musStartY = sY;				mSelectedEntry			= min(mSelectedEntry, mEntryVector.size() - 1);	mNumDisplayedEntries	= min(DROPDOWN_REGIONS, mEntryVector.size() );	mFirstShownEntry		= max(0, min(mFirstShownEntry, mEntryVector.size() - 1 - mNumDisplayedEntries));	musWidth = 0;	UINT8 size = mEntryVector.size();	for( UINT8 i = 0; i < size; ++i)	{		musWidth = max(musWidth, StringPixLength ( mEntryVector[i].second, DEF_DROPDOWN_FONT ));	}	// account for a bit of space let and right	musWidth += 2 * CITY_NAME_OFFSET;	musUpArrowX = musStartX + musWidth;	musUpArrowY = musStartY + 2;		musFontHeight = GetFontHeight( DEF_DROPDOWN_FONT );	// does not work on init of static objects, as the fonts do not yet exist!}
开发者ID:RadekSimkanic,项目名称:JA2-1.13,代码行数:27,


示例16: while

MsgView::MsgView(const string& text, va_list list)        : os::View(os::Rect(0,0,1,1), "MsgView", os::CF_FOLLOW_ALL){    const char* butName;    uint i=0;    while((butName = va_arg(list, const char*)) != NULL)    {        os::Button* button = new os::Button(os::Rect(0,0,1,1), butName, butName, new os::Message(i++));        buttons.push_back(button);        AddChild(button);        os::Point size = button->GetPreferredSize(false);        if(size.x > buttonSize.x)        {            buttonSize.x = size.x;        }        if(size.y > buttonSize.y)        {            buttonSize.y = size.y;        }    }    float width = (buttonSize.x + 5) * buttons.size();    int start = 0;    for(i=0;i<=text.size();++i)    {        if(i==text.size() || text[i]=='/n')        {            std::string line(text, start, i-start);            lines.push_back(line);            float strLen = GetStringWidth(line.c_str())+20;            if(strLen>width)            {                width=strLen;            }            start = i + 1;        }    }    os::font_height fontHeight;    GetFontHeight(&fontHeight);    lineHeight = fontHeight.ascender + fontHeight.descender + fontHeight.line_gap;    float height=lines.size()*lineHeight;    height+=buttonSize.y + 30;    float y=height - buttonSize.y - 5;    float x=width - buttons.size() * (buttonSize.x + 5) - 5;    for(i=0;i<buttons.size();++i)    {        buttons[i]->SetFrame(os::Rect(x, y, x+buttonSize.x-1, y+buttonSize.y-1));        x+=buttonSize.x+5;    }    minSize.x=width;    minSize.y=height;}
开发者ID:PyroOS,项目名称:Pyro,代码行数:60,


示例17: AttachedToWindow

void FolderPanel :: AttachedToWindow( void ){	BRect r ;	if( Parent() )		r = Parent()->Frame() ;	else		r = Window()->Frame() ;		font_height fh ;	GetFontHeight( &fh ) ;		r.top = 0 ;	r.right = r.Width() ;	r.left = 0 ;  	r.bottom = 3 * (fh.ascent + fh.descent + fh.leading ) ;		MoveTo( 0,0 ) ;	ResizeTo( r.right, r.bottom ) ;			r.left    = 25 ;	r.right   = r.right - r.left ;	r.top     = r.Height()/5 ;	r.bottom  = r.bottom - r.top ;		fpFolderPU->MoveTo( r.left , r.top ) ;	fpFolderPU->ResizeTo( r.Width() , r.Height() ) ;	fpFolderPU->SetViewColor( ViewColor() ) ;	fpFolderPU->SetLowColor( ViewColor() ) ;	AddChild( fpFolderPU ) ;}
开发者ID:HaikuArchives,项目名称:TraX,代码行数:32,


示例18: BView

BTitleView::BTitleView(BPoseView* view)	:	BView("BTitleView", B_WILL_DRAW),	fPoseView(view),	fTitleList(10, true),	fHorizontalResizeCursor(B_CURSOR_ID_RESIZE_EAST_WEST),	fPreviouslyClickedColumnTitle(0),	fPreviousLeftClickTime(0),	fTrackingState(NULL){	SetHighUIColor(B_PANEL_BACKGROUND_COLOR);	SetLowUIColor(B_PANEL_BACKGROUND_COLOR);#if APP_SERVER_CLEARS_BACKGROUND	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);#else	SetViewColor(B_TRANSPARENT_COLOR);#endif	BFont font(be_plain_font);	font.SetSize(floorf(be_plain_font->Size() * 0.75f));	SetFont(&font);	font_height height;	GetFontHeight(&height);	fPreferredHeight = ceilf(height.ascent + height.descent) + 2;	Reset();}
开发者ID:bhanug,项目名称:haiku,代码行数:28,


示例19: BControl

// --------------------------------------------------------------CollapsableBox::CollapsableBox	(	BRect		frame,    const char 	*name,    const char 	*label,    BMessage 	*msg,    uint32 		resize_mask,   	uint32 		flags	): BControl(frame, name, label, msg, resize_mask,	flags | B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE | B_NAVIGABLE_JUMP){	m_pressing = false;	font_height fh;	GetFontHeight(&fh);	float min_height = (float) ceil(6.0f + fh.ascent + fh.descent) + 2.0f;	if (Bounds().Height() < min_height)		ResizeTo(Bounds().Width(), min_height);			m_collapsed_rect = BRect(0, 0, Bounds().Width(), min_height);	m_expanded_rect = Bounds();	SetValue(B_CONTROL_ON);}
开发者ID:diversys,项目名称:sanity,代码行数:26,


示例20: GetFontHeight

//------------------------------------------------------------------------------void BMenuField::DrawLabel(BRect bounds, BRect update){	font_height fh;	GetFontHeight(&fh);	if (Label())	{		SetLowColor(ViewColor());		float y = (float)ceil(fh.ascent + fh.descent + fh.leading) + 2.0f;		float x;		switch (fAlign)		{			case B_ALIGN_RIGHT:				x = fDivider - StringWidth(Label()) - 3.0f;				break;			case B_ALIGN_CENTER:				x = fDivider - StringWidth(Label()) / 2.0f;				break;			default:				x = 3.0f;				break;		}				SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),					 IsEnabled() ? B_DARKEN_MAX_TINT : B_DISABLED_LABEL_TINT));		DrawString(Label(), BPoint(x, y));	}}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:33,


示例21: SetFont

voidTermView::_Init(){	SetFont(be_fixed_font);	font_height height;	GetFontHeight(&height);	fFontHeight = (int)(ceilf(height.ascent) + ceilf(height.descent)		+ ceilf(height.leading));	fFontWidth = (int)be_fixed_font->StringWidth("X");	fTerm = vterm_new(kDefaultHeight, kDefaultWidth);	fTermScreen = vterm_obtain_screen(fTerm);	vterm_screen_set_callbacks(fTermScreen, &sScreenCallbacks, this);	vterm_screen_reset(fTermScreen, 1);	vterm_parser_set_utf8(fTerm, 1);	VTermScreenCell cell;	VTermPos firstPos;	firstPos.row = 0;	firstPos.col = 0;	_GetCell(firstPos, cell);	rgb_color background;	background.red = cell.bg.red;	background.green = cell.bg.green;	background.blue = cell.bg.blue;	background.alpha = 255;	SetViewColor(background);	SetLineTerminator("/n");}
开发者ID:looncraz,项目名称:haiku,代码行数:33,


示例22: SetHighColor

void LiveTextControl::Draw(BRect updateRect) {	SetHighColor( 0, 0, 0 );	font_height	hoehe;	GetFontHeight(&hoehe);	DrawString(Label(), BPoint( 3.0, hoehe.ascent + 3.0 ) );}
开发者ID:diversys,项目名称:PecoRename,代码行数:7,


示例23: pt

void CWndCommand::OnDraw( C2DRender* p2DRender ) { 	CWndListBox::OnDraw( p2DRender );		if( ::GetLanguage() == LANG_KOR )	{		CPoint pt(3,3);		int nFontHeight = GetFontHeight() + 3;		pt.y -= ( nFontHeight ) * m_wndScrollBar.GetScrollPos();		LPLISTITEM pListItem;		CRect rectHittest;		CPoint point;		CRect rect = GetWindowRect();		CString string;		for(int i = 0; i < m_listItemArray.GetSize(); i++)		{			pListItem = (LPLISTITEM)m_listItemArray.GetAt(i);			point = GetMousePoint();			rectHittest.SetRect( 0, pt.y - 3 , 0 + rect.Width(), pt.y + nFontHeight - 3 );			if( rectHittest.PtInRect( point ) )			{				TextCmdFunc* pTextCmdFunc = (TextCmdFunc*)pListItem->m_dwData;				CPoint point2 = point;				ClientToScreen( &point2 );				ClientToScreen( &rectHittest );				string += pTextCmdFunc->m_pszDesc;				g_toolTip.PutToolTip( i + 1000, string, rectHittest, point2, 3 );				break;			}			pt.y += nFontHeight;		}	}} 
开发者ID:iceberry,项目名称:flyffsf,代码行数:33,


示例24: SetFlags

void_BMCMenuBar_::_Init(){	SetFlags(Flags() | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE);	SetBorder(B_BORDER_CONTENTS);	float left, top, right, bottom;	GetItemMargins(&left, &top, &right, &bottom);#if 0	// TODO: Better fix would be to make BMenuItem draw text properly	// centered	font_height fontHeight;	GetFontHeight(&fontHeight);	top = ceilf((Bounds().Height() - ceilf(fontHeight.ascent)		- ceilf(fontHeight.descent)) / 2) + 1;	bottom = top - 1;#else	// TODO: Fix content location properly. This is just a quick fix to	// make the BMenuField label and the super-item of the BMenuBar	// align vertically.	top++;	bottom--;#endif	if (be_control_look != NULL)		left = right = be_control_look->DefaultLabelSpacing();	SetItemMargins(left, top,		right + fShowPopUpMarker ? kPopUpIndicatorWidth : 0, bottom);}
开发者ID:mylegacy,项目名称:haiku,代码行数:31,


示例25: GetPreferredSize

	virtual void GetPreferredSize(float* width, float* height)	{		font_height fh;		GetFontHeight(&fh);		*height = fh.ascent+fh.descent + 2;		*width = StringWidth(fTip.String()) + 2;	}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:7,


示例26: BView

BFileControl::BFileControl(BRect rect, const char* name, const char* label,	const char *pathOfFile,uint32 flavors)	:	BView(rect, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0){	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));	// determine font height	font_height fontHeight;	GetFontHeight(&fontHeight);	float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent		+ fontHeight.leading) + 13;	BString selectString = B_TRANSLATE("Select" B_UTF8_ELLIPSIS);	float labelWidth = StringWidth(selectString) + 20;	rect = Bounds();	rect.right -= labelWidth;	rect.top = 4;	rect.bottom = itemHeight + 2;	fText = new BTextControl(rect,"file_path", label, pathOfFile, NULL);	if (label)		fText->SetDivider(fText->StringWidth(label) + 6);	AddChild(fText);	fButton = new BButton(BRect(0, 0, 1, 1), "select_file", selectString,		new BMessage(kMsgSelectButton));	fButton->ResizeToPreferred();	fButton->MoveBy(rect.right + 6,		(rect.Height() - fButton->Frame().Height()) / 2);	AddChild(fButton);	fPanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, flavors, false);	ResizeToPreferred();}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:34,



注:本文中的GetFontHeight函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GetFontSize函数代码示例
C++ GetFolder函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。