Example #1
0
void CheckBox::PaintBox(Canvas& canvas, const Rect& box_rect) const {

	//Paint the box.
    canvas.SetBrushWithColor(GetBoxBackgroundColor());
    canvas.DrawRectangle(box_rect);

	canvas.SetBrushWithColor(GetBoxBorderColor());
	canvas.DrawRectangleFrame(box_rect, 1);

	//Paint the check state mark.
	auto check_state = GetCheckState();

	if (check_state == CheckState::Indeterminate) {
		Rect mark_rect = box_rect;
		mark_rect.Inflate(-3);
		canvas.DrawRectangle(mark_rect);
	}
	else if (check_state == CheckState::Checked) {

		auto path = GetResourceFactory()->CreatePathGeometry();
		if (path == nullptr) {
			return;
		}

		auto sink = path->Open();
		if (sink == nullptr) {
			return;
		}

		Rect mark_rect = box_rect;
		mark_rect.Inflate(-2);

		Point start_point(mark_rect.position.x + mark_rect.size.width, mark_rect.position.y);
		Point middle_point(mark_rect.position.x + mark_rect.size.width * 0.4f, mark_rect.position.y + mark_rect.size.height - 1);
		Point end_point(mark_rect.position.x, mark_rect.position.y + mark_rect.size.height * 0.4f);

		sink->BeginFigure(start_point, GeometrySink::BeginFigureOption::Hollow);
		sink->AddLine(middle_point);
		sink->AddLine(end_point);
		sink->EndFigure(GeometrySink::EndFigureOption::Open);
		sink->Close();

		canvas.DrawGeometryFrame(path, 1.5);
	}
}
Example #2
0
result
CropForm::OnDraw(void)
{
	Canvas *pCanvas = null;
	pCanvas = GetCanvasN();
	if(!pCanvas)
		return GetLastResult();

	if (__pBitmapOriginal)
	{
		pCanvas->Clear();
		pCanvas->DrawBitmap(GetClientAreaBounds(), *__pBitmapOriginal);

		pCanvas->SetForegroundColor(Color::GetColor(COLOR_ID_BLACK));
		pCanvas->SetLineWidth(5);
		pCanvas->SetLineStyle(LINE_STYLE_SOLID);
		if(__Croprectangle.width > 0)
			pCanvas->DrawRectangle(__Croprectangle);
	}

	delete pCanvas;
	return E_SUCCESS;
}
Example #3
0
result
EditPanel::OnDraw()
{
	int i;
	Rectangle *tmp_rect;
	Rectangle *tmp_rect2;
	String	  *tmp_string;
	Boolean	  *tmp_highlight;
	Integer	  *tmp_int;
	String	  *tmp_insert_str;
	Integer   *tmp_check;
	Point	*tmp_point;
	Font font;
	String	  *tmp_string2;


    font.Construct(FONT_STYLE_PLAIN, 30);

	AppResource* pAppResource = Application::GetInstance()->GetAppResource();

	Canvas *pCanvas = this->GetCanvasN();
	pCanvas->SetFont(font);


	//pCanvas->DrawBitmap(Rectangle(0,0,this->GetWidth(), 855), *(pAppResource->GetBitmapN(L"EditPanel_background.png")));
	//pCanvas->FillRectangle(Color(246,246,246,255), Rectangle(0,0,this->GetWidth(), tmp_client_rect.height-497));
	//pCanvas->FillRectangle(Color(255,255,255,255), Rectangle(0,0,this->GetWidth()-60, tmp_client_rect.height));

	for(i=0; i<arr_text_element.GetCount(); i++)
	{
		tmp_rect = static_cast< Rectangle* > (arr_text_element_rect.GetAt(i));
		tmp_string = static_cast< String *> (arr_text_element.GetAt(i));
		tmp_highlight = static_cast <Boolean *> (arr_text_element_highlight.GetAt(i));
		tmp_int = static_cast< Integer *> (arr_text_element_editing_mark.GetAt(i));
		tmp_check = static_cast< Integer *> (arr_insert_check.GetAt(i));
		tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i));
		tmp_point = static_cast< Point *> (arr_binding_start_and_end.GetAt(i));
		tmp_rect2 = static_cast< Rectangle* > (arr_memo_rect.GetAt(i));
		tmp_string2 = static_cast< String *> (arr_memo.GetAt(i));
/*		if(tmp_rect->height < 0 || tmp_rect->y > tmp_client_rect.height-497)
		{

		}
		else*/
		{
			if(tmp_point->x < 1000)
			{
				pCanvas->FillRectangle(Color(255,248,209,255),Rectangle(*tmp_rect));
				if(tmp_string2->GetLength() > 1)
				{

					pCanvas->FillRectangle(Color(240,200,209,255),Rectangle(*tmp_rect2));
				}
			}

			if(tmp_highlight->ToBool() == true)
			{
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y), *tmp_string, Color(0,255,0,150));
			}
			else
			{
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y), *tmp_string);
			}



			if(tmp_int->value == 2)
			{

				pCanvas->FillRectangle(Color(0,187,237,255), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,187,237,255));

			}
			if(tmp_int->value == 3)
			{
				pCanvas->FillRectangle(Color(0,187,237,200), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
				//pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,0));
			}
			else if(tmp_int->value == 1)
			{
				pCanvas->FillRectangle(Color(0,187,237,255), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
			}
			else if(tmp_check->value == 1)
			{
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			else if(tmp_check->value == 2)
			{
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
				tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i+1));
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			else if(tmp_check->value == 3)
			{
				tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i+1));
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			pCanvas->DrawRectangle(*tmp_rect);
		}
	}

	if(onHighlightStart == true)
	{
		pCanvas->FillRectangle(Color(100,100,255,255), cur_start_rect);
		pCanvas->FillRectangle(Color(100,100,255,255), cur_end_rect);
	}


}