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


C++ TBitmap::GetDepth方法代码示例

本文整理汇总了C++中TBitmap::GetDepth方法的典型用法代码示例。如果您正苦于以下问题:C++ TBitmap::GetDepth方法的具体用法?C++ TBitmap::GetDepth怎么用?C++ TBitmap::GetDepth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TBitmap的用法示例。


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

示例1: _UpdateProfilePhoto

/**
 * 从profile中读取大头像, 如果本地没有则进行下载
 *
 * \param pApp
 * \param ResponseInfoPhoto
 *
 * \return 
 */
Boolean TPhotosGetAlbumsForm::_UpdateProfilePhoto(TApplication* pApp, tResponseUsersGetInfo* ResponseInfoPhoto)
{

	if(ResponseInfoPhoto == NULL)
		return FALSE;
	
	if(ResponseInfoPhoto->nArraySize > 0)
	{
		TBitmap* pDownLoadBitmap = NULL;
		pDownLoadBitmap = LoadImgByUrl(ResponseInfoPhoto->Array[0].headurl);						
		if(pDownLoadBitmap == NULL)
		{
			RenRenAPICommon_DownloadPhoto(ResponseInfoPhoto->Array[0].headurl, this->GetWindowHwndId(), FEED_PROFILE_IMAGE_INDEX);	
		}
		else
		{
			TMaskButton* pLogo = NULL;
			pLogo = static_cast<TMaskButton*>(GetControlPtr(m_ProfileImageID));
			if(pLogo)
			{
				TRectangle rc;
				TBitmap * pProfileImageTmp = NULL;	//Profile的头像

				pLogo->GetBounds(&rc);
				
				pProfileImageTmp = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
				pProfileImageTmp->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));
				pLogo->SetCaption(TUSTR_Re_NULL,0,0);
				pLogo->SetImage(pProfileImageTmp, (rc.Width()-pProfileImageTmp->GetWidth())/2, (rc.Height()-pProfileImageTmp->GetHeight())/2);
				pLogo->Draw();

				//如果先Desroy,则会崩溃,很奇怪,原因不明,暂时这么处理
				if( pProfileImage != NULL)
				{
					pProfileImage->Destroy();
					pProfileImage = NULL; 							
				}
				pProfileImage = pProfileImageTmp;
				
			}

			//释放图片
			pDownLoadBitmap->Destroy();
			pDownLoadBitmap = NULL; 	
		}
	}

	return TRUE;
}
开发者ID:pengjohn,项目名称:RenRen,代码行数:57,代码来源:RenRenForm_PhotosGetAlbums.cpp

示例2: EventHandler


