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


C++ TImage::SetBitmap方法代码示例

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


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

示例1: CtrlAddItemToCoolBarList_Image

//添加Image控件到CoolBarList, 
// pszString必须是动态的(非Static)
// nWidth 为0 -- 自动长度
Int32 CtrlAddItemToCoolBarList_Image(TWindow*pWin,  TBarListItem* pListItem, Coord nX, Coord nY, Coord nWidth, Int32 nHeight, TBitmap * pBmp)
{
	TRectangle obBtnRec(0,0,0,0);
	Int32 nImageId = pListItem->AddCtrl(CTL_CLASS_IMAGE, 0, 0);
	TImage* pImage = static_cast<TImage*>(pWin->GetControlPtr(nImageId));

	obBtnRec.SetRect(nX, nY, nWidth, nHeight);
	pImage->SetBounds(&obBtnRec);
	pImage->SetBitmap(pBmp);
	pImage->SetEnabled(TRUE);
	return nImageId;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:15,代码来源:gui_common.cpp

示例2: CtrlAddItemToPanel_Image

Int32 CtrlAddItemToPanel_Image(TWindow*pWin, TPanel* pPanel, Coord nX, Coord nY, Coord nWidth, Coord nHeight, TBitmap * pBmp)
{
	TImage* pImage = new TImage();
	Int32 nImageId = 0;
	
	if(pImage->Create(pPanel))
	{
		TRectangle obBtnRec(0,0,0,0);

		nImageId=pImage->GetId();
		obBtnRec.SetRect(nX, nY, nWidth, nHeight);
		pImage->SetBounds(&obBtnRec);
		pImage->SetBitmap(pBmp);
		pImage->SetEnabled(TRUE);
	}
	
	return nImageId;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:18,代码来源:gui_common.cpp

示例3: EventHandler


//.........这里部分代码省略.........
									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();
						}

						//释放图片
						pDownLoadBitmap->Destroy();
						pDownLoadBitmap = NULL; 							
					}
				}					
				break;
				
				case RR_PhotosUpload:
				{
					if(pApp->MessageBox(TResource::LoadConstString(APP_RE_ID_STRING_PhotoUploadContinue),TResource::LoadConstString(APP_RE_ID_STRING_PhotoUploadSuccess),WMB_YESNO) ==0 )
					{
						HitControl(m_TitleBtnLeft); 
					}
					else
					{
						RenRenAPICommon_Download(RR_PhotosGetAlbums, this->GetWindowHwndId(), 0, m_FormMode); 
					}
					break;
				}

				case RR_UsersGetInfoPhoto:
					{
					tResponseUsersGetInfo* Response = NULL;
					RenRenAPI_JsonParse(RR_UsersGetInfoPhoto, (void **)&Response);
					if(Response)
						{
						_UpdateProfilePhoto(pApp, Response);
						delete Response;
						Response = NULL;
开发者ID:pengjohn,项目名称:RenRen,代码行数:67,代码来源:RenRenForm_PhotosGetAlbums.cpp

示例4: EventHandler

// 窗口事件处理
Boolean TCommentDetailForm::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);
			this->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()-68, 
			//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_POST_THREAD_NOTIFY:
		{
			PostNotifyMsgDataType notifyData;
			Sys_GetMessageBody((MESSAGE_t *)pEvent, &notifyData, sizeof(PostNotifyMsgDataType));

			switch(notifyData.nEditType)
			{
			case ReplyUserCommentEdit:
			case ReplyCommentEdit:
				{		
					Set_Url_Params(KX_ReplyComment, "replycont", (char*)notifyData.PostMsgData.commentdata.pszCommentContent);
					Set_Url_Params(KX_ReplyComment, "fuid", (char*)notifyData.PostMsgData.commentdata.nOuid);	
					Set_Url_Params(KX_ReplyComment, "thread_cid", (char*)notifyData.PostMsgData.commentdata.nId);					

					KaiXinAPICommon_Download(KX_ReplyComment, this->GetWindowHwndId());
					break;
				}			

			default:
				break;

			}

			bHandled = TRUE;
		}
		break;	
		//下载完成消息在给各自form中处理模板
	case MSG_DL_THREAD_NOTIFY:
		{
			NotifyMsgDataType notifyData;
			Sys_GetMessageBody((MESSAGE_t *)pEvent, &notifyData, sizeof(NotifyMsgDataType));						

			bHandled = TRUE;
			switch(notifyData.nAccessType)
			{
			case KX_PhotoDownload:
				{
					if( pBmp[notifyData.nParam] != NULL)
					{
						pBmp[notifyData.nParam]->Destroy();
						pBmp[notifyData.nParam] = NULL; 								
					}
					pBmp[notifyData.nParam] = LoadImgByPath(notifyData.pszFilePath);

					if(pBmp[notifyData.nParam])
					{
						TImage* pTImage;

						pTImage = static_cast< TImage* >(this->GetControlPtr(m_iaTImageID[notifyData.nParam]));
						if(pTImage)
						{
							pTImage->SetBitmap(pBmp[notifyData.nParam]);
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:kaixin,代码行数:101,代码来源:KaiXinAPI_CommentDetail.cpp

示例5: _OnWinInitEvent

// 窗口初始化
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);

//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:RenRen,代码行数:101,代码来源:RenRenForm_FeedGetFangle.cpp


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