|
Yup!
No progress.
Can I email you the sample project I have? I can make it work
if its 1-screen and I can make it work if my variables are all
global, but I cant figure it out for the current project.
Please, please, please, please....
|
|
|
|
|
DanYELL wrote: Can I email you the sample project I have?
I cannot commit to the potential effort that might be involved in solving your problem(s). It is not at all clear what they might be. It seems very possible that you have some design issues and that you do not yet understand the MFC Document/View framework.
led mike
|
|
|
|
|
Hi fellows
I'm developing a app that creates a graphics with some points.
My problem is that when I resize the window the figure doesn't change their size too. Like you'll see in the code below I'm getting the LOWORD and the HIWORD on the WM_SIZE message and in the WM_PAINT message I sum the values in the points that I define in a POINT array. Fellows, what's going on? What this guy doesn't resized?
Thanks a lot
<br />
<br />
case WM_SIZE:<br />
{<br />
ixClient = LOWORD(lParam);<br />
iyClient = HIWORD(lParam);<br />
break;<br />
}<br />
case WM_PAINT:<br />
{<br />
int iTot = 30;<br />
POINT tmpPoint;<br />
POINT points2[] = {50, 50, 200, 200, 100, 100, 120, 120, 20, 20};<br />
LOGPEN LogPen;<br />
tmpPoint.x = 2;<br />
LogPen.lopnStyle = PS_SOLID;<br />
LogPen.lopnWidth = tmpPoint;<br />
LogPen.lopnColor = 0x00FF0000;<br />
HPEN thePen = CreatePenIndirect(&LogPen);<br />
hdc = GetDC(hwnd);<br />
SelectObject(hdc, thePen);<br />
int iSize = sizeof(points2)/sizeof(POINT);<br />
for(int i = 0 ; i < iSize ; i++)<br />
{<br />
points2[i].x = i * (ixClient+points2[i].x)/iSize;<br />
points2[i].y = i * (iyClient+points2[i].y)/iSize;<br />
}<br />
Polyline(hdc, points2, (sizeof(points2)/sizeof(POINT))); <br />
break;<br />
}<br />
|
|
|
|
|
A couple things:
1) Create a temporary POINT buffer to use for the Polyline call.
2) Use floating points (or doubles) for increased precision in the math. You can cast them back to integers after your done manipulating them, but doing the calculations as doubles will allow for a more accurate adjustment.
int iSize = sizeof(points2)/sizeof(POINT);<br />
POINT* pPoints = new POINT[iSize];<br />
for(int i = 0 ; i < iSize ; i++)<br />
{<br />
double tempX = (double)i * ((double)ixClient + (double)points2[i].x)/(double)iSize;<br />
double tempY = (double)i * ((double)iyClient + (double)points2[i].y)/(double)iSize;<br />
(*pPoints)[i].x = (int)tempX;<br />
(*pPoints)[i].y = (int)tempY;<br />
}<br />
Polyline(hdc, pPoints, iSize);<br />
delete [] pPoints;
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
|
|
|
|
|
Try adding InvalidateRect() to your WM_SIZE handler. Also you shouldn't be getting your dc in WM_PAINT using GetDC(), anyway calls to GetDC() must be matched with a ReleaseDC(). Use BeginPaint() / EndPaint(). When selecting objects into a DC you should store the object selected out so you can select it back again. Also if you create a pen, you need to destroy it with DeleteObject().
|
|
|
|
|
I have a VC++/MFC application that I am converting from VS6 to VS2005. After much trudgery I have it compiling but the linking is failing with.
1>CVTRES : fatal error CVT1100: duplicate resource. type:DIALOG, name:24029, language:0x0409
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
I have two resource files in the project: the default app.rc and an additional shared.rc (shared with other applications). I #include the shared.rc from within the app.rc. This all works fine under VS6.
I am also using Stingray Grid and Toolkit. These .rc files are not explicitly part of the project but are also include through the resource includes (in app.rc).
I know I don't actually have duplicate resources so I figure it must be some little configuration issue causing this. The dialog (24029) is in shared.rc and it's not the problem. If I reorder the dialogs in the resource it'll error on whichever is first.
I have done some renumbering to insure I'm not stepping on other resource IDs with no luck. Originally I was getting the same error but for "type:CURSOR, name: 3". I only have 2 cursors in my project and they definitely don't have 3 as their resource ID.
Help? Thank you much.
Eric Margheim
|
|
|
|
|
Hi all,
how can I create plugins for media player?
And how to know where the slider is?(time)
Please help me,
If there is any helpful article for creating pluging I would like to know.
thanks.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
|
If pchar and CString are both equivalent to a C-style null-terminated string, what is the advantage of using one over the other?
Kitty5
|
|
|
|
|
kitty5 wrote: what is the advantage of using one over the other?
CString is a class that encapsulates managing the memory and other string manipulation routines.
|
|
|
|
|
cool beans.
Thank you!
Kitty5
|
|
|
|
|
I am a newbie developing an evc++ 4.0 application for a handheld
computer running CE .NET 4.2. Is there a way to set focus to indivdual elements of the Date Time Picker, like the month? Currently, focus is being set to the day.
Sande
|
|
|
|
|
I don't think the CDateTimeCtrl has any methods like CEdit's SetSel.
You could try simulating the user pressing the right arrow key using SendInput or keybd_event, if those functions are even available for CE. You might run into problems with the date formatting and locales though.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Hi Steve.
Thank you for your response. I believe that both SendInput and keybd_event are available for CE. I will give them a try. Thanks.
Sande
|
|
|
|
|
Hallo sandem,
I recently got a very good help here to format a DateTimePicker. I needed a DateTimePicker without days (only with month and years). The suggestion was to use a CDateTimeCtrl instead of a COleDateTime within a dialog. If you are interested in, I'll send you some code, but as I am an absolute beginner, I think this will not be new for you.
Ciao, Gerard
|
|
|
|
|
Hi Gerard.
I too am an "absolute beginner" so I appreciate all responses/suggestions/advise. I have mapped a CDateTimeCtrl to my date time picker but would be interested in seeing your code. Thank you.
Sande
|
|
|
|
|
Hallo sande,
I had the problem, that I used a COleDateTime-variable and was not able to format it like "MM-yyyy" or anything else. So I was suggested to use a CDateTimeCtrl, as you do, and to use the command
m_begin.SetFormat("MM-yyyy");
in the OnInitDialog().
Worked fine, but I was not able anymore, to get the entered values back where I wanted - thats been after
if (dialog.DoModal() == IDOK)
{
......
So I had to declare a variabe like this
public:
COleDateTime p_begin;
in my dialog and in my dialog.OnOk() I had to use
m_begin.GetTime(p_begin);
This works fine (with the only fault, that I don't know how to give the CDateTimeCtrl special starting-values) and I can use fuctions like
year.Format("%i", dialog.p_begin.GetYear());
after the OnOK().
Good luck, Gerard
-- modified at 15:17 Thursday 22nd June, 2006
|
|
|
|
|
We're using tons of bitmap buttons in our application, and I always wondered how people use the Resource editor to put those buttons and have them well aligned.
Since the Resource editor is working in DLU how do I know that the buttons align ?
Now, I have to do it manually, which seems to be counter-productive; placing one button and put all the rest in reference to that first one.
I know that if I put a Bitmap CStatic and assign it a bitmap, the control will use the size of the bitmap; is there such a thing for buttons ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote: We're using tons of bitmap buttons in our application
Maximilien wrote: which seems to be counter-productive
Yes it does. Perhaps a Usability Study and UI Design rework could be considered?
|
|
|
|
|
Are you wanting to know how to use the resource editor, or what guidelines to follow?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
yes and no, I know ( I think ) how to use the resource editor.
My problem now, is only (mostly) with CBitmapButton .
In MSDN, on the CBitmapButton page there is :
To include a bitmap-button control in a dialog box
1. Create one to four bitmap images for the button.
2. Create a dialog template with an owner-draw button positioned where you want the bitmap button. The size of the button in the template does not matter.
Yeah, cool, but heck the position and size are in DLUs not in pixel. I can only approximatly position and size the buttons in resource editor.
for example, I have a series of CBitmapButton buttons with bitmaps that are 40x40 pixels. How can I adjust the positions of each buttons ?
Or, for example, if I have a simple CButton with the BS_ICON or BS_BITMAP flag enable, I'd like to be able to see the bitmap in the button when designing the dialog.
I don't know if you understand what I'm trying to do ? or achieve ?
I know that the CBitmapButton does not seems to be fully supported, not the in palette of controls in the resource editor; and I can live with the fact that I need to do things manually.
My things are working, but it just seem like I'm doing too much; maybe it's the fact of life when doing UI that is not 100% window lookalike.
Thanks
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote: Yeah, cool, but heck the position and size are in DLUs not in pixel.
Right. I suppose exceptions to the rule exist, but I've never had the need to be concerned with pixels. DLUs are portable, pixels are not.
Maximilien wrote: I can only approximatly position and size the buttons in resource editor.
I think all you need to be concerned with is the top and left sides as the control will adjust its width/height accordingly.
Read here for more.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Please come to my forum. I need new people in my forum.
http://cppmasters.iphpbb.com
THX.
-:KNOX:-
|
|
|
|
|
Read #10 here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
come on knox, you know you're a looser... why linking your forum where the best programming questions are on CP
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|