当前位置: 首页>>代码示例>>C++>>正文


C++ TFont类代码示例

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


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

示例1: CtrlSetFont

//设置控件文本大小颜色
TFont CtrlSetFont(TCtrl *pCtrl, Int32 nFontSize, ColorRefType nColor)
{
	TFont tFont;
	tFont.Create(nFontSize, nFontSize);
	pCtrl->SetColor(CTL_COLOR_TYPE_FORE, nColor);
	return pCtrl->SetFont(tFont);
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:8,代码来源:gui_common.cpp

示例2: CtrlAddItemToWin_Label

Int32 CtrlAddItemToWin_Label(TWindow*pWin, Coord nX, Coord nY, Coord nWidth, Int32 FontSize, TUChar* pszString, ColorRefType Color)
{
	TLabel* pLabel = new TLabel();
	Int32  nLabelID = 0;

	if(pLabel->Create(pWin))	
	{
		TRectangle obBtnRec(0,0,0,0);
		if(nWidth == 0)
		{
			nWidth = 80;
			obBtnRec.SetRect(nX, nY, nWidth, FontSize);
			pLabel->SetBounds(&obBtnRec);
			pLabel->SetAutoSize(TRUE);

			CtrlSetFont((TCtrl*)pLabel, FontSize, Color);
			pLabel->SetCaption(pszString,FALSE);
		}
		else
		{
			obBtnRec.SetRect(nX, nY, nWidth, FontSize);
			pLabel->SetBounds(&obBtnRec);
			pLabel->SetAutoSize(FALSE);
			pLabel->SetScrollMode(lsmNone);

			TFont tFont;
			tFont.Create(FontSize, FontSize);
			ShowAsShort((TCtrl *)pLabel, pszString, tFont);
			pLabel->SetFont(tFont);
			pLabel->SetColor(CTL_COLOR_TYPE_FORE, Color);
		}
	}
	return nLabelID;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:34,代码来源:gui_common.cpp

示例3: CtrlAddItemToCoolBarList_Lable

//添加Label控件到CoolBarList, 
// pszString必须是动态的(非Static)
// nWidth 为0 -- 自动长度
Int32 CtrlAddItemToCoolBarList_Lable(TWindow*pWin,  TBarListItem* pListItem, Coord nX, Coord nY, Coord nWidth, Int32 FontSize, TUChar* pszString, ColorRefType Color)
{
	TRectangle obBtnRec(0,0,0,0);
	Int32 nLabelNameId = pListItem->AddCtrl(CTL_CLASS_LABEL, 0, 0);
	TLabel* pLabelName = static_cast<TLabel*>(pWin->GetControlPtr(nLabelNameId));
	if(nWidth == 0)
	{
		nWidth = 80;
		obBtnRec.SetRect(nX, nY, nWidth, FontSize);
		pLabelName->SetBounds(&obBtnRec);
		pLabelName->SetAutoSize(TRUE);

		CtrlSetFont((TCtrl*)pLabelName, FontSize, Color);
		pLabelName->SetCaption(pszString,FALSE);
	}
	else
	{
		obBtnRec.SetRect(nX, nY, nWidth, FontSize+6);	//调整高度,防止字体底部被截断
		pLabelName->SetBounds(&obBtnRec);
		pLabelName->SetAutoSize(FALSE);
		pLabelName->SetScrollMode(lsmNone);

		TFont tFont;
		tFont.Create(FontSize, FontSize);
		ShowAsShort((TCtrl *)pLabelName, pszString, tFont);
		pLabelName->SetFont(tFont);
		pLabelName->SetColor(CTL_COLOR_TYPE_FORE, Color);
	}

	pLabelName->SetEnabled(FALSE);
	
	return nLabelNameId;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:36,代码来源:gui_common.cpp

示例4: TFont

void __fastcall TCustomDrawDemoEditorForm::sbFontClick(TObject *Sender)
{
  if (FontDialog->Execute()){
    TFont *AFont = new TFont();
    AFont->Assign(FontDialog->Font);
    GetSelectedDrawItem()->Font = AFont;
    CustomDrawDemoMainForm->cxDBVerticalGrid->Invalidate();
  }
}
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:9,代码来源:CustomDrawDemoEditor.cpp

示例5: SetAppTilte

//创建应用标题默认居中
//pApp --应用指针
//TitleStringResId --标题字串ID, 默认为0
//TitleString --标题字串,默认为空NULL
//color--标题颜色,默认为白:RGB_COLOR_WHITE
//nFontSize 字体大小
//返回控件ID
Int32 SetAppTilte(TWindow * pWindow, Int32 nTitleStringResId, TUChar* pTitleString, ColorRefType Color, Int32 nFontSize)
{
	Int32 m_TitleCtlID = 0;

	TCtrl *m_TitleContrl;
	TRectangle TitleRC(0,0,0,0);
	TRectangle WindowRC(0, 0, 0, 0);
	TFont tFont;
	Int32 nTitleWidth = 0;
	Boolean bNeedShort = FALSE;
	TUChar sTitleString[128] ={0};

	if(nTitleStringResId == 0)//说明传进的是字串
	{
		if(pTitleString)
		{
			TUString::StrNCopy(sTitleString, pTitleString, sizeof(sTitleString));
		}
	}
	else
	{
		TUString::StrNCopy(sTitleString, TResource::LoadConstString(nTitleStringResId), sizeof(sTitleString));
	}
	
	tFont.Create(nFontSize, nFontSize,  FONT_STYLE_BOLD);
	nTitleWidth = GetShowAllStringWidth(sTitleString,tFont);
	if(nTitleWidth > SCR_W - (TITLE_BUTTON_X + TITLE_BUTTON_W)*2 )
	{
		bNeedShort = TRUE;
		nTitleWidth = SCR_W - (TITLE_BUTTON_X + TITLE_BUTTON_W)*2 - 10;
	}
	
	pWindow->GetBounds(&WindowRC);	
	TitleRC.SetRect((WindowRC.Width()-nTitleWidth)/2, (TITLEBAR_H- nFontSize)/2, nTitleWidth, nFontSize);
	
	m_TitleContrl = new TLabel;
	
	if(m_TitleContrl->Create(pWindow))
	{		
		m_TitleContrl->SetBounds(&TitleRC);	
		m_TitleCtlID = m_TitleContrl->GetId();	

		m_TitleContrl->SetFont(tFont);
		m_TitleContrl->SetColor(CTL_COLOR_TYPE_FORE,Color);
		m_TitleContrl->SetEnabled(FALSE);
		m_TitleContrl->SetCaption(sTitleString,FALSE);
		if(bNeedShort)
			ShowAsShort(m_TitleContrl, sTitleString, tFont);
		m_TitleContrl->Show(TRUE);
	}

	return m_TitleCtlID;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:60,代码来源:gui_common.cpp

示例6: obBtnRec

/**
 * 创建功能按键
 *
 * \param pApp
 *
 * \return 
 */
Int32 TMainMenuForm::_CreateFunctionButtons(TApplication* pApp)
{
	Int32 bnRetCod = 0; 
	TRectangle obBtnRec(0,0,0,0); //初始(left, top, w, h)
	TFont tFont;	

	tFont.Create(FONT_BUTTON_CAPTION, FONT_BUTTON_CAPTION);
	
	//use to function buttons ID
	for(int i=0; i<ARR_SIZE(m_nFunMenuBtnID); i++)
	{
		m_nFunMenuBtnID[i] = 0;

		const TBitmap * pImgNormal = TResource::LoadConstBitmap(MainMenuItems[i].nNmIconID);
		const TBitmap * pImgDown = TResource::LoadConstBitmap(MainMenuItems[i].nHLIconID);
		obBtnRec.SetRect(FUNCTION_BUTTON_X + (FUNCTION_BUTTON_W *(i%3)) , FUNCTION_BUTTON_Y + (FUNCTION_BUTTON_H *(i/3)), FUNCTION_BUTTON_W, FUNCTION_BUTTON_H);
		TMaskButton* pFunMenuBtn =new TMaskButton;
		if(pFunMenuBtn->Create(this))
		{
			Int32 CaptionX = 0;
			TFont tFont;	

			tFont.Create(FONT_BUTTON_CAPTION, FONT_BUTTON_CAPTION);
			pFunMenuBtn->SetBounds(&obBtnRec); 	
			m_nFunMenuBtnID[i] = pFunMenuBtn->GetId();
			pFunMenuBtn->SetImage(pImgNormal,(FUNCTION_BUTTON_W-pImgNormal->GetWidth())/2,(FUNCTION_BUTTON_H-pImgNormal->GetHeight())/2 - 10); 
			pFunMenuBtn->SetSelImage(pImgDown,(FUNCTION_BUTTON_W-pImgDown->GetWidth())/2,(FUNCTION_BUTTON_H-pImgDown->GetHeight())/2 - 10);	
			if(TUString::StrLen(MainMenuItems[i].pszTitle) == 0)
			{
				CaptionX = (FUNCTION_BUTTON_W - GetShowAllStringWidth((TUChar *)TResource::LoadConstString(MainMenuItems[i].nStrID), tFont))/2;			
				pFunMenuBtn->SetCaption(TResource::LoadConstString(MainMenuItems[i].nStrID), CaptionX, FUNCTION_CAPTION_Y);
			}
			else
			{
				CaptionX = (FUNCTION_BUTTON_W - GetShowAllStringWidth((TUChar *)MainMenuItems[i].pszTitle, tFont))/2;			
				pFunMenuBtn->SetCaption(MainMenuItems[i].pszTitle, CaptionX, FUNCTION_CAPTION_Y);			
			}
			pFunMenuBtn->SetColor(RGB_COLOR_BLACK,RGB_COLOR_WHITE,RGB_COLOR_BLACK,RGB_COLOR_WHITE,RGB_COLOR_BLACK,RGB_COLOR_WHITE);
			pFunMenuBtn->SetFont(tFont);
			pFunMenuBtn->SetEnabled(TRUE);
		}
		else
		{
			bnRetCod ++;
		}
	}
			
	return bnRetCod;
}
开发者ID:pengjohn,项目名称:RenRen,代码行数:56,代码来源:RenRenForm_MainMenu.cpp

示例7: ShowAsShort

//如果内容太长显示不完则用省略号表示
void  ShowAsShort(TCtrl *pTCtrl, TUChar* pCaptionString, TFont objFontType)
{
	TRectangle Rc_TCtrl;
	pTCtrl->GetBounds(&Rc_TCtrl);
	
	int nStrLen = TUString::StrLen(TUString::StrTrimUnVisible(pCaptionString));
	//int nShortWidth = GetShowAllStringWidth((TUChar*)L"...",objFontType);
	int nShortWidth = GetShowAllStringWidth((TUChar*)TUSTR_Kx_Ellipsis,objFontType);	
	int nShowLen = objFontType.WordWrapNoLF(TUString::StrTrimUnVisible(pCaptionString), Rc_TCtrl.Width()- nShortWidth*2);

	if (nShowLen < nStrLen)
	{
		//Add one more label to show
		
		TUChar* pszTemp = new TUChar[nShowLen + 10];
		MemSet( (void *)pszTemp, 0x0, sizeof(TUChar) * (nShowLen + 10) );
		TUString::StrNCopy(pszTemp,TUString::StrTrimUnVisible(pCaptionString),nShowLen);
		TUString::StrCat(pszTemp,TUSTR_Kx_Ellipsis);//(const TUChar*)L"..."
		pTCtrl->SetCaption(pszTemp,FALSE);
		delete pszTemp;	
	}
	else
	{
		pTCtrl->SetCaption(TUString::StrTrimUnVisible(pCaptionString),FALSE);//StrTrim
	}	
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:27,代码来源:gui_common.cpp

示例8:

void
TButtonTextGadget::GetTextSize(TSize& size)
{
  TFont* font = Font;
  if (font == 0)
    font = &(GetGadgetWindow()->GetFont());

  if (font == 0)
    return;

  TEXTMETRIC tm;
  font->GetTextMetrics(tm);

  size.cx += tm.tmAveCharWidth * NumChars;
  size.cy += tm.tmHeight + 2;
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:16,代码来源:btntextg.cpp

示例9: tvterm_put_uchar

static int tvterm_put_uchar(struct TVterm* p, u_int ch)
{
	TFont *pf = &gFont[p->utf8Idx];
	u_int w;
	if(p->pen.x == p->xmax) {
		p->wrap = true;
		p->pen.x--;
	}

	if(p->wrap) {
		p->pen.x -= p->xmax - 1;

		if (p->pen.y == p->ymax - 1) {
			p->scroll++;
		} else {
			p->pen.y++;
		}

		p->wrap = false;

		return -1;
	}

	pf->conv(pf, ch, &w);

	if(pf->width == w) {
		INSERT_N_CHARS_IF_NEEDED(p, 1);
		tvterm_uput1(p, p->utf8Idx, ch);
		p->pen.x++;
	} else {
		INSERT_N_CHARS_IF_NEEDED(p, 2);
		tvterm_uput2(p, p->utf8Idx, ch);
		p->pen.x += 2;
	}

	p->utf8remain = 0;
	p->ucs2ch = 0;

	return 0;
}
开发者ID:takeutch-kemeco,项目名称:jfbterm-0.4.7.1,代码行数:40,代码来源:vterm.c

示例10: SetAppTitleButton

//设置应用标题栏按钮
Int32 SetAppTitleButton(TWindow * pWindow, Int32 nResId, int ButtonPosition)
{
	Int32 m_BtnID = 0;
	TButton *pBtn;
	TRectangle BtnRC_Left(TITLE_BUTTON_X, TITLE_BUTTON_Y, TITLE_BUTTON_W, TITLE_BUTTON_H);	
	TRectangle BtnRC_Right(SCR_W-TITLE_BUTTON_X-TITLE_BUTTON_W, TITLE_BUTTON_Y, TITLE_BUTTON_W, TITLE_BUTTON_H);
	TFont tFont;

	const TBitmap * pNormalBmp = TResource::LoadConstBitmap(APP_KA_ID_BITMAP_button53);
	const TBitmap * pOverBmp = TResource::LoadConstBitmap(APP_KA_ID_BITMAP_button53_over);

	if(TUString::StrLen(TResource::LoadConstString(nResId)) <= 2)
		tFont.Create(FONT_NORMAL, FONT_NORMAL, FONT_STYLE_BOLD);
	else
		tFont.Create(FONT_MIDDLE, FONT_MIDDLE, FONT_STYLE_BOLD);
	pBtn = new TButton;	
	if(pBtn->Create(pWindow))
	{		
		if(ButtonPosition == TITLE_BUTTON_LEFT)
			pBtn->SetBounds(&BtnRC_Left);	
		else
			pBtn->SetBounds(&BtnRC_Right);	
		m_BtnID = pBtn->GetId();	

		pBtn->SetFont(tFont);
		pBtn->SetColor(CTL_COLOR_TYPE_FORE,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_BACK,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_FOCUS_FORE,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_FOCUS_BACK,RGB_COLOR_WHITE);
		
		pBtn->SetCaption(TResource::LoadConstString(nResId),FALSE);
		pBtn->SetStyles(BTN_STYLES_GRAPGICS);
		pBtn->SetImage(pNormalBmp,0);
		pBtn->SetImage(pOverBmp,1);		
		pBtn->Show(TRUE);
	}

	return m_BtnID;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:40,代码来源:gui_common.cpp

示例11: GetShowAllStringWidth

//根据字体计算出显示整个字串所需的像素
//Todo::WordWrapNoLF有问题, 如果第一个字节为空格,返回的nShowLen长度有问题,需要做去头空格处理
Int32 GetShowAllStringWidth(TUChar* pCaptionString, TFont objFontType)
{
	Int32 Width = 1;
	Int32 tempWidth = 0;//从像素0开始
	Int32 nStringLen = TUString::StrLen(pCaptionString);
	Int32 nShowLen = 0;
	do
	{
		tempWidth ++;
		nShowLen = objFontType.WordWrapNoLF(TUString::StrTrimUnVisible(pCaptionString), tempWidth);
		
	}while(nShowLen < nStringLen);

	return tempWidth + 4;//刚刚好的长度显示字串时有问题,故再加两个像素
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:17,代码来源:gui_common.cpp

示例12: GetOuterSizes

//
/// Respond to the virtual call to let this gadget's Window know how big this
/// text gadget wants to be based on the text size.
//
/// If shrink-wrapping is requested, GetDesiredSize returns the size needed to
/// accommodate the borders, margins, and text; otherwise, if shrink-wrapping is not
/// requested, it returns the gadget's current width and height.
//
void
TTextGadget::GetDesiredSize(TSize& size)
{
  TGadget::GetDesiredSize(size);
  TFont* font = Font;
  if (font == 0)
    font = &(GetGadgetWindow()->GetFont());

  if (font == 0)
    return;

  if (ShrinkWrapWidth)
    size.cx += font->GetTextExtent(Text).cx;
  else {
    int  left, right, top, bottom;
    GetOuterSizes(left, right, top, bottom);

    int newW = font->GetMaxWidth() * NumChars;
    size.cx += newW + left + right - Bounds.Width();  // Old bounds already considered
  }

  if (ShrinkWrapHeight)
    size.cy += font->GetHeight() + 2;
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:32,代码来源:textgadg.cpp

示例13: RefAdd

//
/// The TFont copy constructor.
//
TFont::TFont(const TFont& src)
{
#if !defined(NO_GDI_SHARE_HANDLES)
  Handle = src.Handle;
  RefAdd(Handle, Font);
#else
  LOGFONT logFont;
  src.GetObject(logFont);
  Handle = ::CreateFontIndirect(&logFont);
  WARNX(OwlGDI, !Handle, 0, _T("Cannot create TFont from TFont @") <<
        hex << uint32(LPVOID(&src)));
  CheckValid();
  RefAdd(Handle, Font);
#endif
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:18,代码来源:font.cpp

示例14: m_pBitmap

	CCXBitmapDC::CCXBitmapDC(const char *text, CGSize dimensions, UITextAlignment alignment, const char *fontName, float fontSize)
        : m_pBitmap(NULL)
	{
        TUChar *pText = NULL; 
        do 
        {
            // create font
            TFont font;
            CCX_BREAK_IF(! font.Create(0, (Int32)fontSize));

            // text
            Int32 len = strlen(text) + 1;
            CCX_BREAK_IF(! (pText = new TUChar[len]));
            TUString::StrGBToUnicode(pText, (Char*)text);

            // calculate text size
            if (CGSize::CGSizeEqualToSize(dimensions, CGSizeZero))
            {
                m_tSize.width = font.CharsWidth(pText,len);
                m_tSize.height = font.LineHeight();
            }else
            {
                m_tSize = dimensions;
            }

            Int16 width = (Int16)m_tSize.width;
            Int16 height = (Int16)m_tSize.height;

            // create bitmap
            CCX_BREAK_IF(! (m_pBitmap = TBitmap::Create(width, height, 32)));

            // create memory window
            if (s_pMemWnd)
            {
                TRectangle rcMemWnd(0, 0, 0, 0);
                s_pMemWnd->GetClientBounds(&rcMemWnd);
                if (rcMemWnd.Width() < width || rcMemWnd.Height() < height)
                {
                    s_pMemWnd->CloseWindow();
                    s_pMemWnd = NULL;
                }
            }

            do 
            {
                // if memery window is already break
                CCX_BREAK_IF(s_pMemWnd);

                CCX_BREAK_IF(! (s_pMemWnd = new TWindow(CCXApplication::sharedApplication())));

                Coord nCurrentWidth = CCXApplication::GetCurrentApplication()->GetScreenWidth();
                Coord nCurrentHeight = CCXApplication::GetCurrentApplication()->GetScreenHeight();
                
                Coord nMemWndW = (width >= nCurrentWidth) ? width : nCurrentWidth;
                Coord nMemWndH = (height >= nCurrentHeight) ? height : nCurrentHeight;
                CCX_BREAK_IF(s_pMemWnd->CreateMemWindow(nMemWndW, nMemWndH,screenTransparentFormat));
                delete s_pMemWnd;
                s_pMemWnd = NULL;
            } while (0);

            CCX_BREAK_IF(! s_pMemWnd);
            
            // create DC
            TDC dc(s_pMemWnd);
            // set DC styles
            UInt32 styles = GUI_API_STYLE_SPECIFY_FORE_COLOR |  GUI_API_STYLE_ROP_MODE_TRANSPARENT |
                GUI_API_STYLE_SPECIFY_BACK_COLOR | GUI_API_STYLE_ALIGNMENT_MIDDLE | GUI_API_STYLE_SPECIFY_FONT;

            switch (alignment)
            {
            case UITextAlignmentLeft:
                styles |= GUI_API_STYLE_ALIGNMENT_LEFT;
                break;
            case UITextAlignmentCenter:
                styles |= GUI_API_STYLE_ALIGNMENT_CENTER;
                break;
            case UITextAlignmentRight:
                styles |= GUI_API_STYLE_ALIGNMENT_RIGHT;
                break;
            default:
                styles |= GUI_API_STYLE_ALIGNMENT_CENTER;
                break;
            }

            s_pMemWnd->GetMemWindowTBitmapPtr()->Fill32(RGBA(0, 0, 0, 0), 0, 0, width, height);

            TRectangle rect(0, 0, width, height);
            dc.DrawTextInRectangleEx(pText, 0, RGBA(255,255,255,255), RGBA(0,0,0,255), font, &rect, styles);

            dc.ReadBitmap(m_pBitmap, 0, 0);

        } while (0);
        if (pText)
        {
            delete[] pText;
            pText = NULL;
        }
	}
开发者ID:geniikw,项目名称:myFirst2DGame,代码行数:98,代码来源:CCXBitmapDC.cpp

示例15: KaiXinAPI_JsonParse

// 窗口初始化
Boolean TGardenListForm::_OnWinInitEvent(TApplication * pApp, EventType * pEvent)
{
	int iRet = eFailed;
	int nIndex = 0;
	TBarRowList *lpRowList = NULL;
	TRectangle Rc_CoolBarList;

	nListItems =0;
	Response = NULL;
	iRet = KaiXinAPI_JsonParse(KX_GardenList, (void **)&Response);

	m_BackBtn = SetAppBackButton(this); 
	SetAppTilte(this, APP_KA_ID_STRING_Garden);	

	if(iRet == 1)
	{
		TBarRow *lpRow = NULL;
		TCoolBarList* pCoolBarList = static_cast<TCoolBarList*>(GetControlPtr(APP_KA_ID_GardenListForm_GardenListCoolBarList));
		if (pCoolBarList)
		{
			TBarListItem* lpItem = NULL;

			pCoolBarList->SetBounds(RC_LIST_LARGE);
			pCoolBarList->GetBounds(&Rc_CoolBarList);
			lpRowList = pCoolBarList->Rows();
			//add row
			if (lpRowList)
			{
				lpRowList->BeginUpdate();
				lpRowList->Clear();
				lpRow = lpRowList->AppendRow();
				lpRowList->EndUpdate();
				if(lpRow)
				{
					//Title 
					lpItem = lpRow->AppendItem();
					if(lpItem)	
					{
						TFont objFontType;
						Int32 ItemHeight = 0;
						TRectangle rect;
						TRectangle Rc_Temp;
						TUChar pszSubTitle[64] = {0};

						lpItem->GetBounds(rect);
						lpItem->SetCaption(NULL);						
						lpItem->SetIndicatorType(itNone);

						ItemHeight = ItemHeight + 30;

						TUString::StrPrintF(pszSubTitle, TResource::LoadConstString(APP_KA_ID_STRING_SubTitleGarden),TResource::LoadConstString(APP_KA_ID_STRING_Friend));
						Int32 nTitlelabelId = lpItem->AddCtrl(CTL_CLASS_LABEL, 20, 5);
						TLabel* pTitlelabel = static_cast<TLabel*>(GetControlPtr(nTitlelabelId));
						TRectangle Rc_Titlelabel(OFFSET_X, ItemHeight, SCR_W - 20, 20);
						pTitlelabel->SetBounds(&Rc_Titlelabel);
						objFontType = pTitlelabel->GetFont();
						objFontType.Create(FONT_CONTENT, FONT_CONTENT);
						pTitlelabel->SetFont(objFontType); 
						pTitlelabel->SetCaption(pszSubTitle,FALSE);
						pTitlelabel->GetBounds(&Rc_Temp);

						ItemHeight = ItemHeight + Rc_Temp.Height() + 30;					
						lpItem->SetHeight(ItemHeight);	
					}						

					// 好友列表
					nListItems = Response->nSize_friends;
					if(nListItems == 0)
					{
						lpItem = lpRow->AppendItem();
						if(lpItem)
						{
							TFont objFontType;
							TUChar pszFriendName[32] = {0};
							Int32 ItemHeight = 0;
							TRectangle rect;
							TRectangle Rc_Temp;

							lpItem->GetBounds(rect);
							lpItem->SetCaption(NULL);						
							lpItem->SetIndicatorType(itNone);

							ItemHeight = ItemHeight + rect.Y() + 15;

							//好友的花园里还没有成熟的果实				
							Int32 nNoneHarvestId = lpItem->AddCtrl(CTL_CLASS_LABEL, 20, 5);
							TLabel* pNoneHarvest = static_cast<TLabel*>(GetControlPtr(nNoneHarvestId));
							TRectangle Rc_NoneHarvest(OFFSET_X, ItemHeight, SCR_W - 40 , 20);
							pNoneHarvest->SetBounds(&Rc_NoneHarvest);
							objFontType = pNoneHarvest->GetFont();
							objFontType.Create(FONT_CONTENT_DETAIL, FONT_CONTENT_DETAIL);
							pNoneHarvest->SetFont(objFontType);
							pNoneHarvest->SetColor(CTL_COLOR_TYPE_FORE,RGB_COLOR_GRAY);
							pNoneHarvest->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_NoneHarvestGarden),FALSE);
							pNoneHarvest->GetBounds(&Rc_Temp);		
							ItemHeight = ItemHeight + Rc_Temp.Height() + 10;

							lpItem->SetHeight(ItemHeight - (rect.Y() - Rc_CoolBarList.Y()) + 10 );
						}
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:kaixin,代码行数:101,代码来源:KaiXinAPI_GardenList.cpp


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