Click here to Skip to main content
14,741,024 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Which is the latest version of VC++ ??? Pin
Naveen3-Sep-07 22:58
MemberNaveen3-Sep-07 22:58 
GeneralRe: Which is the latest version of VC++ ??? Pin
Neo Andreson3-Sep-07 23:54
MemberNeo Andreson3-Sep-07 23:54 
QuestionShrink graphics area (GDI+ Graphics) Pin
TheShihan3-Sep-07 22:25
MemberTheShihan3-Sep-07 22:25 
AnswerRe: Shrink graphics area (GDI+ Graphics) Pin
Llasus3-Sep-07 22:31
MemberLlasus3-Sep-07 22:31 
AnswerRe: Shrink graphics area (GDI+ Graphics) Pin
Naveen3-Sep-07 22:54
MemberNaveen3-Sep-07 22:54 
GeneralRe: Shrink graphics area (GDI+ Graphics) Pin
TheShihan3-Sep-07 23:38
MemberTheShihan3-Sep-07 23:38 
GeneralRe: Shrink graphics area (GDI+ Graphics) Pin
Naveen3-Sep-07 23:54
MemberNaveen3-Sep-07 23:54 
GeneralRe: Shrink graphics area (GDI+ Graphics) Pin
TheShihan4-Sep-07 0:45
MemberTheShihan4-Sep-07 0:45 
well, I'm stuck... first I show my code:

/**************************************************************************************/
void xy::DrawPicture()
/**************************************************************************************/
{
	///////////////////////////////////////////////
	// show image in picture control IDC_PICTURE
	CClientDC dc(&m_pictureControl);
	Graphics graphics(dc);

	CRect rc = GetImageArea(&m_pictureControl);

	CPoint topLeft;
	topLeft = rc.TopLeft();
	int rcWidth = rc.Width();
	int rcHeight = rc.Height();
	
	Rect gdiRect(topLeft.x, topLeft.y, rcWidth, rcHeight);

	graphics.SetClip(gdiRect, CombineModeUnion);

	// fix image panning
	m_nPanX = 0;
	m_nPanY = 0;
	
	// Coordinates of the top left corner (in drawing area)
	int x = 0,
		y = 0;

	int size_x = rc.Width();
	int size_y = rc.Height();
		
	// Display it
	graphics.DrawImage(m_image, x, y, size_x, size_y);

	// we need to enable the image manipulation controls
	enableImageManipulation(true);

}


and to make things clearer (hopefully Wink | ;-) ):
/**************************************************************************************/
// Returns a CRect with deflated dimensions of a CWnd child element
CRect xy::GetImageArea(CWnd * windowElement)
/**************************************************************************************/
{
	CRect rc;

	windowElement->GetWindowRect(&rc);
	ScreenToClient(&rc);

	rc.DeflateRect(2, 2);

	return rc;
}


Sooo.. what I don't get or what it's not working is: I don't see any change at all with "CombineModeUnion". I have the "graphics" which is from the "dc", which has the dimensions of the picture control with borders. Then and I have the "rc" (a CRect) which has been deflated 2 pixel on each side.

So in my mind, when I take the UNION of the both "shapes" it should clip the "graphics" object and it should have the dimensions of the smaller "rc", also it should be positioned inside the picture control, spacing 2px on each side and not TOP: 0 LEFT: 0 (as it seems to me it is).

What am I doing wrong, any Ideas?

Thx, Shi
GeneralRe: Shrink graphics area (GDI+ Graphics) Pin
Naveen4-Sep-07 0:51
MemberNaveen4-Sep-07 0:51 
Questionprinting problem on A4 size paper??? Pin
Neo Andreson3-Sep-07 22:25
MemberNeo Andreson3-Sep-07 22:25 
AnswerRe: printing problem on A4 size paper??? Pin
Llasus3-Sep-07 22:33
MemberLlasus3-Sep-07 22:33 
AnswerRe: printing problem on A4 size paper??? Pin
Nishad S3-Sep-07 23:08
MemberNishad S3-Sep-07 23:08 
AnswerRe: printing problem on A4 size paper??? Pin
Anurag Gandhi3-Sep-07 23:44
professionalAnurag Gandhi3-Sep-07 23:44 
QuestionCompression Pin
shakumar_223-Sep-07 21:46
Membershakumar_223-Sep-07 21:46 
AnswerRe: Compression Pin
Llasus3-Sep-07 21:55
MemberLlasus3-Sep-07 21:55 
GeneralRe: Compression Pin
shakumar_223-Sep-07 22:04
Membershakumar_223-Sep-07 22:04 
GeneralRe: Compression Pin
Paresh Chitte3-Sep-07 22:49
MemberParesh Chitte3-Sep-07 22:49 
AnswerRe: Compression Pin
Paresh Chitte3-Sep-07 22:00
MemberParesh Chitte3-Sep-07 22:00 
AnswerRe: Compression Pin
Maxwell Chen3-Sep-07 23:02
MemberMaxwell Chen3-Sep-07 23:02 
AnswerRe: Compression Pin
jhwurmbach3-Sep-07 23:14
Memberjhwurmbach3-Sep-07 23:14 
AnswerRe: Compression Pin
El Corazon4-Sep-07 17:11
MemberEl Corazon4-Sep-07 17:11 
QuestionHow to Put Icon on Button. Pin
GauranG Shah3-Sep-07 21:11
MemberGauranG Shah3-Sep-07 21:11 
AnswerRe: How to Put Icon on Button. Pin
Stephen Hewitt3-Sep-07 22:03
MemberStephen Hewitt3-Sep-07 22:03 
GeneralRe: How to Put Icon on Button. [modified] Pin
GauranG Shah4-Sep-07 1:41
MemberGauranG Shah4-Sep-07 1:41 
GeneralRe: How to Put Icon on Button. Pin
Hamid_RT4-Sep-07 2:54
MemberHamid_RT4-Sep-07 2:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.