Ejemplo n.º 1
0
void CCalSupport::DrawBackgroundRectangle(const RECT& Rect, const CAGMatrix& Matrix, COLORREF FillColor)
{
	POINT pPoints[4];
	Matrix.TransformRectToPolygon(Rect, pPoints);

	HRGN hClipRegion = m_dc.SaveClipRegion();
	m_dc.SetClipRectangle(pPoints);

	// Draw the interior
	if (FillColor != CLR_NONE)
		m_dc.FillRectangle(pPoints, FillColor);

	m_dc.RestoreClipRegion(hClipRegion);
}
Ejemplo n.º 2
0
void CCalSupport::DrawRectangle(const RECT& Rect, const CAGMatrix& Matrix, COLORREF LineColor, int LineWidth, COLORREF FillColor, const CString& strText, const CAGSpec& Spec, int VertJust, int nLineWidth, int nLineHeight)
{
//j	#define RND (int)(255 * ((double)rand() / RAND_MAX))
//j	LineColor = RGB(RND, RND, RND);

	POINT pPoints[4];
	Matrix.TransformRectToPolygon(Rect, pPoints);

	HRGN hClipRegion = m_dc.SaveClipRegion();
	m_dc.SetClipRectangle(pPoints);

	// Draw the interior
	if (FillColor != CLR_NONE)
		m_dc.FillRectangle(pPoints, FillColor);

	// Draw the text
	if (!strText.IsEmpty())
	{
		CRect RectDeflated = Rect;
		RectDeflated.DeflateRect(nLineWidth, nLineHeight);
		Spec.DrawTextAligned(&m_dc, strText, NULL, RectDeflated, (eVertJust)VertJust);
	}

	// Draw the outline (non-hairline)
	if (LineWidth >= LT_Normal)
	{
		int iLineWidth = dtoi(m_dc.GetViewToDeviceMatrix().TransformDistance(2*LineWidth+1));
		m_dc.DrawRectangle(pPoints, LineColor, iLineWidth, CLR_NONE);
	}

	m_dc.RestoreClipRegion(hClipRegion);

	// Draw the outline (hairline)
	if (LineWidth == LT_Hairline)
		m_dc.DrawRectangle(pPoints, LineColor, LT_Hairline, CLR_NONE);
}