//.........这里部分代码省略.........
		} 
		break;

        //下载完成事件
	case MSG_DL_THREAD_NOTIFY:
		{
			NotifyMsgDataType notifyData;
			Sys_GetMessageBody((MESSAGE_t *)pEvent, &notifyData, sizeof(NotifyMsgDataType));
			bHandled = TRUE;
			switch(notifyData.nAccessType)
			{
				case RR_PhotoDownload:
				{
					if(notifyData.nParam == FEED_PROFILE_IMAGE_INDEX)
					{	
						//下载完后更新对应的图片
						TBitmap* pDownLoadBitmap = NULL;
						pDownLoadBitmap = LoadImgByPath(notifyData.pszFilePath);

						if(pDownLoadBitmap)
						{
							TMaskButton* pLogo = NULL;
							pLogo = static_cast<TMaskButton*>(GetControlPtr(m_ProfileImageID));
							if(pLogo)
							{
								TRectangle rc;							
								pLogo->GetBounds(&rc);
								if( pProfileImage != NULL)
								{
									pProfileImage->Destroy();
									pProfileImage = NULL; 							
								}
									
								pProfileImage = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
								pProfileImage->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));
								pLogo->SetCaption(TUSTR_Re_NULL,0,0);
								pLogo->SetImage(pProfileImage, (rc.Width()-pProfileImage->GetWidth())/2, (rc.Height()-pProfileImage->GetHeight())/2);										pLogo->Draw();
							}				

							//释放图片
							pDownLoadBitmap->Destroy();
							pDownLoadBitmap = NULL; 						
						}	
						break;
					}
						
					TBitmap* pDownLoadBitmap = NULL;
					pDownLoadBitmap= LoadImgByPath(notifyData.pszFilePath);
					if(pDownLoadBitmap != NULL)
					{
						TImage* pImage = static_cast<TImage*>(GetControlPtr(gItemData[notifyData.nParam].nImageID));
						if(pImage != NULL)
						{
							if( gItemData[notifyData.nParam].pBmp != NULL)
							{
								gItemData[notifyData.nParam].pBmp->Destroy();
								gItemData[notifyData.nParam].pBmp = NULL;									
							}
							gItemData[notifyData.nParam].pBmp = pDownLoadBitmap->Create(IMAGE_W, IMAGE_H, 32);
							gItemData[notifyData.nParam].pBmp->QuickSpecialZoom(pDownLoadBitmap, 0, 0);
					
							//pImage->SetImage(gItemData[notifyData.nParam].pBmp, (HEADMASKBUTTON_W - gItemData[notifyData.nParam].pBmp->GetWidth())/2, (HEADMASKBUTTON_H - gItemData[notifyData.nParam].pBmp->GetHeight())/2 );
							pImage->SetBitmap(gItemData[notifyData.nParam].pBmp);
							pImage->Draw();
						}
开发者ID:pengjohn,项目名称:RenRen,代码行数:66,代码来源:RenRenForm_PhotosGetAlbums.cpp

示例3: _OnWinInitEvent

// 窗口初始化
Boolean TPhotosGetAlbumsForm::_OnWinInitEvent(TApplication * pApp, EventType * pEvent)
{
	int nErrorCode = eFailed;
	Int32 Height_Panel = 0;		//Panel高度		

	//m_TitleBtnLeft = SetAppTitleButton(this, APP_RE_ID_STRING_Comment,TITLE_BUTTON_LEFT);

	//显示不同的title
	if(m_FormMode == FORM_MODE_NORMAL)
	{
		SetAppTilte(this, APP_RE_ID_STRING_Album);
		m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);

		char* uid = NULL;
		uid = Get_Url_Params(RR_PhotosGetAlbums, "uid");
		if( strcmp(uid, RenRenUserInfo.szuid) == 0)
		{
			m_TitleBtnLeft = SetAppBitmapButton(this, APP_RE_ID_BITMAP_take_photo, APP_RE_ID_BITMAP_take_photo);
		}
	}
	else if(m_FormMode == FORM_MODE_MYHOME)
	{
		tResponseProfile* ResponseProfile;
		nErrorCode = RenRenAPI_JsonParse(RR_ProfileGetInfo, (void **)&ResponseProfile);
		if(ResponseProfile != NULL)
		{
			if(ResponseProfile->uid == RenRenUserInfo.uid)
			{
				SetAppTilte(this, APP_RE_ID_STRING_MyNews);
				m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Home, TITLE_BUTTON_RIGHT);
				m_TitleBtnLeft = SetAppBitmapButton(this, APP_RE_ID_BITMAP_take_photo, APP_RE_ID_BITMAP_take_photo);
			}
			else
			{
				//姓名
				TUChar  pszFName[64] = {0};
				TUString::StrUtf8ToStrUnicode(pszFName , (const Char *)ResponseProfile->name);
				SetAppTilte(this, 0, pszFName);
				m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);
			}
			delete ResponseProfile;
			ResponseProfile = NULL;
		}		
		
	}

	//设置panel高度
	TPanel* pTPanel = static_cast<TPanel*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonPanel));	
	TCoolBarList* pCoolBarList = static_cast<TCoolBarList*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonCoolBarList));	
	
	if(pTPanel)
	{
		TRectangle rect;
		
		Height_Panel = SCR_H - STATUSBAR_H - TITLEBAR_H;
		if(m_FormMode == FORM_MODE_MYHOME)
			Height_Panel -= BOTTOM_TAB_H;
			
		pTPanel->GetBounds(&rect);
		rect.SetHeight(Height_Panel);
		pTPanel->SetBounds(&rect);
	}

	if(m_FormMode == FORM_MODE_MYHOME)
		CreateProfileBottomTab(this, &BottomTabCtrID, 2);

	//显示个人信息
	if(m_FormMode == FORM_MODE_MYHOME)
	{
		Int32 Height_Top = 0;			//CoolBarList上面信息的高度
		Int32 Height_CoolBarList = 0;	//CoolBarList高度	
		tResponseProfile* ResponseProfile;
		nErrorCode = RenRenAPI_JsonParse(RR_ProfileGetInfo, (void **)&ResponseProfile);
		if(ResponseProfile != NULL)
		{
			//头像
			TBitmap* pDownLoadBitmap = NULL;
			pDownLoadBitmap = LoadImgByUrl(ResponseProfile->headurl);			
			//pProfileImage = LoadImgByUrl(ResponseProfile->headurl);
			const TBitmap * pImageDeault = TResource::LoadConstBitmap(APP_RE_ID_BITMAP_DefaultLarge);
			const TBitmap * pBackImage = TResource::LoadConstBitmap(APP_RE_ID_BITMAP_headmask_large);
			if(pDownLoadBitmap == NULL)
			{
				//RenRenAPICommon_DownloadPhoto(ResponseProfile->headurl, this->GetWindowHwndId(), FEED_PROFILE_IMAGE_INDEX);	
				m_ProfileImageID = CtrlAddItemToPanel_MaskButton(this, pTPanel, RR_HEAD_X, RR_HEAD_Y, RR_HEAD_W, RR_HEAD_H, (TBitmap*)pImageDeault, (TBitmap*)pImageDeault, (TBitmap*)pBackImage );	
				this->DisableControl(m_ProfileImageID);
			}
			else
			{
				//需要做放大
				pProfileImage = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
				pProfileImage->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));				
				m_ProfileImageID = CtrlAddItemToPanel_MaskButton(this, pTPanel, RR_HEAD_X, RR_HEAD_Y, RR_HEAD_W, RR_HEAD_H, (TBitmap*)pProfileImage, (TBitmap*)pProfileImage, (TBitmap*)pBackImage );	
				this->DisableControl(m_ProfileImageID);
				
				//释放图片
				pDownLoadBitmap->Destroy();
				pDownLoadBitmap = NULL; 						
			}
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:RenRen,代码行数:101,代码来源:RenRenForm_PhotosGetAlbums.cpp

