|
CImage m_Image;
m_Image.Load(yourfile);
m_Image.BitBlt(GetDC()->m_hDC,0,0,640,480,0,0);
you must inlcude AtlImage.h
|
|
|
|
|
but how do i load the image into the picturebox that i have created?
Picturebox variables
CStatic m_Picture
CString m_strPictureName
|
|
|
|
|
oops.. just saw that you are using VS2003.. i am using 6.0 though
|
|
|
|
|
I forgot VC6.0 but if I remember in VC6.0 you can use of CImage(I know you can use of it but I forgot class name) and I think that header was picture.h(not sure) in VC6.0
|
|
|
|
|
After you read your file you can attach a hbitmap to your control
CStatic t;
t.SetBitmap(hbitmap);
|
|
|
|
|
|
You can use of Christian Graus answer
|
|
|
|
|
Is there a way to replace the textbox that is being used when editing a CTreeCtrl's label in place?
Thanks,
Jon
|
|
|
|
|
|
Replacing it with a combo box, a date picker (for dates), etc.
|
|
|
|
|
late reply but anyhow...
this article tells how to something like that:
http://www.codeproject.com/treectrl/treeopt.asp
|
|
|
|
|
Hi there,
I'm doing a mfc dialog application.
I've a custom control with generic CWnd as it's base class. Now, i would like to create a splitter to separate it into 2 columns and the right column will have a scroll bar. The problem is that, I can't seem to find any info on how to do this.
Thanks for every single helping hand.
|
|
|
|
|
hi,
I have created a custom control with generic CWnd as it's based class. It's background is in black. However, i wan to allow a checkbox to determine whether or not to display a graphic(eg. a square drawn using CPen) in that custom control.May i know how to do this? Are there any example code i may refer to?
All help is much appreciated.
|
|
|
|
|
The WM_ERASEBKGRND message is the one you want - handle that, and in it, draw whatever background you want.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i have other graphic also drawn using CPen in the custom control. How to use WM_ERASEBKGRND to only erase the desired graphic?
|
|
|
|
|
You can use getwindowrect to find out the size of the control and draw on that only.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
can you explain more on how to use the WM_ERASEBKGND? I can't seem to get it to work.
|
|
|
|
|
Hi all
I always confused with the GetWindowRect and ScreenToClient.
What's the exact region when use the CWnd::GetWindowRect?
and what's the region of one control's(like a textbox) GetWindowRect?
and Why it always uses the ScreenToClient after using the control's GetWindowRect.
If possiable,show me with a graph.
Thanks.
Nothend
|
|
|
|
|
Nothend wrote: If possiable,show me with a graph.
Not sure how you expected that.
GetWindowRect gets the rectangle that the windows takes up. ScreenToClient takes co-ordinates that relate to the entire screen, and converts them to co-ordinates that are relative to the top left corner of the client program specified.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Perhaps this[^] may be of some help.
Steve
|
|
|
|
|
i want to capture a window to a bitmap.
when the document size is bigger than current viewable rectangle, if using the document size to the captured image will has a big black block.
<br />
CSize size = GetTotalSize();<br />
CClientDC dc(this);<br />
CDC memDc;<br />
if(!memDc.CreateCompatibleDC(&dc))<br />
{<br />
return ;<br />
}<br />
CBitmap bitmap;<br />
if( !bitmap.CreateCompatibleBitmap(&dc, size.cx, size.cy) )<br />
{<br />
return ;<br />
}<br />
CBitmap* pOldBitmap = memDc.SelectObject(&bitmap);<br />
memDc.BitBlt(0, 0, size.cx, size.cy, &dc, 0, 0, SRCCOPY );<br />
if( OpenClipboard() )<br />
{<br />
EmptyClipboard();<br />
SetClipboardData(CF_BITMAP, bitmap.GetSafeHandle());<br />
CloseClipboard();<br />
}<br />
memDc.SelectObject(pOldBitmap);<br />
any suggestion or tips will be great help.
thank you in advance.
|
|
|
|
|
A window only renders if it's on the visible area. Grabbing outside your desktop just isn't going to do anything.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You can use the PrintWindow function to do this I believe.
Steve
|
|
|
|
|
thank you, i will give it a try.
|
|
|
|