Click here to Skip to main content
15,898,580 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Which is the latest version of VC++ ??? Pin
Naveen3-Sep-07 21:58
Naveen3-Sep-07 21:58 
GeneralRe: Which is the latest version of VC++ ??? Pin
Neo Andreson3-Sep-07 22:54
Neo Andreson3-Sep-07 22:54 
QuestionShrink graphics area (GDI+ Graphics) Pin
TheShihan3-Sep-07 21:25
TheShihan3-Sep-07 21:25 
AnswerRe: Shrink graphics area (GDI+ Graphics) Pin
Llasus3-Sep-07 21:31
Llasus3-Sep-07 21:31 
AnswerRe: Shrink graphics area (GDI+ Graphics) Pin
Naveen3-Sep-07 21:54
Naveen3-Sep-07 21:54 
GeneralRe: Shrink graphics area (GDI+ Graphics) Pin
TheShihan3-Sep-07 22:38
TheShihan3-Sep-07 22:38 
GeneralRe: Shrink graphics area (GDI+ Graphics) Pin
Naveen3-Sep-07 22:54
Naveen3-Sep-07 22:54 
GeneralRe: Shrink graphics area (GDI+ Graphics) Pin
TheShihan3-Sep-07 23:45
TheShihan3-Sep-07 23: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
Naveen3-Sep-07 23:51
Naveen3-Sep-07 23:51 
Questionprinting problem on A4 size paper??? Pin
Neo Andreson3-Sep-07 21:25
Neo Andreson3-Sep-07 21:25 
AnswerRe: printing problem on A4 size paper??? Pin
Llasus3-Sep-07 21:33
Llasus3-Sep-07 21:33 
AnswerRe: printing problem on A4 size paper??? Pin
Nishad S3-Sep-07 22:08
Nishad S3-Sep-07 22:08 
AnswerRe: printing problem on A4 size paper??? Pin
Anurag Gandhi3-Sep-07 22:44
professionalAnurag Gandhi3-Sep-07 22:44 
QuestionCompression Pin
shakumar_223-Sep-07 20:46
shakumar_223-Sep-07 20:46 
AnswerRe: Compression Pin
Llasus3-Sep-07 20:55
Llasus3-Sep-07 20:55 
GeneralRe: Compression Pin
shakumar_223-Sep-07 21:04
shakumar_223-Sep-07 21:04 
GeneralRe: Compression Pin
Paresh Chitte3-Sep-07 21:49
Paresh Chitte3-Sep-07 21:49 
AnswerRe: Compression Pin
Paresh Chitte3-Sep-07 21:00
Paresh Chitte3-Sep-07 21:00 
AnswerRe: Compression Pin
Maxwell Chen3-Sep-07 22:02
Maxwell Chen3-Sep-07 22:02 
AnswerRe: Compression Pin
jhwurmbach3-Sep-07 22:14
jhwurmbach3-Sep-07 22:14 
AnswerRe: Compression Pin
El Corazon4-Sep-07 16:11
El Corazon4-Sep-07 16:11 
QuestionHow to Put Icon on Button. Pin
GauranG Shah3-Sep-07 20:11
GauranG Shah3-Sep-07 20:11 
AnswerRe: How to Put Icon on Button. Pin
Stephen Hewitt3-Sep-07 21:03
Stephen Hewitt3-Sep-07 21:03 
GeneralRe: How to Put Icon on Button. [modified] Pin
GauranG Shah4-Sep-07 0:41
GauranG Shah4-Sep-07 0:41 
GeneralRe: How to Put Icon on Button. Pin
Hamid_RT4-Sep-07 1:54
Hamid_RT4-Sep-07 1: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.