本文整理汇总了C++中Label::SetTextColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::SetTextColor方法的具体用法?C++ Label::SetTextColor怎么用?C++ Label::SetTextColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::SetTextColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitializing
result VideoviewForm::OnInitializing(void) {
result r = E_SUCCESS;
// Sets an overlay region area
int widthVideo = 720;
int HeightVideo = 480;
Rectangle overlayRectangle(0, 100, widthVideo, HeightVideo);
// Evaluates bounds of overlay region
bool modified = false;
OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, overlayRectangle, modified);
// Gets an overlay region
pOverlayRegion = GetOverlayRegionN(overlayRectangle, OVERLAY_REGION_TYPE_NORMAL);
// Gets buffer information
BufferInfo bufferInfo;
pOverlayRegion->GetBackgroundBufferInfo(bufferInfo);
// Gets a video file path
String videoFilePath = App::GetInstance()->GetAppResourcePath() + L"tizen.mp4";
Uri playUri;
Label* pLabel = new Label();
// Button* pButton = new Button();
// Creates an instance of Player
pPlayer = new Player();
r = pPlayer->Construct(*this, &bufferInfo);
TryCatch(r == E_SUCCESS, , "Failed pPlayer->Construct");
pPlayer->SetLooping(true);
/*
playUri.SetUri(L"http://cs518400v4.vk.me/u16423084/videos/442a33813f.720.mp4");
TryCatch(r == E_SUCCESS, , "Failed pPlayer->Play()");
AppLog("Opening URI");
r = pPlayer->OpenUrl(playUri);
TryCatch(r == E_SUCCESS, , "Failed pPlayer->Play()");
r = pPlayer->Play();
TryCatch(r == E_SUCCESS, , "Failed pPlayer->Play()");
AppLog("Playing...");
*/
// Creates instaces of Button and Label and adds controls to the panel
pLabel->Construct(Rectangle(0, 50, 400, 80),L"OverlayRegion Sample");
pLabel->SetTextColor(Color::GetColor(COLOR_ID_RED));
AddControl(pLabel);
// pButton->Construct(Rectangle(positionX + widthVideo - 200, positionX + HeightVideo - 100, 180, 80),L"BUTTON");
// AddControl(pButton);
return r;
CATCH:
AppLogException("CreateItem is failed. %s", GetErrorMessage(r));
return r;
}
示例2: GetHeader
result
EditEventForm::OnInitializing(void)
{
result r = E_SUCCESS;
Header* pHeader = GetHeader();
AppAssert(pHeader);
pHeader->SetStyle(HEADER_STYLE_TITLE);
pHeader->SetTitleText(L"Edit event");
Footer* pFooter = GetFooter();
AppAssert(pFooter);
pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
FooterItem footerSave;
footerSave.Construct(ID_FOOTER_SAVE);
footerSave.SetText(L"Save");
pFooter->AddItem(footerSave);
pFooter->AddActionEventListener(*this);
SetFormBackEventListener(this);
static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5;
static const unsigned int COLOR_TITLE_LABEL = 0xFF808080;
static const unsigned int COLOR_TIMEZONE_DATA = 0xFF444444;
static const int UI_X_POSITION_GAP = 20;
static const int UI_WIDTH = GetClientAreaBounds().width - 40;
static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4;
static const int UI_HEIGHT = 112;
static const int BUTTON_HEIGHT = 74;
static const int UI_SPACE = 32;
static const int FONT_SIZE = 36;
int yPosition = 0;
ScrollPanel* pScrollPanel = new (std::nothrow) ScrollPanel();
pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
// Subject
__pSubjectEditField = new (std::nothrow) EditField();
__pSubjectEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP);
__pSubjectEditField->SetTitleText(L"Subject");
__pSubjectEditField->SetGuideText(L"Enter the subject");
pScrollPanel->AddControl(__pSubjectEditField);
int minYear = Calendarbook::GetMinDateTime().GetYear() + 1;
int maxYear = Calendarbook::GetMaxDateTime().GetYear() - 1;
// Start Date
Label* pStartDateLabel = new (std::nothrow) Label();
pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Start");
pStartDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL);
pStartDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
pScrollPanel->AddControl(pStartDateLabel);
__pStartEditDate = new (std::nothrow) EditDate();
__pStartEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10));
__pStartEditDate->SetCurrentDate();
__pStartEditDate->SetYearRange(minYear, maxYear);
__pStartEditDate->AddDateChangeEventListener(*this);
pScrollPanel->AddControl(__pStartEditDate);
__pStartEditTime = new (std::nothrow) EditTime();
__pStartEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10));
__pStartEditTime->SetCurrentTime();
__pStartEditTime->AddTimeChangeEventListener(*this);
pScrollPanel->AddControl(__pStartEditTime);
// End Date
Label* pEndDateLabel = new (std::nothrow) Label();
pEndDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"End");
pEndDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
pEndDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pEndDateLabel->SetTextColor(COLOR_TITLE_LABEL);
pEndDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
pScrollPanel->AddControl(pEndDateLabel);
__pEndEditDate = new (std::nothrow) EditDate();
__pEndEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10));
__pEndEditDate->SetCurrentDate();
__pEndEditDate->SetYearRange(minYear, maxYear);
__pEndEditDate->AddDateChangeEventListener(*this);
pScrollPanel->AddControl(__pEndEditDate);
DateTime endTime;
endTime = __pStartEditTime->GetTime();
endTime.AddHours(1);
__pEndEditTime = new (std::nothrow) EditTime();
__pEndEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10));
__pEndEditTime->SetTime(endTime);
__pEndEditTime->AddTimeChangeEventListener(*this);
pScrollPanel->AddControl(__pEndEditTime);
// TimeZone
Label* pTimeZoneLabel = new (std::nothrow) Label();
//.........这里部分代码省略.........
示例3: GetHeader
result
ProfileDetailForm::OnInitializing(void)
{
result r = E_SUCCESS;
Header* pHeader = GetHeader();
AppAssert(pHeader);
pHeader->SetStyle(HEADER_STYLE_TITLE);
String getDetails;
Application::GetInstance()->GetAppResource()->GetString(IDS_DETAILS, getDetails);
pHeader->SetTitleText(getDetails);
Footer* pFooter = GetFooter();
AppAssert(pFooter);
pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
String getEdit;
Application::GetInstance()->GetAppResource()->GetString(IDS_EDIT, getEdit);
FooterItem footerEdit;
footerEdit.Construct(ID_FOOTER_EDIT);
footerEdit.SetText(getEdit);
pFooter->AddItem(footerEdit);
String getDelete;
Application::GetInstance()->GetAppResource()->GetString(IDS_DELETE, getDelete);
FooterItem footerDelete;
footerDelete.Construct(ID_FOOTER_DELETE);
footerDelete.SetText(getDelete);
pFooter->AddItem(footerDelete);
pFooter->AddActionEventListener(*this);
SetFormBackEventListener(this);
static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5;
static const unsigned int COLOR_TITLE_LABEL = 0xFF808080;
static const int UI_X_POSITION_GAP = 20;
static const int UI_WIDTH = GetClientAreaBounds().width - 40;
static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4 + UI_X_POSITION_GAP;
static const int UI_HEIGHT = 112;
static const int UI_SPACE = 26;
int yPosition = 0;
ScrollPanel* pScrollPanel = new (std::nothrow) ScrollPanel();
pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
String date;
DateTime displayStartDate;
DateTime displayDueDate;
// Subject
Label* pSubjectLabel = new (std::nothrow) Label();
String getProfileName;
Application::GetInstance()->GetAppResource()->GetString(IDS_PROFILE_NAME, getProfileName);
pSubjectLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), getProfileName);
pSubjectLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pSubjectLabel->SetTextColor(COLOR_TITLE_LABEL);
pSubjectLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
pScrollPanel->AddControl(pSubjectLabel);
__pSubjectLabelData = new (std::nothrow) Label();
__pSubjectLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
__pSubjectLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pScrollPanel->AddControl(__pSubjectLabelData);
// Start Date
Label* pStartDateLabel = new (std::nothrow) Label();
String getStartDatetime;
Application::GetInstance()->GetAppResource()->GetString(IDS_START_DATETIME, getStartDatetime);
pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getStartDatetime);
pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL);
pStartDateLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
pScrollPanel->AddControl(pStartDateLabel);
__pStartDateLabelData = new (std::nothrow) Label();
__pStartDateLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
__pStartDateLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pScrollPanel->AddControl(__pStartDateLabelData);
// Due Date
Label* pDueDateLabel = new (std::nothrow) Label();
String getEndDatetime;
Application::GetInstance()->GetAppResource()->GetString(IDS_END_DATETIME, getEndDatetime);
pDueDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), getEndDatetime);
pDueDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pDueDateLabel->SetTextColor(COLOR_TITLE_LABEL);
pDueDateLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
pScrollPanel->AddControl(pDueDateLabel);
__pDueDateLabelData = new (std::nothrow) Label();
__pDueDateLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
__pDueDateLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pScrollPanel->AddControl(__pDueDateLabelData);
// Location
Label* pLocationLabel = new (std::nothrow) Label();
String getLocation;
//.........这里部分代码省略.........
示例4: GetHeader
result
CreateProfileForm::OnInitializing(void)
{
result r = E_SUCCESS;
Header* pHeader = GetHeader();
AppAssert(pHeader);
pHeader->SetStyle(HEADER_STYLE_TITLE);
String getProfileCreationTitle;
Application::GetInstance()->GetAppResource()->GetString(IDS_CREATE_TITLE, getProfileCreationTitle);
pHeader->SetTitleText(getProfileCreationTitle);
Footer* pFooter = GetFooter();
AppAssert(pFooter);
pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
FooterItem footerSave;
footerSave.Construct(ID_BUTTON_SAVE);
String getSave;
Application::GetInstance()->GetAppResource()->GetString(IDS_SAVE, getSave);
footerSave.SetText(getSave);
pFooter->AddItem(footerSave);
pFooter->AddActionEventListener(*this);
SetFormBackEventListener(this);
static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5;
static const unsigned int COLOR_TITLE_LABEL = 0xFF808080;
static const int UI_X_POSITION_GAP = 20;
static const int UI_WIDTH = GetClientAreaBounds().width - 40;
static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4;
static const int UI_HEIGHT = 112;
static const int UI_SPACE = 26;
int yPosition = 0;
__pScrollPanel = new (std::nothrow) ScrollPanel();
__pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
// Subject
__pSubjectEditField = new (std::nothrow) EditField();
__pSubjectEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP);
String getProfileName, getProfileNameGuid;
Application::GetInstance()->GetAppResource()->GetString(IDS_PROFILE_NAME, getProfileName);
Application::GetInstance()->GetAppResource()->GetString(IDS_PROFILE_GUIDE, getProfileNameGuid);
__pSubjectEditField->SetGuideText(getProfileNameGuid);
__pSubjectEditField->SetName(L"Subject");
__pSubjectEditField->SetTitleText(getProfileName);
__pSubjectEditField->SetOverlayKeypadCommandButtonVisible(false);
__pScrollPanel->AddControl(__pSubjectEditField);
// Start Date
int minYear = Calendarbook::GetMinDateTime().GetYear() + 1;
int maxYear = Calendarbook::GetMaxDateTime().GetYear() - 1;
Label* pStartDateLabel = new (std::nothrow) Label();
String getStartDateTime, getEndDateTime;
Application::GetInstance()->GetAppResource()->GetString(IDS_START_DATETIME, getStartDateTime);
Application::GetInstance()->GetAppResource()->GetString(IDS_END_DATETIME, getEndDateTime);
pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getStartDateTime);
pStartDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL);
pStartDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
__pScrollPanel->AddControl(pStartDateLabel);
__pStartEditDate = new (std::nothrow) EditDate();
__pStartEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10));
__pStartEditDate->SetCurrentDate();
__pStartEditDate->SetYearRange(minYear, maxYear);
__pStartEditDate->AddDateChangeEventListener(*this);
__pScrollPanel->AddControl(__pStartEditDate);
__pStartEditTime = new (std::nothrow) EditTime();
__pStartEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10));
__pStartEditTime->SetCurrentTime();
__pStartEditTime->AddTimeChangeEventListener(*this);
__pScrollPanel->AddControl(__pStartEditTime);
// Due Date
Label* pDueDateLabel = new (std::nothrow) Label();
pDueDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), getEndDateTime);
pDueDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
pDueDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pDueDateLabel->SetTextColor(COLOR_TITLE_LABEL);
pDueDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
__pScrollPanel->AddControl(pDueDateLabel);
__pDueEditDate = new (std::nothrow) EditDate();
__pDueEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10));
__pDueEditDate->SetCurrentDate();
__pDueEditDate->SetYearRange(minYear, maxYear);
__pDueEditDate->AddDateChangeEventListener(*this);
__pScrollPanel->AddControl(__pDueEditDate);
DateTime endTime;
endTime = __pStartEditTime->GetTime();
endTime.AddHours(1);
__pDueEditTime = new (std::nothrow) EditTime();
//.........这里部分代码省略.........
示例5: CreateItem
TableViewItem* VKUMessagesListItemProvider::CreateItem(int index, int itemWidth) {
result r;
AppLog("VKUMessagesListItemProvider::CreateItem");
RoundedAvatar *pAvatar; // NOTE: used only if chat and message is out==0
MessageBubble* pMessageBubble;
RelativeLayout itemLayout;
Color bgColor;
JsonObject *itemObject;
IJsonValue *itemValue;
TableViewItem* pItem;
JsonNumber outNumber;
ArrayList *pMessageElements;
Label *pTimeStamp;
String timespampText;
int timestampValue;
String messageText(L"no text????");
int out = 0, readState = 0;
// reverse list
int reversedIndex = _messagesJson->GetCount() - 1 - index;
AppLog("Item %d of %d", reversedIndex, GetItemCount());
// get message string
r = _messagesJson->GetAt(reversedIndex, itemValue);
TryCatch(r == E_SUCCESS, , "Failed GetAt");
itemObject = static_cast<JsonObject *>(itemValue);
JsonParseUtils::GetInteger(*itemObject, L"out", out);
JsonParseUtils::GetInteger(*itemObject, L"date", timestampValue);
JsonParseUtils::GetInteger(*itemObject, L"read_state", readState);
TimeUtils::GetDialogsTime(timestampValue, timespampText);
// create rich text panel
AppLog("Message is %d == out", out);
pMessageBubble = new MessageBubble();
r = pMessageBubble->Construct(Dimension(itemWidth, LIST_HEIGHT));
TryCatch(r == E_SUCCESS, , "Failed Construct RichTextPanel");
pMessageBubble->SetOut(out);
AppLog("RTPanel created and constructed");
itemLayout.Construct();
// get available elements
pMessageElements = GetMessageElementsN(itemObject, itemWidth);
// message text element
for (int i=0; i<pMessageElements->GetCount(); i++) {
AppLog("Adding element %d to pItem", i);
MessageElement *pElement = static_cast<MessageElement *>(pMessageElements->GetAt(i));
pMessageBubble->AddElement(pElement);
AppLog("Added element %d to pItem with size of %dx%d", i, pElement->GetWidth(), pElement->GetHeight());
}
// timestamp label
pTimeStamp = new Label();
pTimeStamp->Construct(Rectangle(0, 0, 100, 28), timespampText);
pTimeStamp->SetTextConfig(28, LABEL_TEXT_STYLE_NORMAL);
pTimeStamp->SetTextColor(Color(TIMESTAMP_TEXT_COLOR, false));
// create table item
pItem = new TableViewItem();
r = pItem->Construct(itemLayout, Dimension(itemWidth, pMessageBubble->GetHeight() + 2*BUBBLE_VERTICAL_MARGIN));
TryCatch(r == E_SUCCESS, , "Failed GetAt");
if (out == 0 && _peerId > 2000000000) {
int fromId;
JsonParseUtils::GetInteger(*itemObject, L"from_id", fromId);
AppLog("Finding avatar for %d", fromId);
pAvatar = new RoundedAvatar(AVATAR_NORMAL);
String * avatarUrl = static_cast<String *>(_pUserIdAvatarMap->GetValue(Integer(fromId)));
pAvatar->Construct(Rectangle(0, 0, 80, 80), *avatarUrl);
r = pItem->AddControl(pAvatar);
itemLayout.SetRelation(*pAvatar, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
itemLayout.SetRelation(*pAvatar, pItem, RECT_EDGE_RELATION_TOP_TO_TOP);
itemLayout.SetMargin(*pAvatar, 10, 0, 10, 0);
}
// add rich text panel to table item
r = pItem->AddControl(pMessageBubble);
TryCatch(r == E_SUCCESS, , "Failed AddControl");
r = pItem->AddControl(pTimeStamp);
itemLayout.SetCenterAligned(*pMessageBubble, CENTER_ALIGN_VERTICAL);
itemLayout.SetHorizontalFitPolicy(*pTimeStamp, FIT_POLICY_CONTENT);
if (out == 1) {
itemLayout.SetRelation(*pMessageBubble, *pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
itemLayout.SetMargin(*pMessageBubble, 0, 10, 0, 0);
itemLayout.SetRelation(*pTimeStamp, *pMessageBubble, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
itemLayout.SetRelation(*pTimeStamp, *pItem, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
itemLayout.SetMargin(*pTimeStamp, 0, 10, 0, 30);
//.........这里部分代码省略.........