-
April 4th, 2011, 03:26 PM
#1
What's a device context?
Could you tell me in human terms what we are talking about when we refer to a device context/display context.
Thanks
-
April 4th, 2011, 06:27 PM
#2
Re: What's a device context?
Originally Posted by TpOreilly
Could you tell me in human terms what we are talking about when we refer to a device context/display context.
Thanks
When you display output, it has to display on something -- that "something" is the device context. It could be a particular window, a printer, etc.
Regards,
Paul McKenzie
-
April 4th, 2011, 11:02 PM
#3
Re: What's a device context?
HDC handleDeviceContext;
PAINTSTRUCT PaintSt;
handleDeviceContext= BeginPaint(hWnd, &PaintSt);
"HDC handleDeviceContext;" - Here we are creating a variable which will be a handle to a device context.
"PAINTSTRUCT PaintSt;" - Not 100% sure what is stored in here?
"handleDeviceContext= BeginPaint(hWnd, &PaintSt);" - This is where the device context actually comes from. This function returns a device context.
So a device context is just a virtual area which we use to paint graphical output.
Am i right in the above statements?
Ive got the feeling im not quite right here, but thats why you nice people are willing to clear things up, i hope
-
April 4th, 2011, 11:31 PM
#4
Re: What's a device context?
Originally Posted by TpOreilly
"PAINTSTRUCT PaintSt;" - Not 100% sure what is stored in here?
Just look at MSDN as to what BeginPaint() does.
So a device context is just a virtual area which we use to paint graphical output.
Yes. In addition, see functions such as GetDeviceCaps() as an example. It takes a device context, and returns, given what you're asking for, information on that device context.
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
Regards,
Paul McKenzie
Last edited by Paul McKenzie; April 4th, 2011 at 11:34 PM.
-
April 5th, 2011, 06:12 AM
#5
Re: What's a device context?
"PAINTSTRUCT PaintSt;" - Not 100% sure what is stored in here?
Some years ago 2 guys created a revolution on the internet. It has to do with searching... they called themselves google. Learn to use it.
PAINTSTRUCT
-
April 5th, 2011, 07:30 AM
#6
Re: What's a device context?
-
April 5th, 2011, 07:47 PM
#7
Re: What's a device context?
Seeing as we dont modify the attributes of the PAINTSTRUCT variable, the must be default values. By default does this make the device context area the size of the whole client area?
(This question is targeted at the rcPaint attribute of the structure)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|