コード例 #1
0
void CAngleLabel::DrawHotShape(Graphics& graph)
{
	SolidBrush sbrush(Color::White);
	Pen penDraw(Color::Blue, 3);

	PointF ptLT;
	ptLT.X = m_ptary[0].X - m_nWidth;
	ptLT.Y = m_ptary[0].Y - m_nWidth;

	Rect rect((int)ptLT.X, (int)ptLT.Y, m_nWidth * 2, m_nWidth * 2);
	graph.DrawEllipse(&penDraw, rect);
	graph.FillEllipse(&sbrush, rect);

	ptLT.X = m_ptary[1].X - m_nWidth;
	ptLT.Y = m_ptary[1].Y - m_nWidth;

	rect.X = (int)ptLT.X;
	rect.Y = (int)ptLT.Y;
	rect.Width = m_nWidth * 2;
	rect.Height = m_nWidth * 2;

	graph.DrawEllipse(&penDraw, rect);
	graph.FillEllipse(&sbrush, rect);

	ptLT.X = m_ptary[2].X - m_nWidth;
	ptLT.Y = m_ptary[2].Y - m_nWidth;

	rect.X = (int)ptLT.X;
	rect.Y = (int)ptLT.Y;
	rect.Width = m_nWidth * 2;
	rect.Height = m_nWidth * 2;

	graph.DrawEllipse(&penDraw, rect);
	graph.FillEllipse(&sbrush, rect);
}
コード例 #2
0
ファイル: CircleView.cpp プロジェクト: hlobit/SimPetri
void CCircleView::Draw(CDC* pDC, const std::vector<CElement*>& selection, CElement* highlight)
{
	Color theColor = ColorToDraw(selection, highlight);

	Graphics g = pDC->GetSafeHdc();
	Pen pen(theColor, penWidth);
	SolidBrush brush(fillColor);
	g.SetSmoothingMode(SmoothingModeAntiAlias);
	g.FillEllipse(&brush, *enclosingRect);
	g.DrawEllipse(&pen, *enclosingRect);
}
コード例 #3
0
ファイル: UIComomCtrls.cpp プロジェクト: smithLiLi/dev
void UIButton::onPaintBkg(Graphics& graphics, Rect rect)
{
    SolidBrush brush(m_color);
    switch (m_buttonType)
    {
    case UITYPE_BUTTON_RECTANGLE:
        graphics.FillRectangle(&brush, rect);
        break;
    case UITYPE_BUTTON_CIRCLE:
        graphics.FillEllipse(&brush, rect);
        break;
    default:
        break;
    }
}
コード例 #4
0
void CToolRegularRuler::DrawHotShape(Graphics& graph)
{
	SolidBrush sbrush(Color::Green);
	Pen penDraw(Color::Blue, 2);
	penDraw.SetDashStyle(DashStyleDot);

	PointF pt((m_ptary[0].X + m_ptary[1].X) / 2, m_ptary[0].Y);
	
	graph.DrawLine(&penDraw, pt, m_HotPts.ptRotate);
	graph.FillEllipse(&sbrush, m_HotPts.ptRotate.X - HOTINTERVAL,
					  m_HotPts.ptRotate.Y - HOTINTERVAL,
					  2.0 * HOTINTERVAL, 2.0 * HOTINTERVAL);

	penDraw.SetDashStyle(DashStyleDash);
	penDraw.SetColor(Color::Red);

	graph.DrawRectangle(&penDraw, m_rcGrip.left, m_rcGrip.top, m_rcGrip.Width(), m_rcGrip.Height());
}
コード例 #5
0
unsigned int tabs_impl_win32::draw_tab(Graphics &g, unsigned int a_X, unsigned int a_Y, unsigned int a_Index){
	if(a_X > get_size().m_Width) return a_X;

	Color c = Color(255, 44, 61, 91);

	if(m_ActiveTab == a_Index) c = Color(255, 255, 232, 166);
	else if(m_HoverTab == a_Index) c = Color(255, 100, 110, 117);

	SolidBrush b(c);
	SolidBrush t(m_ActiveTab == a_Index ? Color(255, 255, 248, 225) : c);
	SolidBrush black(Color(255, 0, 0, 0));
	SolidBrush white(Color(255, 255, 255, 255));
	SolidBrush closeDark(Color(255, 117, 99, 61));
	SolidBrush closeLight(Color(255, 206, 212, 221));
	Pen p(Color(255, 0, 0, 0));
	Font font(L"Tahoma", 10);
	PointF origin(a_X + 5, a_Y + 3), originX(a_X + 10, a_Y + 5);

	RectF bb, close;

	std::string s = this->get_child_name(a_Index);
	std::wstring w(s.begin(), s.end());

	// draw tab
	g.MeasureString(w.c_str(), w.size(), &font, origin, &bb);
	bb.Height = 25;
	originX.X += bb.Width + 5;
	close = RectF(originX.X, originX.Y, 15.f, 15.f);
	RectF::Union(bb, bb, close);

	GraphicsPath gp;

	// draw header
	int x = a_X; int y = a_Y;
	int headerHeight = get_size().m_Height / 2;
	int arcSize = 10;
	int width = bb.Width;

	// top part = arc
	gp.AddLine(x, y + headerHeight + arcSize / 2, x, y + arcSize / 2);
	gp.AddArc(x, y, arcSize, arcSize, 180.f, 90.f);
	gp.AddArc(x + width, y, arcSize, arcSize, 270.f, 90.f);
	gp.AddLine(x + width + arcSize, y + arcSize / 2, x + width + arcSize, y + headerHeight + arcSize / 2);

	g.FillPath(&t, &gp);

	bb.Width += arcSize;

	// bottom = rect
	g.FillRectangle(&b, a_X, a_Y + headerHeight, bb.Width, 10.f);

	g.DrawString(w.c_str(), w.size(), &font, origin, m_ActiveTab == a_Index ? &black : &white);

	// draw close button
	if(m_ActiveTab == a_Index || m_HoverTab == a_Index){
		SolidBrush closeBrush(Color(190, 40, 30));
		
		Pen hoverPen(Color::White, 2);
		Pen regularPen(Color(20, 20, 20), 2);

		Pen *p = &regularPen;

		float shrink = 4;

		RectF lines = close;
		lines.X += shrink;
		lines.Y += shrink;
		lines.Width -= shrink * 2;
		lines.Height -= shrink * 2;

		// just get mouse position here instead of passing it through
		// from wm_mousemove
		POINT mouse;
		GetCursorPos(&mouse);
		ScreenToClient(m_hWndTabs, &mouse);
		if(close.Contains(mouse.x, mouse.y)) {
			g.FillEllipse(&closeBrush, close);
			p = &hoverPen;
		}

		g.DrawLine(p, lines.X, lines.Y, lines.X + lines.Width, lines.Y + lines.Height);
		g.DrawLine(p, lines.X + lines.Width, lines.Y, lines.X, lines.Y + lines.Height);
	}

	m_VisibleTabs[a_Index].m_BoundingBox = bb;
	m_VisibleTabs[a_Index].m_CloseBox    = close;

	return bb.Width;
}