|
I'm using GDI / CDC to draw a chart control and would like to draw the chart series antialiased. Currently the line chart is drawn using CDC::Polyline, which is fast but not 'pretty'.
In the GDI+ documentation I couldn't find a method to draw a polyline, only a polygon which is not exactly the same.
|
|
|
|
|
Use one of the GraphicsPath::AddLine() overrides to add the points, do not call GraphicsPath::CloseFigure() as that will cause a line to drawn from the last point to the first point. Call Graphics::DrawPath() to draw the lines.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
In MDI project: how can I add my file extensions filter string to dialog window CFileDialog ? It is displayed automaticly, when user press FILE/OPEN... menu. How and where can I modify this dialog?
For example: when I'm displaying CFileDialog I can add filter by myself, like this:
static char szFilter[] = "Pliki BMP (*.BMP)|*.BMP||";
CFileDialog FileDlg( TRUE, NULL, NULL,
OFN_HIDEREADONLY, szFilter );
~~~~
|
|
|
|
|
If you don't want to derive your own class and override functions, you can edit the string table in the resource editor. Locate the resource that is associated with your CDocTemplate (like IDR_MAINFRAME).
The string will look something like:
Test Application\n\nMFCTest\n\n\nMFCTest.Document\nMFCTest Document
Change it to:
Test Application\n\nMFCTest\nPliki bmp *.bmp)\n.bmp\nMFCTest.Document\nMFCTest Document<br />
If you need to do anything more complicated, like multiple extensions per doc template, check out this article:
http://www.codeproject.com/docview/DocViewEnhancements.asp[^]
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
So I only have to make my own class (document template) derived from CMultiDocTemplate, use it like here:
pDocTemplate = new CMyMultiDocTemplate(<br />
IDR_CONTEXTTYPE,<br />
RUNTIME_CLASS(CMyDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMyView));<br />
AddDocTemplate(pDocTemplate);
and then override function DoPromptFileName() in this class? Or is there anything more to do?
And how can I use my own filter string in DoPromptFileName()? I don't know how to do this.
Thanks for any help.
~~~~
|
|
|
|
|
I'm trying to figure out why my CSocket.Receive() call is blocking. This is the code I have so far:
CSocket socket;<br />
<br />
socket.Create();<br />
ret = socket.Connect(m_sAddress, m_nPort);<br />
<br />
if (ret == 0)<br />
{<br />
<br />
GetSocketError();
return -1;<br />
<br />
}
<br />
m_TotalBytes = 0;<br />
<br />
<br />
while(m_bRunThread)<br />
{<br />
<br />
BYTE* pBuffer = new BYTE[MAX_BUFFER_SIZE];<br />
ret = socket.Receive(pBuffer, MAX_BUFFER_SIZE);<br />
<br />
<br />
........<br />
}<br />
The socket connects but never receives any data. The call to Receive seems to block the thread. I know the server program I am using is working because I can transfer data to other clients without a problem.
Any suggestions? Thanks
|
|
|
|
|
Use CAsyncSocket instead of CSocket. CSocket assumes synchonous communications (that is, you will send, then wait for a return message).
An alternative is to put the socket's receive call in a worker thread that fires off an event when it receives data in the buffer.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I have my own list derived from CListCtrl, i implement DrawItem myself. the list has a style LVS_EX_CHECKBOXES. so in the DrawItem i see if the item is checked i draw a check box in checked style and if it is not checked i draw a check box unchecked.
the list also has a style : single selection, show always, and full row selection.
problem is what i start the application and i try to check the first item. it checks it ok.
then i want to uncheck but nothing happens. in the draw item i still see the status of checked.
also in the OnItemChanging implementation, i see the newstate still checked....the only way to unchecked the item is to try and check an other item...then it uncheck the first item and checked the selected new item. i am not familiar with this behavior, i know that when u check an item, it stays checked until you uncheck it, and not when u check an other item. also if you check an other item , the first item you've checked should stay checked.
can any1 help?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Try RedrawWindow() on Item changed event.
Knock out 't' from can't,
You can if you think you can

|
|
|
|
|
it doesn't work....the item state after it is checked remains checked....
what else is wrong?
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Do you know how can I use Windows Media Player ActiveX control under VC++ 2005???
With VC++ 6 it is very simple...
but with VC++ 2005 mfc assignes differrent class to the control and there is no documentation for it.
-- modified at 2:53 Thursday 1st June, 2006
|
|
|
|
|
Hey guys,
I have a dialog based application. I want to save the last configuration of the that application. For example if I have a # of selected countries field set to 7 in last configuration, then next time if I open it, it should be saved.
Thanks in advace
Appreciate it
C++Prog
|
|
|
|
|
You can use from registry and See Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
Thanks...Appreciate your help
C++Prog
|
|
|
|
|
I would recommend against using the registry for a couple reasons:
1) It is a very old technology that is being phased out (slowly, but surely)
2) It is far more complicated than what you need anyway.
A simple solution is to write out a text file in some format (XML is nice for this) that you check for when your app starts. If the file exists, it loads the settings; if not, it uses a default configuration. Additionally, you can configure the file to exist anywhere you like (though, if you want to cooperate properly with Windows XP, you should put it in the users Document and Settings directory).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Preeti9 wrote: I have a dialog based application. I want to save the last configuration of the that application. For example if I have a # of selected countries field set to 7 in last configuration, then next time if I open it, it should be saved.
You may profile the data into .ini file for the application....
Knock out 't' from can't,
You can if you think you can

|
|
|
|
|
I have an outside application.
I found the buttons window using EnumChildWindows
I send the following to it:
SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0);
SendMessage(hwnd, WM_LBUTTONUP, 0, 0);
I put in a 300 millisecnd delay but the event for the button never fires.
Does anyone know why it would fire?
I can see the image of the button change. But its not releasing correctly. I have to click my app really fast to get the release to work right. But, the click event still doesn't fire.
Is there somethibng special require to get the button event to fire?
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
-- modified at 14:01 Tuesday 30th May, 2006
|
|
|
|
|
Use SendInput() to simulate user input.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Yes, i tried that first. But I have a problem.
It is a tabbed windows app.
It Registers each tab as a Window.
I need to click this tab. How do I get the exact screen coordinate to feed into SendInput?
GetClientRect is only local coordinates I think.
Please Tell me what methods to call to get rectangle to place the mouse position?
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
BM_CLICK instead of WM_LBUTTONDOWN
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
I am trying to set the edit control part of the dropdown to a specific number such as 15 (m_data = "15"). But because a value of 150 exists in the dropdown, it automatically sets it that number. How to I disable this? Thanks.
-- modified at 12:10 Tuesday 30th May, 2006
|
|
|
|
|
|
Yes, it's a dropdown combo box.
|
|
|
|
|
experiment:
edit does not change even if string exists in combo box
any specific non-default styles?
Kuphryn
|
|
|
|
|
No. It's just a dropdown with a CString member variable mapped to it. When I set the value to 16 for instance, it accepts that value. But for some reason, the value changes or the auto-complete kicks in when the number resembles what's in the pull-down.
|
|
|
|