|
It is true that the window is not painted while resizing.
But it will be painted in all other scenarios. That is at the time of creation, when some window moves over it, etc.
Hope you got the idea.
And I found that your code for drawing a rectangle in the centre of the window is not fine.
You may have to update it as,
CPaintDC dc( this );
CRect rect;
GetClientRect( &rect );
dc.FillSolidRect( &rect, RGB( 255, 0, 255 ));
const int nWidth = 100;
const int nHeight = 100;
int nX1 = ( rect.Width() - nWidth ) / 2;
int nY1 = ( rect.Height() - nHeight ) / 2;
dc.Rectangle( nX1, nY1, nX1 + nWidth, nY1 + nHeight );
- NS -
|
|
|
|
|
Actually i am just trying out some Device context functions. i just want to place
a rectangle somewhere middle. anyways thanx for placing it exactly.
But stil i didnt get whats happening.
I feel that a call is made to OnPaint after OnSize thats why its painting
whole client area. According to me after i paint my whole client area i should
not see any previous content. But here its not happening like that.??
Can anyone clear my doubt??
|
|
|
|
|
i don't understand which previous content u r seeing ?? all is new after resize of window.
|
|
|
|
|
ya exactly thats what i want , everything should be new...
this is what happening
. I display a rect(i ll name it "rectA") at center of dialog.
. when i maximize the dialog. i get two rectangle's. One is my previous one
(ie "rectA") at the top left and the other one is at the center.
. what i expect is only one rectangle at center. i dont want "rectA" to be displayed again when i maximize because everything should be cleared.
|
|
|
|
|
That is because entire area is not re-painted. As I mentioned earlier, if the window class does not have the styles (CS_HREDRAW and CS_VREDRAW), the painting will not occur when the window is resized. That's the problem happened to you. For a dialog window, these styles will not be there. So you have to call Invalidate() from the OnSize.
- NS -
|
|
|
|
|
in my program i'm creating an scintilla based editor...
i can display the calltips...
but if anyone knows the logic of displaying the variables types in calltips such that...
if i keep mouse on a variable 'i' which is an integer...,in calltip it should show "int i"...
how to implement this?any help thanx n advance...
|
|
|
|
|
Simple tooltip[^]
Advanced Tooltip[^]
To know how plot it you have to know what the mouse is pointing!
To do this you can plot the text storing the border of any useful word displayed and test if the mouse position is on it (if yes then plot the tooltip).
nother way is create a custom class that display a single word of the text, it can bes mouse sensitive and you can display its tooltip (if needed).
Russell
|
|
|
|
|
i didn't understand clearly the meaning of "plot the text storing the border of any useful word "...that is how to
store the border of text...first how 'll get the text over which the mouse is pointing...
since i'm totally confused cud u explain me somewhat eloborately if possible with an example code of 4 or 5 lines....
thanx 4 ur reply...
|
|
|
|
|
When you draw the text on your DC you can use CDC::GetTextExtent(...) /CDC::GetOutputTextExtent(...) to know the size of the label [heigh and width].
Of course, to do this you have to draw yourself the text on the screen, so you have to create a derived class of CView.
In this way it will be very simple also to color the words with different colors: I think that this can be useful to your project.
Russell
|
|
|
|
|
|
i think i didn't explain u my problem in a correct way...
the 2 functions u have given returns the height and width of the string...
but my question is how will i get the string over which mouse is thr...
that is if u keep the mouse over a variable name "var name"
which is of integer type my tooltip should show
"int var name".
i think i've explained u clearly now...
thanx 4 ur reply ...
|
|
|
|
|
|
i used builder 6 and got the whole cppbrowser to work but now i want to save the html into a text file,how do i convert the IDispatch to string?
this is what the help tells me.but honestly i don't understand
"Use Document to access an IDispatch interface for manipulating the contents of the HTML document through the COM object model. If there is no active document, Document is NULL. That is, you must first load a document using the Navigate or Navigate2 method before you can manipulate it using the Document interface.
For more information about this interface, see the document object section of Microsoft’s Dynamic HTML reference."
|
|
|
|
|
hye,
in my project,i m usind a DVR card which gives 4 channel video
now i have increased the width and height of my all 4 video channels....but the recorded file is not very clear.....
can anybody tell me what should i do????
Do i have to change video parameters like brightness,contrast or i have to change video standard like 4CIF,2CIF.
please help!!!!!
NT
|
|
|
|
|
My program crashed when it invoked one dll's function with debug mode.My code is below.
DVDErrorThrower err;
try {
err = m_session->BeginDiscAccess(hModule, device, DAM_READ_ONLY, 0, 0);
}
catch(dvd_eng_error e)
{
return E_FAIL;
}
The breakpoint is in _CRT_DEBUGGER_HOOK.
*******************************************************************************/
#include <dbgint.h>
#ifdef _DEBUG
#include <internal.h>
#include <limits.h>#include <mtdll.h>
#include <malloc.h>
#include <stdlib.h>
_CRT_ALLOC_HOOK _pfnAllocHook = _CrtDefaultAllocHook;
/***
*int _CrtDefaultAllocHook() - allow allocation
*
*Purpose:
* allow allocation
*
*Entry:
* all parameters ignored
*
*Exit:
* returns TRUE
*
*Exceptions:
*
*******************************************************************************/
int __cdecl _CrtDefaultAllocHook(
int nAllocType,
void * pvData,
size_t nSize,
int nBlockUse,
long lRequest,
const unsigned char * szFileName,
int nLine
)
{
return 1; /* allow all allocs/reallocs/frees */
}
#endif /* _DEBUG */
int _debugger_hook_dummy;
#ifdef _M_IA64
#undef _CRT_DEBUGGER_HOOK
#define _CRT_DEBUGGER_HOOK __crt_debugger_hook
#endif /* _M_IA64 */
__declspec(noinline)
void __cdecl _CRT_DEBUGGER_HOOK(int _Reserved)
{
/* assign 0 to _debugger_hook_dummy so that the function is not folded in retail */
(_Reserved);
_debugger_hook_dummy = 0;
}
and the callstack is like below:
> msvcr80.dll!_crt_debugger_hook(int _Reserved=) Line 65 C
msvcr80.dll!_invoke_watson(const wchar_t * pszExpression=0x00000000, const wchar_t * pszFunction=0x00000000, const wchar_t * pszFile=0x00000000, unsigned int nLine=0, unsigned int pReserved=0) Line 181 + 0x7 bytes C++
msvcr80.dll!_invalid_parameter_noinfo() Line 99 + 0xc bytes C++
TnAPIEngine.dll!05c0531e()
[Frames below may be incorrect and/or missing, no symbols loaded for NeroAPIEngine.dll]
TnAPIEngine.dll!05d920b0()
ntdll.dll!77b21843()
ntdll.dll!77b216dc()
msvcr80.dll!malloc(unsigned int size=189077260) Line 163 + 0x63 bytes C
mfc80u.dll!operator new(unsigned int nSize=0) Line 349 + 0x3 bytes C++
TnAPIEngine.dll!05d925e9()
TnAPIEngine.dll!05dc89fe()
And my Pc's environoment is :
Vista ultimate.
visual stdio 2005 sp1
but if I ran my program step by step ,it would catch the exception the function threw. And also with release mode.the program worked well!
I'm crazy.
Can anybody help me?
|
|
|
|
|
|
I have installed it.but the bug also display.
|
|
|
|
|
try cathcing all exceptions with catch(...){}
If u can Dream... U can do it
|
|
|
|
|
I have tried it,but it is useless.
|
|
|
|
|
Then try isolating the problem with that dll function. (remove the parts which smells some problems). likewise try again..
I think there is project specific settings for exceptions , Give a look into that..
All the best friend.
If u can Dream... U can do it
|
|
|
|
|
yeath,you are right,I have tried it.the result is that my program can catch the exception.
But which project settings would be possible for this exception?
I compared difference of project's settings between debug mode and release mode.
But they are same except for runtime library,and others I guess would't cause this problem.
Multi-thread Dll is set under release mode,and Multi-thread Debug Dll is set under debug mode.
If I set Multi-thread Debug Dll as runtime library under release,the program will be fine in that function but other functions,
If I set multi-thread dll as runtime library under debug,the problem is still exists.
|
|
|
|
|
waiting on line! thanks!
I like vc ,hope to talk about much with fans of vc!
|
|
|
|
|
You can use TVM_INSERTITEM and TVINSERTSTRUCT in which TVINSERTSTRUCT::itemex.iIntegral is for specifying the height. Through this you can set different height for each items.
- NS -
|
|
|
|
|
Hi! everyone!
I happened a problem now. I want to implement a transparent button. So I override the class of CButton. When I want to get the background of button, I use the GetParent() to get the CWnd* of the dialog the button in at first. But the point I get isn't the dialog's. It is the point of the desktop! Then I use GetParentOwner(). But the point it returned is same as GetParent(). So I don't know how to resolve this problem. Is there anyone who know how to resolve it? Thx!
regards!
|
|
|
|
|
i think if you can use the virtual function.i don't really understand just my feeling .
|
|
|
|