//添加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; }
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; }
/** 设置页面显示内容 * * \param pszTitle 标题 * \param pURL 链接 * \param pDes 描述 * \return 无 */ void TWebForm::SetText(const TUChar* pszTitle, const char* pURL, const char* pDes) { TUChar *pText; #if 0 TLabel* pTitle; pTitle = static_cast<TLabel*>(GetControlPtr(APP_RS_ID_formWeb_Label1047)); if (pTitle && pszTitle) { pText = new TUChar[strlen(pszTitle)+1]; TUString::StrUtf8ToStrUnicode(pText, (Char*)pszTitle); pTitle->SetCaption(pText, FALSE); delete [] pText; pText = NULL; } #endif ////测试浏览器 //TCOM_WebBrowser_DataType_Obj* dt = TCOM_WebBrowser_DataType_Obj::create(); //if(dt != NULL) //{ // //const TUChar *pszAddress = GetControlCaption(APP_ST_ID_FormSyetemStyleTest_Field1039); // pText = new TUChar[strlen(pURL)+1]; // TUString::StrUtf8ToStrUnicode(pText, (Char*)pURL); // dt->LoadUrl(pText); // delete [] pText; // pText = NULL; // dt->Release(); //} //设定网页显示的起始位置(左上角坐标) TRectangle WebRet(0,0,0,0); WebRet.SetRect(0, TITLEBAR_H, SCR_W, SCR_H - STATUSBAR_H - TITLEBAR_H); m_pWebPanel = TBrowser::TWebPanel::create(this, WebRet, NULL); m_pWebPanelTComObj = m_pWebPanel->getParentClient(); UInt32 ulAccountID = (UInt32)(static_cast<TApp_KaiXinApp*>(GetApplication()))->GetConnectID(); m_pWebPanelTComObj->setNetAccountID(ulAccountID); m_pWebPanelTComObj->setAutoConnect(FALSE); m_pWebPanelTComObj->AddRef(); //加载一个URL 链接 并于上面指定的区域中显示 pText = new TUChar[strlen(pURL)+1]; if (pText) { m_pWebPanel->setAutoZoomSupport(TRUE); MemSet(pText, 0, (strlen(pURL)+1) * sizeof(TUChar)); TUString::StrUtf8ToStrUnicode(pText, (Char*)pURL); m_pWebPanel->loadUrl(pText); delete [] pText; pText = NULL; } }
void TCommentDetailForm::SetTitleString(AppCommentDetailType appCommentDetailType) { TLabel* tLabel = static_cast< TLabel* >(GetControlPtr(this->m_nTitleLblID)); if(tLabel) { switch(appCommentDetailType) { case ReceivedUserCommentList: { tLabel->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_ReceivedUserCommentList),FALSE); break; } case SentUserCommentList: { tLabel->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_SentUserCommentList),FALSE); break; } case ReceivedCommentList: { tLabel->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_ReceivedCommentList),FALSE); break; } case SentCommentList: { tLabel->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_SentCommentList),FALSE); break; } case FriendCommentList: { tLabel->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_FriendsCommentList),FALSE); break; } case ReceivedAnObjectCommentList: { tLabel->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_ReceivedAnObjectCommentList),FALSE); break; } default: break; } } }
void ShowAbout(int iFontSize, Byte bLineBreak, Byte bVersionPos, String sDate, TPicture *pPicture, String sAddComp, String sVersion, String sAppName, String sCopyright, String sText, HICON hIcon) { TForm *Form; int I; String sCaption; TVSFixedFileInfo FileVersionInfo; String CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, OriginalFilename, ProductName, ProductVersion; TAboutObject *AboutObject; ShowWaitCursor(); // Randomize; if (IsShift() & IsCtrl()) { sAppName = "Дураев"; sAppName += sLineBreak; sAppName += "Константин Петрович"; sCopyright = ""; sCaption = "Автор"; sDate = "29.03.1981"; sVersion = ""; iFontSize = 16; sAddComp = NULL; pPicture = NULL; sText = ""; for (int i = 1; i < 280; i++) if (i % 40 == 0) sText = sText + sLineBreak; else // TODO: sText = sText + String(AnsiChar(Chr(Ord('А') + // Random(Ord('Я') - Ord('А'))))); sText = sText + L"Я"; } else { GetFileVerInfo(Application->ExeName, FileVersionInfo, CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, OriginalFilename, ProductName, ProductVersion); sCaption = LoadStr(IDS_ABOUT_CAPTION); if (sDate == NULL) sDate = FormatDateTime("yyyy.mm.dd", UnixToDateTime(((PIMAGE_NT_HEADERS)((DWORD)((PIMAGE_DOS_HEADER) HInstance) + (((PIMAGE_DOS_HEADER) HInstance)->e_lfanew))) ->FileHeader.TimeDateStamp)); if (sVersion == NULL) { sVersion = FileVersion; if (IsValueInWord(FileVersionInfo.dwFileFlags, VS_FF_DEBUG)) sVersion = sVersion + LoadStr(IDS_ABOUT_DEBUG); else if (IsValueInWord(FileVersionInfo.dwFileFlags, VS_FF_PRERELEASE)) sVersion = sVersion + LoadStr(IDS_ABOUT_RC); } if (sAppName == NULL) sAppName = ProductName; if (sCopyright == NULL) sCopyright = LegalCopyright + "|@[email protected]"; if (sText == NULL) { sText = LoadStr(IDS_ABOUT_EULA1) + sLineBreak + LoadStr(IDS_ABOUT_EULA2) + sLineBreak + LoadStr(IDS_ABOUT_EULA3) + sLineBreak + LoadStr(IDS_ABOUT_EULA4); } if (bLineBreak != MAXBYTE) { I = PosPlace(SPACE, sAppName, bLineBreak); sAppName = sAppName.SubString(1, I - 1) + sLineBreak + sAppName.SubString(I + 1, MAXINT); } } // IsShift and IsCtrl if (hIcon == NULL) hIcon = LoadIcon(HInstance, L"MAINICON"); AboutObject = new TAboutObject(); Form = new TForm(Application); // Owner; Form->ShowHint = true; Form->Font->Name = "Arial"; Form->Font->Size = 10; Form->BorderStyle = bsDialog; Form->Caption = sCaption; Form->ClientHeight = 165; Form->ClientWidth = 420; TBevel *bvlIconFrame = new TBevel(Form); bvlIconFrame->Parent = Form; bvlIconFrame->SetBounds(8, 14, 52, 52); bvlIconFrame->Shape = bsFrame; TPanel *pnlIcon = new TPanel(Form); pnlIcon->Parent = Form; pnlIcon->SetBounds(16, 22, 36, 36); pnlIcon->Caption = ""; pnlIcon->BevelOuter = bvNone; pnlIcon->BorderStyle = bsSingle; pnlIcon->ParentBackground = false; pnlIcon->Color = (TColor) Random(0xFFFFFF); TImage *imgIcon = new TImage(Form); // Icon imgIcon->Parent = pnlIcon; imgIcon->Align = alClient; imgIcon->Transparent = true; imgIcon->Picture->Icon->Handle = hIcon; TLabel *lblCopyright = new TLabel(Form); // Copyright lblCopyright->Tag = 1; lblCopyright->Parent = Form; lblCopyright->Font->Style = TFontStyles() << fsBold; lblCopyright->SetBounds(8, 80, 0, 0); int PosHint = Pos('|', sCopyright); if (PosHint == 0) lblCopyright->Caption = sCopyright; else { lblCopyright->Caption = sCopyright.SubString(1, PosHint - 1); lblCopyright->Hint = sCopyright.SubString(PosHint + 1, MAXINT); lblCopyright->Cursor = crHandPoint; lblCopyright->OnMouseEnter = AboutObject->MouseEnter; lblCopyright->OnMouseLeave = AboutObject->MouseLeave; if (lblCopyright->Hint[1] == '@') { lblCopyright->Hint = lblCopyright->Hint.SubString(2, MAXINT); AboutObject->MailAddress = lblCopyright->Hint; AboutObject->MailSubject = OriginalFilename + " " + FileVersion; } lblCopyright->OnClick = AboutObject->Click; } TLabel *lblText = new TLabel(Form); // Text lblText->Parent = Form; lblText->WordWrap = true; lblText->SetBounds(8, 100, Form->ClientWidth - 16, 0); lblText->Caption = sText; // I = lblText->Top + lblText->Height; Form->ClientHeight = Form->ClientHeight + lblText->Height; if (sAddComp != NULL) { /* with TBevel.Create(Form) do { Parent = Form; SetBounds(7, I + 5, Form.ClientWidth - 15, 5); Shape = bsTopLine; I = Top + Height; }; with TLabel.Create(Form) do // Add Components { Parent = Form; SetBounds(8, I, 0, 0); Caption = 'Программное обеспечение использует следующие компоненты:'; I = Top + Height; }; with TLabel.Create(Form) do // Components { Tag = 2; Parent = Form; Font.Style = [fsBold]; SetBounds(8, I, 0, 0); Caption = sAddComp; Form.ClientHeight = Form.ClientHeight + Height + 12; if FileExists(FileInAppDir(rsLicenses)) then { Cursor = crHandPoint; OnClick = ClickObject.Click; OnMouseEnter = ClickObject.MouseEnter; OnMouseLeave = ClickObject.MouseLeave; }; } */ } else // sAddComp != NULL Form->ClientHeight = Form->ClientHeight - 12; TBevel *bvlBottom = new TBevel(Form); bvlBottom->Parent = Form; bvlBottom->SetBounds(7, Form->ClientHeight - 43, Form->ClientWidth - 15, 5); bvlBottom->Shape = bsTopLine; lblMemory = new TLabel(Form); // Физическая ... lblMemory->Parent = Form; lblMemory->SetBounds(8, Form->ClientHeight - 38, 0, 0); lblMemory->Caption = LoadStr(IDS_ABOUT_MEMORY); lblMemoryValue = new TLabel(Form); // TotalPhys lblMemoryValue->Parent = Form; lblMemoryValue->Font->Style = TFontStyles() << fsBold; lblMemoryValue->SetBounds(lblMemory->Width + 13, Form->ClientHeight - 38, 0, 0); lblProc = new TLabel(Form); // Процессор: lblProc->Parent = Form; lblProc->SetBounds(8, Form->ClientHeight - 22, 0, 0); lblProc->Caption = LoadStr(IDS_ABOUT_PROCESSOR); lblProcValue = new TLabel(Form); // CPUSpeed lblProcValue->Parent = Form; lblProcValue->Font->Style = TFontStyles() << fsBold; lblProcValue->SetBounds(lblMemory->Width + 13, Form->ClientHeight - 22, 0, 0); TGradientPanel *pnlName = new TGradientPanel(Form); pnlName->Parent = Form; pnlName->StartUpdate(); pnlName->SetBounds(68, 8, Form->ClientWidth - 76, 64); pnlName->BorderStyle = bsSingle; pnlName->BevelOuter = bvNone; pnlName->ParentBackground = false; if (pPicture == NULL) pnlName->ColorStart = pnlIcon->Color; else pnlName->ColorStart = clBlack; pnlName->ColorEnd = clBlack; pnlName->EndUpdate(); if (pPicture == NULL) { TLabel *lblAppName = new TLabel(Form); // Application Name (1) lblAppName->Parent = pnlName; lblAppName->SetBounds(2, 2, Form->ClientWidth - 83, 58); lblAppName->Alignment = taCenter; lblAppName->AutoSize = false; lblAppName->Caption = sAppName; lblAppName->ParentColor = false; lblAppName->Color = clBlack; lblAppName->ParentFont = false; lblAppName->Font->Charset = DEFAULT_CHARSET; lblAppName->Font->Color = clBlack; lblAppName->Font->Height = -51; lblAppName->Font->Name = "Courier New"; lblAppName->Font->Style = TFontStyles() << fsBold << fsItalic; lblAppName->Font->Size = iFontSize; lblAppName->Transparent = true; lblAppName->Layout = tlCenter; lblAppName->WordWrap = true; TLabel *lblAppName2 = new TLabel(Form); // Application Name (2) lblAppName2->Parent = pnlName; lblAppName2->SetBounds(0, 0, Form->ClientWidth - 83, 58); lblAppName2->Alignment = taCenter; lblAppName2->AutoSize = false; lblAppName2->Caption = sAppName; lblAppName2->ParentColor = false; lblAppName2->Color = clBlack; lblAppName2->ParentFont = false; lblAppName2->Font->Charset = DEFAULT_CHARSET; lblAppName2->Font->Color = clWhite; lblAppName2->Font->Height = -51; lblAppName2->Font->Name = "Courier New"; lblAppName2->Font->Style = TFontStyles() << fsBold << fsItalic; lblAppName2->Font->Size = iFontSize; lblAppName2->Transparent = true; lblAppName2->Layout = tlCenter; lblAppName2->WordWrap = true; } // pPicture == NULL else { TImage *imgPicture = new TImage(Form); imgPicture->Parent = pnlName; imgPicture->Align = alClient; imgPicture->Picture->Assign(pPicture); } TLabel *lblDate = new TLabel(Form); // Date lblDate->Parent = pnlName; lblDate->Caption = sDate; lblDate->Font->Assign(Form->Font); lblDate->Font->Style = TFontStyles() << fsBold; lblDate->Font->Color = clWhite; lblDate->Font->Size = 8; lblDate->Alignment = taRightJustify; switch (3) { case 0: lblDate->SetBounds(2, 2, lblDate->Width, lblDate->Height); break; case 1: lblDate->SetBounds(2, pnlName->ClientHeight - lblDate->Height - 2, lblDate->Width, lblDate->Height); break; case 2: lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2, 2, lblDate->Width, lblDate->Height); break; default: lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2, pnlName->ClientHeight - lblDate->Height - 2, lblDate->Width, lblDate->Height); } lblDate->Transparent = true; TLabel *lblVerion = new TLabel(Form); // Version lblVerion->Parent = pnlName; lblVerion->Caption = sVersion; lblVerion->Font->Assign(Form->Font); lblVerion->Font->Style = TFontStyles() << fsBold; lblVerion->Font->Color = clWhite; lblVerion->Font->Size = 8; switch (2) { case 0: lblVerion->SetBounds(2, 2, lblVerion->Width, lblVerion->Height); break; case 1: lblVerion->SetBounds(2, pnlName->ClientHeight - lblVerion->Height - 2, lblVerion->Width, lblVerion->Height); break; case 2: lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2, 2, lblVerion->Width, lblVerion->Height); break; default: lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2, pnlName->ClientHeight - lblVerion->Height - 2, lblVerion->Width, lblVerion->Height); } lblVerion->Transparent = true; TButton *btnClose = new TButton(Form); btnClose->Parent = Form; btnClose->Caption = "OK"; btnClose->ModalResult = mrCancel; btnClose->Cancel = true; btnClose->SetBounds(Form->ClientWidth - 83, Form->ClientHeight - 34, 75, 26); btnClose->TabOrder = 0; TTimer *timer = new TTimer(Form); timer->OnTimer = AboutObject->TimerTimer; timer->Interval = 1; timer->Enabled = true; RestoreCursor(); Form->Left = (Screen->Width - Form->Width) / 2; Form->Top = (Screen->Height - Form->Height) / 2; SetCurPosToCenter(btnClose); Form->ShowModal(); Form->Free(); AboutObject->Free(); lblMemory = NULL; lblProc = NULL; lblMemoryValue = NULL; lblProcValue = NULL; }
// 窗口初始化 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 ); } } else { for( nIndex = 0; nIndex < nListItems; nIndex++) { 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; //好友名字 TUString::StrUtf8ToStrUnicode(pszFriendName, (const Char *)Response->friends[nIndex].fname); nFriendNameId[nIndex] = lpItem->AddCtrl(CTL_CLASS_RICHVIEW, 20, 5); TRichView* pFriendName = static_cast<TRichView*>(GetControlPtr(nFriendNameId[nIndex])); TRectangle Rc_FriendName(OFFSET_X, ItemHeight, SCR_W - 40 , 20); pFriendName->SetBounds(&Rc_FriendName); objFontType = pFriendName->GetFont(); objFontType.Create(FONT_CONTENT_DETAIL, FONT_CONTENT_DETAIL); pFriendName->SetFont(objFontType); //pFriendName->SetColor(CTL_COLOR_TYPE_FORE,RGB_COLOR_BLUE); pFriendName->SetWordWrapAttr(TRUE); pFriendName->SetTransparent(TRUE); pFriendName->SetEnabled(TRUE); pFriendName->SetScrollBarMode(CTL_SCL_MODE_NONE); pFriendName->SetMaxVisibleLines(1, TRUE); pFriendName->SetCaption(pszFriendName,FALSE); pFriendName->GetBounds(&Rc_Temp); ItemHeight = ItemHeight + Rc_Temp.Height() + 5; lpItem->SetHeight(ItemHeight - (rect.Y() - Rc_CoolBarList.Y()) + 10 ); } } } } //:TODO:Add subject info lpRowList->BeginUpdate(); lpRow = lpRowList->AppendRow(); lpRowList->EndUpdate(); //add Item if(lpRow) { //nothing to do } } } } return TRUE; }
void TUserInfoDetailForm::_SetDataToCtrls(TApplication* pApp) { if(this->Response && Response->nSize_friends != 0) { TFont objFontType; TUChar pszState[1024] = {0}; TUChar pszStateTime[32] = {0}; TUChar pszLogoPath[256] = {0}; TUChar pszUserName[32] = {0}; TRectangle Rc_Temp; TRectangle rect; TMaskButton* pUserHeadMBtn = static_cast<TMaskButton*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_UserDetailHeadMaskButton)); TBitmap* pDownLoadBitmap = NULL; //Photo, 先读取磁盘cache pDownLoadBitmap = LoadImgByUrl(Response->friends[0].flogo90); //磁盘cache无文件,再下载 if( pDownLoadBitmap == NULL) { TRectangle rc; KaiXinAPICommon_DownloadPhoto(Response->friends[0].flogo90, this->GetWindowHwndId(), 0 ); const TBitmap * pBmp = TResource::LoadConstBitmap(APP_KA_ID_BITMAP_Default); pUserHeadMBtn->GetBounds(&rc); pUserHeadMBtn->SetEnabled(FALSE); pUserHeadMBtn->SetCaption(TUSTR_Kx_NULL,0,0); pUserHeadMBtn->SetImage(pBmp,(rc.Width()-pBmp->GetWidth())/2, (rc.Height()-pBmp->GetHeight())/2); } else { TRectangle rc; pUserHeadMBtn->GetBounds(&rc); pUserHeadMBtn->SetEnabled(FALSE); pUserHeadMBtn->SetCaption(TUSTR_Kx_NULL,0,0); pPhotoBmp = TBitmap::Create(PHOTO_W, PHOTO_H, pDownLoadBitmap->GetDepth()); pPhotoBmp->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255)); pUserHeadMBtn->SetImage(pPhotoBmp,(rc.Width()-pPhotoBmp->GetWidth())/2, (rc.Height()-pPhotoBmp->GetHeight())/2); //释放图片 pDownLoadBitmap->Destroy(); pDownLoadBitmap = NULL; } //用户名 TRichView *pUserName = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_NameLbl)); if(pUserName) { TUString::StrUtf8ToStrUnicode(pszUserName , (const Char *)Response->friends[0].fname); objFontType = pUserName->GetFont(); objFontType.Create(FONT_LARGE_NAME, FONT_LARGE_NAME); pUserName->SetFont(objFontType); pUserName->SetColor(CTL_COLOR_TYPE_FORE, RGB(67, 67, 135)); pUserName->SetTransparent(TRUE); pUserName->SetCaption(pszUserName, FALSE); pUserName->SetEnabled(TRUE); } //用户状态 TPanel*pPanel = static_cast<TPanel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_StateContPanel)); TRichView* pRichView = new TRichView(); Int32 nRichViewId = 0; if(pRichView->Create(pPanel)) { TRectangle obBtnRec(0,0,0,0); pPanel->GetBounds(&obBtnRec); obBtnRec.SetX(0); obBtnRec.SetY(0); pRichView->SetBounds(&obBtnRec); TUString::StrUtf8ToStrUnicode(pszState, (Char*)Response->friends[0].state); objFontType = pRichView->GetFont(); objFontType.Create(FONT_STATE, FONT_STATE); pRichView->SetFont(objFontType); pRichView->SetCaption(pszState,FALSE); pRichView->SetEnabled(FALSE); pRichView->SetWordWrapAttr(TRUE); pRichView->SetTransparent(TRUE); pRichView->SetScrollBarMode(CTL_SCL_MODE_NONE); pRichView->SetUnderLine(TRUE); Int32 nLineCount = pRichView->GetLinesCount(); if(nLineCount <7) nLineCount = 7; pRichView->SetMaxVisibleLines(nLineCount, TRUE); } //状态更新时间 TRichView* pStateTime = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_StateTimeLbl)); if(pStateTime) { objFontType = pStateTime->GetFont(); objFontType.Create(FONT_OTHER_INFO, FONT_OTHER_INFO); pStateTime->SetFont(objFontType); pStateTime->SetColor(CTL_COLOR_TYPE_FORE, RGB_COLOR_GRAY); pStateTime->SetTransparent(TRUE); //pStateTime->SetCaption(pszStateTime, FALSE); pStateTime->SetEnabled(TRUE); if(strcmp(Response->friends[0].state,"")==0) { TUString::StrCat(pszStateTime, TUSTR_Kx_Left_Parenthesis); TUString::StrCat(pszStateTime, TResource::LoadConstString(APP_KA_ID_STRING_NoState)); TUString::StrCat(pszStateTime, TUSTR_Kx_Right_Parenthesis); pStateTime->SetCaption(pszStateTime, FALSE); } else { TUChar* pszDateTime = NULL; cUnixTime_ConvertUnixTimeToFormatString( Response->friends[0].statetime, KX_TIME_FORMAT_YY_MM_DD, &pszDateTime ); if(pszDateTime != NULL) { TUString::StrCat(pszStateTime, TUSTR_Kx_Left_Parenthesis); TUString::StrCat(pszStateTime, pszDateTime); TUString::StrCat(pszStateTime, TUSTR_Kx_Right_Parenthesis); } pStateTime->SetCaption(pszStateTime, FALSE); if(pszDateTime != NULL) { delete pszDateTime; pszDateTime = NULL; } } } //Set InfoCoolBar Ctrls data //基本信息 objFontType.Create(14, 14); /*"性别"*/ TLabel* pGenderLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_GenderLbl)); TLabel* pGenderValueLble = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_GenderValueLbl)); if(pGenderLbl) { pGenderLbl->SetFont(objFontType); pGenderLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pGenderValueLble) { pGenderValueLble->SetFont(objFontType); if(Response->friends[0].gender == 1) { pGenderValueLble->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_Female),FALSE); } else { pGenderValueLble->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_Male),FALSE); } } /*"出生日期"*/ TUChar pszBirthdayValue[32] = {0}; TUString::StrUtf8ToStrUnicode(pszBirthdayValue , (const Char *)Response->friends[0].birthday); TLabel* pBirthdayLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_BirthdayLbl)); TLabel* pBirthdayValueLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_BirthdayValueLbl)); if(pBirthdayLbl) { pBirthdayLbl->SetFont(objFontType); pBirthdayLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pBirthdayValueLbl) { pBirthdayValueLbl->SetFont(objFontType); pBirthdayValueLbl->SetCaption(pszBirthdayValue,FALSE); } /*"现居住地"*/ TUChar pszCityValue[64] = {0}; TUString::StrUtf8ToStrUnicode(pszCityValue , (const Char *)Response->friends[0].city); TLabel* pCityLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_CityLbl)); TRichView* pCityValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_CityValueView)); if(pCityLbl) { pCityLbl->SetFont(objFontType); pCityLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pCityValueView) { pCityValueView->SetCaption(pszCityValue,FALSE); pCityValueView->SetFont(objFontType); pCityValueView->SetWordWrapAttr(TRUE); pCityValueView->SetTransparent(TRUE); pCityValueView->SetEnabled(FALSE); pCityValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pCityValueView->SetMaxVisibleLines(pCityValueView->GetLinesCount(), TRUE); pCityValueView->GetBounds(&Rc_Temp); } /*" 家乡"*/ TUChar pszHomeTownValue[256*3] = {0}; TUString::StrUtf8ToStrUnicode(pszHomeTownValue , (const Char *)Response->friends[0].hometown); TLabel* pHomeTownLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_HomeTownLbl)); TRichView* pHomeTownValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_HomeTownValueView)); if(pHomeTownLbl) { pHomeTownLbl->SetFont(objFontType); pHomeTownLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pHomeTownValueView) { pHomeTownValueView->SetCaption(pszHomeTownValue,FALSE); pHomeTownValueView->SetFont(objFontType); pHomeTownValueView->SetWordWrapAttr(TRUE); pHomeTownValueView->SetTransparent(TRUE); pHomeTownValueView->SetEnabled(FALSE); pHomeTownValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pHomeTownValueView->SetMaxVisibleLines(pHomeTownValueView->GetLinesCount(), TRUE); pHomeTownValueView->GetBounds(&Rc_Temp); } /*"兴趣爱好"*/ TUChar pszInterestValue[1024*3] = {0}; TUString::StrUtf8ToStrUnicode(pszInterestValue , (const Char *)Response->friends[0].interest); TLabel* pInterestLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_InterestLbl)); TRichView* pInterestValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_InterestValueView)); if(pInterestLbl) { pInterestLbl->SetFont(objFontType); pInterestLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pInterestValueView) { pInterestValueView->SetCaption(pszInterestValue,FALSE); pInterestValueView->SetFont(objFontType); pInterestValueView->SetWordWrapAttr(TRUE); pInterestValueView->SetTransparent(TRUE); pInterestValueView->SetEnabled(FALSE); pInterestValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pInterestValueView->SetMaxVisibleLines(pInterestValueView->GetLinesCount(), TRUE); pInterestValueView->GetBounds(&Rc_Temp); } //其他信息 /*"手机"*/ TUChar pszMobileValue[32] = {0}; TUString::StrUtf8ToStrUnicode(pszMobileValue , (const Char *)Response->friends[0].mobile); TLabel* pMobileLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_MobileLbl)); TRichView* pMobileValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_MobileValueView)); if(pMobileLbl) { pMobileLbl->SetFont(objFontType); pMobileLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pMobileValueView) { pMobileValueView->SetCaption(pszMobileValue,FALSE); pMobileValueView->SetFont(objFontType); pMobileValueView->SetWordWrapAttr(TRUE); pMobileValueView->SetTransparent(TRUE); pMobileValueView->SetEnabled(FALSE); pMobileValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pMobileValueView->SetMaxVisibleLines(pMobileValueView->GetLinesCount(), TRUE); pMobileValueView->GetBounds(&Rc_Temp); } /*"电话"*/ TUChar pszTelValue[32] = {0}; TUString::StrUtf8ToStrUnicode(pszTelValue , (const Char *)Response->friends[0].tel); TLabel* pTelLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_TelLbl)); TRichView* pTelValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_TelValueView)); if(pTelLbl) { pTelLbl->SetFont(objFontType); pTelLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pTelValueView) { pTelValueView->SetCaption(pszTelValue,FALSE); pTelValueView->SetFont(objFontType); pTelValueView->SetWordWrapAttr(TRUE); pTelValueView->SetTransparent(TRUE); pTelValueView->SetEnabled(FALSE); pTelValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pTelValueView->SetMaxVisibleLines(pTelValueView->GetLinesCount(), TRUE); pTelValueView->GetBounds(&Rc_Temp); } /*"QQ号"*/ TUChar pszQQValue[32] = {0}; TUString::StrUtf8ToStrUnicode(pszQQValue , (const Char *)Response->friends[0].qq); TLabel* pQQLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_QQLbl)); TRichView* pQQValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_QQValueView)); if(pQQLbl) { pQQLbl->SetFont(objFontType); pQQLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pQQValueView) { pQQValueView->SetCaption(pszQQValue,FALSE); pQQValueView->SetFont(objFontType); pQQValueView->SetWordWrapAttr(TRUE); pQQValueView->SetTransparent(TRUE); pQQValueView->SetEnabled(FALSE); pQQValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pQQValueView->SetMaxVisibleLines(pQQValueView->GetLinesCount(), TRUE); pQQValueView->GetBounds(&Rc_Temp); } /*"MSN账号"*/ TUChar pszMSNValue[128] = {0}; TUString::StrUtf8ToStrUnicode(pszMSNValue , (const Char *)Response->friends[0].msn); TLabel* pMSNLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_MSNLbl)); TRichView* pMSNValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_MSNValueView)); if(pMSNLbl) { pMSNLbl->SetFont(objFontType); pMSNLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pMSNValueView) { pMSNValueView->SetCaption(pszMSNValue,FALSE); pMSNValueView->SetFont(objFontType); pMSNValueView->SetWordWrapAttr(TRUE); pMSNValueView->SetTransparent(TRUE); pMSNValueView->SetEnabled(FALSE); pMSNValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pMSNValueView->SetMaxVisibleLines(pMSNValueView->GetLinesCount(), TRUE); } /*"地址"*/ TUChar pszAddressValue[1024] = {0}; TUString::StrUtf8ToStrUnicode(pszAddressValue , (const Char *)Response->friends[0].address); TLabel* pAddressLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_AddressLbl)); TRichView* pAddressValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_AddressValueView)); if(pAddressLbl) { pAddressLbl->SetFont(objFontType); pAddressLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pAddressValueView) { pAddressValueView->SetCaption(pszAddressValue,FALSE); pAddressValueView->SetFont(objFontType); pAddressValueView->SetWordWrapAttr(TRUE); pAddressValueView->SetTransparent(TRUE); pAddressValueView->SetEnabled(FALSE); pAddressValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pAddressValueView->SetMaxVisibleLines(pAddressValueView->GetLinesCount(), TRUE); pAddressValueView->GetBounds(&Rc_Temp); } /*"邮编"*/ TUChar pszZipValue[32] = {0}; TUString::StrUtf8ToStrUnicode(pszZipValue , (const Char *)Response->friends[0].zip); TLabel* pZipLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_ZipLbl)); TRichView* pZipValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_ZipValueView)); if(pZipLbl) { pZipLbl->SetFont(objFontType); pZipLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pZipValueView) { pZipValueView->SetCaption(pszZipValue,FALSE); pZipValueView->SetFont(objFontType); pZipValueView->SetWordWrapAttr(TRUE); pZipValueView->SetTransparent(TRUE); pZipValueView->SetEnabled(FALSE); pZipValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pZipValueView->SetMaxVisibleLines(pZipValueView->GetLinesCount(), TRUE); pZipValueView->GetBounds(&Rc_Temp); } /*"电子邮件"*/ TUChar pszEmailValue[128] = {0}; TUString::StrUtf8ToStrUnicode(pszEmailValue , (const Char *)Response->friends[0].email); TLabel* pEmailLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_EmailLbl)); TRichView* pEmailValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_EmailValueView)); if(pEmailLbl) { pEmailLbl->SetFont(objFontType); pEmailLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pEmailValueView) { pEmailValueView->SetCaption(pszEmailValue,FALSE); pEmailValueView->SetFont(objFontType); pEmailValueView->SetWordWrapAttr(TRUE); pEmailValueView->SetTransparent(TRUE); pEmailValueView->SetEnabled(FALSE); pEmailValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pEmailValueView->SetMaxVisibleLines(pEmailValueView->GetLinesCount(), TRUE); pEmailValueView->GetBounds(&Rc_Temp); } /*"教育背景"*/ TUChar pszEduValue[1024] = {0}; for(int i=0; i<Response->friends[0].nSize_education; i++) { TUChar pszTemp[128*3] = {0}; TUChar pszYear[32] = {0}; //院校名 TUString::StrUtf8ToStrUnicode(pszTemp , (const Char *)Response->friends[0].education[i].school); TUString::StrCat(pszEduValue,pszTemp); TUString::StrCat(pszEduValue, TUSTR_Kx_Empty_Cell); //班级 TUString::StrUtf8ToStrUnicode(pszTemp , (const Char *)Response->friends[0].education[i].classEx); TUString::StrCat(pszEduValue,pszTemp); TUString::StrCat(pszEduValue, TUSTR_Kx_Ellipsis); //届 TUString::StrUtf8ToStrUnicode(pszYear , (const Char *)Response->friends[0].education[i].year); TUString::StrCat(pszEduValue,pszYear); TUString::StrCat(pszEduValue, (const TUChar*)TUSTR_Kx_Newline_Character); } TLabel* pEduLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_EduLbl)); TRichView* pEduValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_EduValueView)); if(pEduLbl) { pEduLbl->SetFont(objFontType); pEduLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pEduValueView) { pEduValueView->SetCaption(pszEduValue,FALSE); pEduValueView->SetFont(objFontType); pEduValueView->SetWordWrapAttr(TRUE); pEduValueView->SetTransparent(TRUE); pEduValueView->SetEnabled(FALSE); pEduValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pEduValueView->SetMaxVisibleLines(pEduValueView->GetLinesCount(), TRUE); pEduValueView->GetBounds(&Rc_Temp); } /*"工作经历"*/ TUChar pszCareerValue[1024] = {0}; for(int i=0; i<Response->friends[0].nSize_career; i++) { TUChar pszTemp[128*3] = {0}; TUChar pszYear[8] = {0}; TUChar pszMonth[8] = {0}; //公司名 TUString::StrUtf8ToStrUnicode(pszTemp , (const Char *)Response->friends[0].career[i].company); TUString::StrCat(pszCareerValue,pszTemp); TUString::StrCat(pszCareerValue, TUSTR_Kx_Empty_Cell); //部门名 TUString::StrUtf8ToStrUnicode(pszTemp , (const Char *)Response->friends[0].career[i].dept); TUString::StrCat(pszCareerValue,pszTemp); TUString::StrCat(pszCareerValue, TUSTR_Kx_Empty_Cell); //开始年月 TUString::StrUtf8ToStrUnicode(pszYear , (const Char *)Response->friends[0].career[i].beginyear); TUString::StrCat(pszCareerValue,pszYear); TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Year)); TUString::StrUtf8ToStrUnicode(pszMonth , (const Char *)Response->friends[0].career[i].beginmonth); TUString::StrCat(pszCareerValue,pszMonth); TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Month)); //分隔符- TUString::StrCat(pszCareerValue, TUSTR_Kx_Separator); //结束年月 TUString::StrUtf8ToStrUnicode(pszYear , (const Char *)Response->friends[0].career[i].endyear); if(TUString::StrLen(pszYear)==0) { TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Now)); } else { TUString::StrCat(pszCareerValue,pszYear); TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Year)); TUString::StrUtf8ToStrUnicode(pszMonth , (const Char *)Response->friends[0].career[i].endmonth); TUString::StrCat(pszCareerValue,pszMonth); TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Month)); } TUString::StrCat(pszCareerValue, (const TUChar*)TUSTR_Kx_Newline_Character); } TLabel* pCareerLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_CareerLbl)); TRichView* pCareerValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_CareerValueView)); if(pCareerLbl) { pCareerLbl->SetFont(objFontType); pCareerLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY); } if(pCareerValueView) { pCareerValueView->SetCaption(pszCareerValue,FALSE); pCareerValueView->SetFont(objFontType); pCareerValueView->SetWordWrapAttr(TRUE); pCareerValueView->SetTransparent(TRUE); pCareerValueView->SetEnabled(FALSE); pCareerValueView->SetScrollBarMode(CTL_SCL_MODE_NONE); pCareerValueView->SetMaxVisibleLines(pCareerValueView->GetLinesCount(), TRUE); pCareerValueView->GetBounds(&Rc_Temp); } } }
// 窗口初始化 Boolean TFeedGetFangleForm::_OnWinInitEvent(TApplication * pApp, EventType * pEvent) { int iRet = eFailed; m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT); SetAppTilte(this, APP_RE_ID_STRING_Fangle_Count); //从对应Json中获取数据,用于更新UI iRet = RenRenAPI_JsonParse(RR_FeedGetFangle, (void **)&Response); if( Response == NULL || iRet != 0 ) { return FALSE; } TCoolBarList* pTCoolBarList = NULL; TRectangle mTRectangle(0,0,0,0); if(Response->nArraySize == 0) { //无回复提示 TPanel* pTPanel = NULL; pTPanel = static_cast<TPanel*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonPanel)); TCtrl* mControlTImage; TCtrl* mControlTLabel; TImage* pTImage = NULL; TLabel* pTLabel = NULL; mControlTImage = new TImage; if(mControlTImage->Create(pTPanel)) { mTRectangle.SetRect(8,10,50,50); mControlTImage->SetBounds(&mTRectangle); pTImage = static_cast<TImage*>(mControlTImage); pTImage->SetBitmap(TResource::LoadConstBitmap(APP_RE_ID_BITMAP_comment_img_with_frame)); pTImage->SetBounds(&mTRectangle); } mControlTLabel = new TLabel; if(mControlTLabel->Create(pTPanel)) { mTRectangle.SetRect((mTRectangle.X() + mTRectangle.Width()),(mTRectangle.Y()+ 10) ,200,50); mControlTLabel->SetBounds(&mTRectangle); pTLabel = static_cast<TLabel*>(mControlTLabel); pTLabel->SetCaption(TResource::LoadConstString(APP_RE_ID_STRING_NothingFangle), FALSE); } goto OutCoolBarList; } pTCoolBarList = static_cast<TCoolBarList*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonCoolBarList)); if(pTCoolBarList) { mTRectangle.SetRect(6,0,308,412); TBarListItem* pTBarListItem = NULL; TBarRowList* pTBarRowList = NULL; TBarRow* pTBarRow = NULL; TFont mTFont; pTBarRowList = pTCoolBarList->Rows(); if(pTBarRowList) { pTBarRowList->BeginUpdate(); pTBarRowList->Clear(); pTBarRow = pTBarRowList->AppendRow(); if(pTBarRow) { pTBarRow->SetCaption(NULL); for(int i = 0; i < Response->nArraySize; ++i) { Coord mItemHeight = 0; pTBarListItem = pTBarRow->AppendItem(); if(pTBarListItem) { pTBarListItem->SetCaption(NULL); pTBarListItem->SetTitle(NULL); pTBarListItem->SetIndicatorType(itDefault); pTBarListItem->SetValue(1); CtrlAddItemToCoolBarList_Image(this, pTBarListItem, 10,10, 16, 16, (TBitmap*)TResource::LoadConstBitmap(APP_RE_ID_BITMAP_FeedType_comment)); TUChar buf[256] = {0}; char szbuf[512] = {0}; strcpy(szbuf,Response->Array[i].name); strcat(szbuf,Response->Array[i].prefix); if(strcmp(Response->Array[i].title,"") != 0) { strcat(szbuf,"'"); strcat(szbuf,Response->Array[i].title); strcat(szbuf,"'"); } strcat(szbuf,Response->Array[i].sufix); TUString::StrUtf8ToStrUnicode(buf, (Char *)szbuf); CtrlAddItemToCoolBarList_RichView(this, pTBarListItem, 30, 10, SCR_W - 70, &mItemHeight, FONT_NORMAL, buf, RGB_COLOR_BLACK); TUString::StrUtf8ToStrUnicode(buf, (const Char *)Response->Array[i].time); CtrlAddItemToCoolBarList_Lable(this, pTBarListItem, 30, mItemHeight + 20, 0, FONT_SMALL, buf, RGB_COLOR_LIGHTBLUE); mItemHeight = mItemHeight + 40; pTBarListItem->SetHeight(mItemHeight); //pTBarListItem->SetHeight(60); } } } pTBarRowList->EndUpdate(); } } OutCoolBarList: return TRUE; }