示例4: _OnWinInitEvent

// 窗口初始化
Boolean TGuestbookGetForm::_OnWinInitEvent(TApplication * pApp, EventType * pEvent)
{	
	m_TitleBtnLeft = SetAppBitmapButton(this, APP_RE_ID_BITMAP_write_but, APP_RE_ID_BITMAP_write_but_over);
	//m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);
	//SetAppTilte(this, APP_RE_ID_STRING_Guestbook);

	//显示不同的title
	if(m_FormMode == FORM_MODE_NORMAL)
	{
		SetAppTilte(this, APP_RE_ID_STRING_Guestbook);
		m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);
	}
	else if(m_FormMode == FORM_MODE_MYHOME)
	{
		tResponseProfile* ResponseProfile;
		RenRenAPI_JsonParse(RR_ProfileGetInfo, (void **)&ResponseProfile);	
		if(ResponseProfile)
		{
			if(ResponseProfile->uid == RenRenUserInfo.uid)
			{
				SetAppTilte(this, APP_RE_ID_STRING_MyNews);
				m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Home,TITLE_BUTTON_RIGHT);
			}
			else
			{
				TUChar  pszFName[64] = {0};
				TUString::StrUtf8ToStrUnicode(pszFName , (const Char *)ResponseProfile->name);			
				SetAppTilte(this, 0, pszFName);
				m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);
			}

			delete ResponseProfile;
			ResponseProfile = NULL;	
		}
	}
	
	//设置panel高度
	TPanel* pTPanel = static_cast<TPanel*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonPanel));	
	TCoolBarList* pCoolBarList = static_cast<TCoolBarList*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonCoolBarList));

	if( (pTPanel == NULL) || (pCoolBarList == NULL) )
		return FALSE;
	
	//调整Panel高度
	{
		TRectangle rect;
		Int32 Height_Panel = 0;		//Panel高度		
		
		Height_Panel = SCR_H - STATUSBAR_H - TITLEBAR_H;
		if(m_FormMode == FORM_MODE_MYHOME)
			Height_Panel -= BOTTOM_TAB_H;
			
		pTPanel->GetBounds(&rect);
		rect.SetHeight(Height_Panel);
		pTPanel->SetBounds(&rect);
	}

	if(m_FormMode == FORM_MODE_MYHOME)
		CreateProfileBottomTab(this, &BottomTabCtrID, 4);
	
	//:TODO:

	//显示个人信息
	if(m_FormMode == FORM_MODE_MYHOME)
	{
		Int32 Height_Top = 0;			//CoolBarList上面信息的高度
		tResponseProfile* ResponseProfile;
		RenRenAPI_JsonParse(RR_ProfileGetInfo, (void **)&ResponseProfile);
		if(ResponseProfile != NULL)
		{
			//头像
			TBitmap* pDownLoadBitmap = NULL;
			pDownLoadBitmap = LoadImgByUrl(ResponseProfile->headurl);			
			//pProfileImage = LoadImgByUrl(ResponseProfile->headurl);
			const TBitmap * pImageDeault = TResource::LoadConstBitmap(APP_RE_ID_BITMAP_DefaultLarge);
			const TBitmap * pBackImage = TResource::LoadConstBitmap(APP_RE_ID_BITMAP_headmask_large);
			if(pDownLoadBitmap == NULL)
			{
				//RenRenAPICommon_DownloadPhoto(ResponseProfile->headurl, this->GetWindowHwndId(), FEED_PROFILE_IMAGE_INDEX);	
				m_ProfileImageID = CtrlAddItemToPanel_MaskButton(this, pTPanel, RR_HEAD_X, RR_HEAD_Y, RR_HEAD_W, RR_HEAD_H, (TBitmap*)pImageDeault, (TBitmap*)pImageDeault, (TBitmap*)pBackImage );	
				this->DisableControl(m_ProfileImageID);
			}
			else
			{
				//需要做放大
				pProfileImage = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
				pProfileImage->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));				
				m_ProfileImageID = CtrlAddItemToPanel_MaskButton(this, pTPanel, RR_HEAD_X, RR_HEAD_Y, RR_HEAD_W, RR_HEAD_H, (TBitmap*)pProfileImage, (TBitmap*)pProfileImage, (TBitmap*)pBackImage );	
				this->DisableControl(m_ProfileImageID);
				
				//释放图片
				pDownLoadBitmap->Destroy();
				pDownLoadBitmap = NULL; 						
			}
			//下载大头像
			tResponseUsersGetInfo* ResponseUserInfoPhoto = NULL;
			RenRenAPI_JsonParse(RR_UsersGetInfoPhoto, (void **)&ResponseUserInfoPhoto);
			if(ResponseUserInfoPhoto)
			{
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:RenRen,代码行数:101,代码来源:RenRenForm_GuestbookGet.cpp

示例5: EventHandler


//.........这里部分代码省略.........
			break;
			
			//下载完成事件
		case MSG_DL_THREAD_NOTIFY:
			{
				NotifyMsgDataType notifyData;
				Sys_GetMessageBody((MESSAGE_t *)pEvent, &notifyData, sizeof(NotifyMsgDataType));				
				bHandled = TRUE;
				switch(notifyData.nAccessType)
				{
					case RR_PhotoDownload:
					{

						if(notifyData.nParam == FEED_PROFILE_IMAGE_INDEX)
						{	
							//下载完后更新对应的图片
							TBitmap* pDownLoadBitmap = NULL;
							pDownLoadBitmap = LoadImgByPath(notifyData.pszFilePath);

							if(pDownLoadBitmap)
							{
								TMaskButton* pLogo = NULL;
								pLogo = static_cast<TMaskButton*>(GetControlPtr(m_ProfileImageID));
								if(pLogo)
								{
									TRectangle rc;							
									pLogo->GetBounds(&rc);
									if( pProfileImage != NULL)
									{
										pProfileImage->Destroy();
										pProfileImage = NULL; 							
									}
										
									pProfileImage = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
									pProfileImage->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));
									pLogo->SetCaption(TUSTR_Re_NULL,0,0);
									pLogo->SetImage(pProfileImage, (rc.Width()-pProfileImage->GetWidth())/2, (rc.Height()-pProfileImage->GetHeight())/2);										pLogo->Draw();
								}				

								//释放图片
								pDownLoadBitmap->Destroy();
								pDownLoadBitmap = NULL; 						
							}	
							break;
						}

						
						if( gItemData[notifyData.nParam].pBmp != NULL)
						{
							gItemData[notifyData.nParam].pBmp->Destroy();
							gItemData[notifyData.nParam].pBmp = NULL;									
						}

						if( gItemData[notifyData.nParam].pBmpZoom!= NULL)
						{
							gItemData[notifyData.nParam].pBmpZoom->Destroy();
							gItemData[notifyData.nParam].pBmpZoom = NULL;									
						}
						
						gItemData[notifyData.nParam].pBmp= LoadImgByPath(notifyData.pszFilePath);
						if(gItemData[notifyData.nParam].pBmp != NULL)
						{
							TMaskButton* pMyHeadMBtn = static_cast<TMaskButton*>(GetControlPtr(gItemData[notifyData.nParam].HeadMaskButtonID));
							if(pMyHeadMBtn != NULL)
							{
								gItemData[notifyData.nParam].pBmpZoom = gItemData[notifyData.nParam].pBmp->Create(HEADPHOTO_W, HEADPHOTO_H, 32);
开发者ID:pengjohn,项目名称:RenRen,代码行数:67,代码来源:RenRenForm_GuestbookGet.cpp

示例6: initWithString

bool CCImage::initWithString(
                               const char *    pText, 
                               int             nWidth/* = 0*/, 
                               int             nHeight/* = 0*/,
                               ETextAlign      eAlignMask/* = kAlignCenter*/,
                               const char *    pFontName/* = nil*/,
                               int             nSize/* = 0*/)
{
    bool bRet = false;
    TUChar* pWText = NULL;
    do 
    {
        CC_BREAK_IF(! pText);
        int nLen = strlen(pText) + 1;
        CC_BREAK_IF(! (pWText = new TUChar[nLen]));
        TUString::StrGBToUnicode(pWText, (Char*)pText);

        BitmapDC& dc = sharedBitmapDC();

        dc.setFont(pFontName, nSize);

        TSize size(nWidth, nHeight);
        dc.getTextExtentPoint(pWText, nLen, size);
        CC_BREAK_IF(! size.Width() || ! size.Height());

        // set style
        UInt32 styles = GUI_API_STYLE_SPECIFY_FORE_COLOR |  GUI_API_STYLE_ROP_MODE_TRANSPARENT |
            GUI_API_STYLE_CLIP_WORDWRAP | GUI_API_STYLE_SPECIFY_BACK_COLOR | GUI_API_STYLE_SPECIFY_FONT;

        switch (eAlignMask)
        {
        case kAlignCenter:
            styles |= GUI_API_STYLE_ALIGNMENT_CENTER | GUI_API_STYLE_ALIGNMENT_MIDDLE;
            break;
        case kAlignTop:
            styles |= GUI_API_STYLE_ALIGNMENT_CENTER | GUI_API_STYLE_ALIGNMENT_TOP;
            break;
        case kAlignTopRight:
            styles |= GUI_API_STYLE_ALIGNMENT_RIGHT | GUI_API_STYLE_ALIGNMENT_TOP;
            break;
        case kAlignRight:
            styles |= GUI_API_STYLE_ALIGNMENT_RIGHT | GUI_API_STYLE_ALIGNMENT_MIDDLE;
            break;
        case kAlignBottomRight:
            styles |= GUI_API_STYLE_ALIGNMENT_RIGHT | GUI_API_STYLE_ALIGNMENT_BOTTOM;
            break;
        case kAlignBottom:
            styles |= GUI_API_STYLE_ALIGNMENT_CENTER | GUI_API_STYLE_ALIGNMENT_BOTTOM;
            break;
        case kAlignBottomLeft:
            styles |= GUI_API_STYLE_ALIGNMENT_LEFT | GUI_API_STYLE_ALIGNMENT_BOTTOM;
            break;
        case kAlignLeft:
            styles |= GUI_API_STYLE_ALIGNMENT_LEFT | GUI_API_STYLE_ALIGNMENT_MIDDLE;
            break;
        case kAlignTopLeft:
            styles |= GUI_API_STYLE_ALIGNMENT_LEFT | GUI_API_STYLE_ALIGNMENT_TOP;
        }

        CC_BREAK_IF(! dc.drawText(pWText, nLen, size, styles));

        // init image information
        TBitmap * pBitmap = dc.getBitmap();
        CC_BREAK_IF(! pBitmap);

        INT32 nWidth	= pBitmap->GetWidth();
        INT32 nHeight	= pBitmap->GetHeight();
        CC_BREAK_IF(nWidth <= 0 || nHeight <= 0);

        INT32 nDataLen = pBitmap->GetRowBytes() * nHeight;
        m_pData.reset(new ccxByte[nDataLen]);
        CC_BREAK_IF(! m_pData.get());
        memcpy((void*) m_pData.get(), pBitmap->GetDataPtr(), nDataLen);

        m_nWidth    = (ccxInt16)nWidth;
        m_nHeight   = (ccxInt16)nHeight;
        m_bHasAlpha = true;
        m_bPreMulti = true;
        m_nBitsPerComponent = pBitmap->GetDepth() / 4;

        bRet = true;
    } while (0);

    if (pWText)
    {
        delete [] pWText;
        pWText = NULL;
    }

    return bRet;
}
开发者ID:,项目名称:,代码行数:91,代码来源:

示例7: EventHandler

// 窗口事件处理
Boolean TUserInfoDetailForm::EventHandler(TApplication * pApp, EventType * pEvent)
{
	Boolean bHandled = FALSE;

	switch (pEvent->eType)
	{
	case EVENT_WinInit:
		{
			_OnWinInitEvent(pApp, pEvent);
			bHandled = TRUE;
			break;
		}

	case EVENT_WinClose:
		{
			_OnWinClose(pApp, pEvent);
			break;
		}
	case EVENT_WinEraseClient:
		{
			TDC 	   dc(this);
			WinEraseClientEventType *pEraseEvent = reinterpret_cast< WinEraseClientEventType* >( pEvent );
			TRectangle rc(pEraseEvent->rc);
			TRectangle rcBack(5, 142, 310, 314);
			GetBounds(&rcBack);

			// 擦除
			dc.EraseRectangle(&rc, 0);

			dc.DrawBitmapsH(TResource::LoadConstBitmap(APP_KA_ID_BITMAP_title_bg), 0, 0, SCR_W, GUI_API_STYLE_ALIGNMENT_LEFT);

			//dc.DrawBitmapsH(TResource::LoadConstBitmap(APP_KA_ID_BITMAP_bottom_bg), 0, rcBack.Bottom()-44, 
			//320, GUI_API_STYLE_ALIGNMENT_LEFT|GUI_API_STYLE_ALIGNMENT_TOP); 


			pEraseEvent->result = 1;				
			bHandled = TRUE;
		}
		break;
	case EVENT_CtrlSelect:
		{
			bHandled = _OnCtrlSelectEvent(pApp, pEvent);
			break;
		}
		//下载完成消息
	case MSG_DL_THREAD_NOTIFY:
		{
			NotifyMsgDataType notifyData;
			Sys_GetMessageBody((MESSAGE_t *)pEvent, &notifyData, sizeof(NotifyMsgDataType));

			switch(notifyData.nAccessType)
			{
			case KX_PhotoDownload:
				{
					if(pPhotoBmp != NULL)
					{
						pPhotoBmp->Destroy();
						pPhotoBmp = NULL;
					}

					TBitmap* pDownLoadBitmap = NULL;
					pDownLoadBitmap = LoadImgByPath(notifyData.pszFilePath);

					TMaskButton* pHeadMBtn = static_cast<TMaskButton*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_UserDetailHeadMaskButton));
					if(pDownLoadBitmap)
					{
						TRectangle rc;		
						pHeadMBtn->GetBounds(&rc);

						pPhotoBmp = TBitmap::Create(PHOTO_W, PHOTO_H, pDownLoadBitmap->GetDepth());
						pPhotoBmp->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));	
			
						pHeadMBtn->SetImage(pPhotoBmp,(rc.Width()-pPhotoBmp->GetWidth())/2, (rc.Height()-pPhotoBmp->GetHeight())/2);		
						pHeadMBtn->Draw();

						//释放图片
						pDownLoadBitmap->Destroy();
						pDownLoadBitmap = NULL;						
					}

					break;
				}
			default:
				break;
			}
			bHandled = TRUE;
			break;			
		}
	case EVENT_KeyCommand: 
		{ 
			// 抓取右软键事件 
			if (pEvent->sParam1 == SYS_KEY_SOFTKEY_RIGHT_UP  
				|| pEvent->sParam1 == SYS_KEY_SOFTKEY_RIGHT_LONG) 
			{ 
				// 模拟退出按钮选中消息 
				HitControl(m_BackBtn); 
				bHandled = TRUE; 
			} 
		} 
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:kaixin,代码行数:101,代码来源:KaiXinAPI_UserInfoDetail.cpp

示例8: _SetDataToCtrls

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);
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:kaixin,代码行数:101,代码来源:KaiXinAPI_UserInfoDetail.cpp


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