Code for a Coordinate Plane

• 11-13-2001
Isometric
Code for a Coordinate Plane
I am trying to program that will be able to do various transformations on a coordinate plane. But I am having 2 problems very early in the project. The first is what is the code to get the width/hight of a program. This will inturn be devided by two to get the halfway point for the Xand Y axi. The second problem is how can I designate the the hashmarks indication positions on the X and Y axis ( i.e. (0,1) and (1,0) ) without having them look like crap when they resize the program?
• 11-13-2001
zen
You'll have to trap the WM_SIZE message. For this message the low order WORD of LPARAM will contain the wdith and the high order WORD will contain the height.

I'm not sure what you mean in your second problem, but if you want to keep everything in proportion then you'll have to draw it in proportion. Something like one hash mark for every tenth of the size obtained by trapping the WM_SIZE (you have to store the values obtained in the WM_SIZE message in static variables).
• 11-13-2001
novacain
By code for getting the width / height of the program do you mean the functions

GetClientRect() or GetWindowRect()
or
iWidth =GetDeviceCaps(GetDC(NULL),HORZRES);
iHeight =GetDeviceCaps(GetDC(NULL),VERTRES);

for the screen area

I assume you are using a HDC and also a framebuffer. If the user resizes the client area try using StretchBlt() to shrink/expand the framebuffer bmp to fit the new size. If the proportions (x/y) change you will have to redraw the original though.
Try creating your HDC's/BMP's the same size as the max area (screen size usually). Have a function that draws based on the area sent to it. Call this in response to a WM_SIZE msg (pass it in the new size).
I usually work out the biggest area within the ClientRect that will retain the graphs proportion and then send that to my drawing function. This will leave some area blank though.