|
No ..i am not calling onpaint. i am calling updatewindow, which is issuing OnPaint() command.
modified on Friday, June 27, 2008 3:05 AM
|
|
|
|
|
Is CMemDC your class? In the baove code, I coudnt find the you bitblt the content of memorydc back to the paint dc. Is it performed in the destructor of the CMemDC?.
Also why are you using a Memeory dc here? Is there any problem is you directly use the CPaintDC object?
|
|
|
|
|
Yes you are right CMemDC is our class. Here BitBlt fails because it is not one of active screen. Actual draw method is this
CWnd InTouch;
InTouch.Attach(m_hWndParent);
m_Parent.AttachExternalObject(this);
DWORD dwStyle = WS_CHILD |WS_VISIBLE;
VERIFY(m_Parent.Create(NULL, "Invisible", dwStyle, DrawRect, &InTouch, 0));
SetDrawMode (DRAWMODE_DESIGNTIME);
Draw(&InTouch, DrawRect);
where m_Parent is a member of one of our class CInvisibleParent. before calling the actual drawing of the user control we are creating m_Parent by attaching InTouch. So BitBlt is failing.
|
|
|
|
|
but what is the relation between this code and onpaint() function? The bitblat need be done to the CPaintDC object( the object your apssing to the CMemDC constructor ).
|
|
|
|
|
Naveen,
I tried BitBlt in the onpaint. What it returns is a blank page. here is my code.
HDC hdc = ::GetDC(this->m_hWnd);
HDC memDC = ::CreateCompatibleDC(hdc);
int w = rectTemp.right-rectTemp.left;
int h = rectTemp.bottom-rectTemp.top;
HBITMAP bitmap = ::CreateCompatibleBitmap(hdc,w,h);
::SelectObject(memDC,bitmap);
BOOL bRet = ::BitBlt(memDC, 0, 0, w, h , hdc, rectTemp.left, rectTemp.top , SRCCOPY );
Regards
|
|
|
|
|
no no whet i mean is to the following line in the end of the OnPaint() function.
dc.BitBlt( 0, 0, rect.Width(), rect.Height() , hdc, 0, 0 , SRCCOPY );
|
|
|
|
|
it didn't work. same result. it resulted into a blank page
|
|
|
|
|
yesterday I told you to check another thing, Using the CPainDC object directly. Now you are creating the CMemDC in between. Remove it and do all the painting and SendMessage directly on CPaintDC object.
|
|
|
|
|
Ok. I will try. One more question. with WM_PRINT i am able to capture the content of the grid. But not able to print the grid. Is it not possible to print the grid with WM_PRINT?
Regards
|
|
|
|
|
ops. there is a pblm. I tried like
void ListEx::OnPaint()
{
CPaintDC dc(this);
SendMessage(WM_PRINTCLIENT, (WPARAM)dc.m_hDC, (LPARAM) PRF_CLIENT);
}
In the above code, the grid is also painting. then I tried to paint it to the desktop like
void ListEx::OnPaint()
{
CListCtrl::OnPaint()
CWindowDC dc2(0);
SendMessage(WM_PRINTCLIENT, (WPARAM)dc2.m_hDC, (LPARAM) PRF_CLIENT);
}
But in this case only the text came...
|
|
|
|
|
First let me thank you for your kind support.
I wrote the code like this it is printing but no grid line not the entire client screen. it is capturing the area where the data is there
So what should i do
<div class="ForumMod">modified on Friday, June 27, 2008 3:07 AM</div>
|
|
|
|
|
subramanyeswari wrote: memDC.Attach(hDC);
why is this attach? And is this all code in the paint function? Because, the CPainDC should be used only in the OnPaint() function.
Actaully what is your purpose? To customise the list control, there are another standard method likes, Custom Draw( NM_CUSTOMDRAW ) and Owner draw . It better to use those functions for customizing especially using Custom Draw is simple and you can find many samples in code project itself.
Good Luck
|
|
|
|
|
I want to capture the image on the screen which is a custom control. I am not able to capture it with WM_PRINT. BitBlt is failing since the target window is invisible. (refer the site http://www.gamedev.net/community/forums/topic.asp?topic_id=327506[^]
And the code that i have shown like attach is not in the OnPaint(). It is in my own function.
Regards, Eswari
|
|
|
|
|
Naveen wrote: Sorry, I coudn't understand the diifference...What do you mean by "content of the contol" and "screen shot of the control".
The difference is having Notepad running with a large text file and doing a screen-shot using <alt+printscrn></alt+printscrn> as opposed to using File-Print .
The first one gets you the "screen shot of the control" (plus the application window itself), the other gets you the "content of the control."
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I don't know how to attach files. So that you can see the difference
Regards
|
|
|
|
|
Hi all,
I m working on VC++ 2005 MFC application,
here i m using a DateTimeControl.
Please tell me how can get the Moth and year value from the selected date of DateTimeCtrl.
Please help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
i m already try this but this gives total value of date like"06/07/2008"
but i want seprate values of Mont and year of Selected Value.
Please help me for this.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
If you get a COleDateTime you can retrieve the month with GetMonth. So, what is your problem exactly ??
|
|
|
|
|
i m also using this but gives Janury for month always.
i want when i m selected any date in DatetimeCtrl,then get selected month and year value.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
ThatsMe. wrote: i m also using this but gives Janury for month always.
Please post the relevant code (using the "code block" tag): I would like to see how you extract the date from the CDateTimeCtrl and how you verify that it's January.
|
|
|
|
|
thanks now it is resolved.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
ThatsMe. wrote: i m also using this but gives Janury for month always.
Because it's a long, long, long winter.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Can you tell us why you didnt try to do and we must do it?
Thanks
|
|
|
|
|
He's a repeat offender. He doesn't use Google or actually attempt to try to code. If you look at past questions I don't think he's ever posted code.
|
|
|
|