|
How about GetLastInputInfo() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Oh, I guess that's exactly what I need, thanks.
|
|
|
|
|
Hi
Hi
I have a tabcontrol on a view window. I want to show a particular tab Window which has an error because i am validating some data i am using the function
void CNewForm::ShowErrorDialog(int TabNo)
{
TC_ITEM tci;
tci.mask = TCIF_PARAM;
tci.lParam = (LPARAM)m_pDlgHeader;
m_MyTab.SetItem(0, &tci);
CWnd* pWnd = (CWnd *)tci.lParam;
pWnd->ShowWindow(SW_SHOW);
}
It is focussing on particular tab but not showing the window. m_pDlgHeader already created during onInitDialog() function. Please help me why it is not showing the particular tab dialog.
Thanks in advance
Shailesh
|
|
|
|
|
Hello,
I am trying to place the property sheet tabs on the left side rather than the default top of the property sheet?? How do i do that?? Any pointers.
Thanks
|
|
|
|
|
Does this page offer any solutions?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I Have a MFC app,
And in my program I have a BMP image I need to be able to print out this image!. How can I do that?
|
|
|
|
|
Hi,
One of the procedure which you can follow is load the image into a dc and print the contents of the DC. Have a look @ the following link, although it is related to OpenGl, i think that you'll get little hints from it
http://www.codeproject.com/opengl/opengl_printing.asp[^]
Sujan
|
|
|
|
|
I seem to be having a problem with the fact that a dialog, created in the resource editor (VC.NET) which is 400 x 300 appears a completely different size on the screen. It seems to be x1.5 in the x and about x1.65 in the y. Apart from having something I don't understand happening with my program it also causes a problem as I have a grid in the backround (a bmp) which I cannot align my controls over properly (they are owner drawn and have parts of the grid in them). The control moves by sometimes 1 and sometimes 2 pixels on screen for every pixel moved in the editor (due to the position being scaled by 1.5 I assume). It is making aligning them impossible.
Any help on this would be appreciated.
Rich
|
|
|
|
|
the dialog editor use logical units, not pixel; so that dialogs can be resized to accomodate different font sizes ( for example ).
I would suggest manually move ( MoveWindow ) all your controls in the OnInitDialog, and Move ( or resize ) your dialog to fit the bitmap size.
Be sure to check that your dialog will be workable if the user select "Large" fonts ( from the display setting ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks for that Maximilien,
I have made the change in my code and all is working correctly. It is obvious if you stop and think about it but I don't have time for luxuries like that.
Thanks again for such a quick reply.
Rich
|
|
|
|
|
Hi Guys,
Iam working on a project on MFC & came across this problem.
Wanted to use the devicecontext function "DrawEdge" with the following set properties.It worked fine ,but the colour of the drawnEdge was always "black",eventhough I tried to set a brush(with a colour).
Any idea ,How I can use the "DrawEdge" function so that I can draw with a particular colour instead of "black".....
Don't want to use the "DrawFame" function of the deviceContext,as I want the "Edge_BUMP" effect.(See code
Or Is there anyother function in the "DeviceContext" which performs such an action.
CRect rect;
rect3.SetRect(10,10,300,100);
CBrush brushBlue(RGB(255,112,0));
pDC->SelectObject(&brushBlue);
pDC->DrawEdge(rect,EDGE_BUMP,BF_RECT);
Thanks....
|
|
|
|
|
Try changing the pen color too.
Many times, the edges of objects are drawn using the pen instead of the brush.
|
|
|
|
|
Yes,I tried as follows,selecting a pen first.But still It is drawing "black"
CRect rect3;
rect3.SetRect(10,10,300,100);
CPen newPen(PS_SOLID,1,RGB(255,0,0));
CPen *pOldPen = pDC->SelectObject(&newPen);
pDC->DrawEdge(rect3,EDGE_BUMP,BF_RECT);
|
|
|
|
|
The function is probably setting element colors itself using GetSysColor(), so you might not be able to override the colors, even though you have set them into the DC. You will have to make your own 'DrawEdge' function.
|
|
|
|
|
Do you have any ideas or suggestions....
|
|
|
|
|
Since you want to control the colors yourself, I suggest setting a pen and making a series of MoveTo and LineTo calls on your own - just do all the drawing the DrawEdge would have done for you on your own.
|
|
|
|
|
I choosed "DrawEdge" co's, with that, I can set the edges to bumped,etched or raised,which I can't do with "LineTo" or "MoveTo" functions.
|
|
|
|
|
Yes you can. You might need to change the pen color a couple times and draw more than one line next to each other, but BUMPED, ETCHED and RAISED are just combinations of shading using pens of different colors drawn next to each other.
Long before 'DrawEdge' existed (back in Windows 3.1 days) we used to do this all the time before '3-D controls' ever existed. Now MS has just added it in as part of the GDI to make it easier for people to achieve the same effect with a single function call. The DrawEdge will also use the current user's selected colors so it obtains the correct shading effect. Since you want to override the colors, you will have to provide the effects yourself.
As an example, here is some MFC source code:
void CDC::FillSolidRect(int x, int y, int cx, int cy, COLORREF clr)<br />
{<br />
ASSERT_VALID(this);<br />
ASSERT(m_hDC != NULL);<br />
<br />
::SetBkColor(m_hDC, clr);<br />
CRect rect(x, y, x + cx, y + cy);<br />
::ExtTextOut(m_hDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);<br />
}<br />
<br />
void CDC::Draw3dRect(LPCRECT lpRect,<br />
COLORREF clrTopLeft, COLORREF clrBottomRight)<br />
{<br />
Draw3dRect(lpRect->left, lpRect->top, lpRect->right - lpRect->left,<br />
lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight);<br />
}<br />
<br />
void CDC::Draw3dRect(int x, int y, int cx, int cy,<br />
COLORREF clrTopLeft, COLORREF clrBottomRight)<br />
{<br />
FillSolidRect(x, y, cx - 1, 1, clrTopLeft);<br />
FillSolidRect(x, y, 1, cy - 1, clrTopLeft);<br />
FillSolidRect(x + cx, y, -1, cy, clrBottomRight);<br />
FillSolidRect(x, y + cy, cx, -1, clrBottomRight);<br />
}
You could create something similar to get the other two effects this one does not draw.
|
|
|
|
|
Hi Blake,
Appreciate your reply.But should admit that althought I understood what u have written,have no idea how to achieve that.
Just to make my side clear,
I don't want to fill the rectangle with a partiular colour,would just want to draw the 4 lines with bumped effect.
In the following sample code,Iam trying to draw a rectangle with redcolour.
Would appreciate it if you could show it this code segment how I could achieve the bumped effect as well.
void CEx03aView::OnDraw(CDC* pDC)
{
CPen newPen(PS_SOLID,2,RGB(255,0,0));
CPen *pOldPen = pDC->SelectObject(&newPen);
//Top Line
pDC->MoveTo(10,100);
pDC->LineTo(150,100);
//Right Line
pDC->MoveTo(150,100);
pDC->LineTo(150,250);
//Bottom Line
pDC->MoveTo(150,250);
pDC->LineTo(10,250);
//Left Line
pDC->MoveTo(10,250);
pDC->LineTo(10,100);
}
Thanks..
|
|
|
|
|
I am developing an ActiveX control to display a image. if image size is big i should provide scroll bar. i attached the scroll bar by changing the cs.style = cs.style | WS_HSCROLL | WS_VSCROLL;
But when i click on scroll bar at run time it is not scrolling the image.
how to do this please me.
|
|
|
|
|
How to get the location of a button placed in a dialog box designed with resouce editor?
i tried with mybutton->GetWindowRect() and mybutton->GetClientRect().
but both does n't give the location of the button.
|
|
|
|
|
in what way it does not give the position of the button ?
CRect rect<br />
mybutton->GetWindowRect(rect);<br />
will give the pixel rectangle of the button relative to its parent window.
CRect rect<br />
mybutton->GetClientRect(rect);<br />
will give the pixel rectangle of the client region of the button.
remember that the positions and sizes in the resource editor ARE NOT PIXELS.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I have a couple of modeless dialogs as children of a parent dialog ( also modeless ).
when I DestroyWindow the parent dialog, the different child dialogs are beeing destroyed; but one of them behaves weird.
in one dialog, I have a CListBox; and when the child dialog gets destroy; somewhere; the call stack is not really usefull ( NTDLL, CWnd::OnCommand, CCmdTarget, ... ), and the only place where I actually
SetFocus<code> to the CListBox is not called there.<br />
<br />
The question, When doing a DestroyWindow, will/should the child controls of a modeless dialog individually receive the focus ?<br />
<br />
Thanks ... <br />
<br />
<hr><a href="http://www.thesorus.qc.ca">Maximilien Lincourt</a><br />
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
When doing a DestroyWindow, will/should the child controls of a modeless dialog individually receive the focus ?
No. They'll get destroyed without receiving focus, unless one of your WM_DESTROY handlers is explicity setting the focus to one that is about to be destroyed.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
this is what is bugging me; I call DestroyWindow on my dialog, and it goes directly to the handle for the LBN_FOCUS even if there is no call to SetFocus; and the call stack goes from the function that calls DestroyWindow to the Handler for the LBN_FOCUS.
Are there other ways that a control can get/receive the focus ?
I will try to reduce the problem to something more manageable and get more info.
Thank.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|