WIN32 GDI question
How would I set the point on the window in win32api to let say draw a rectangle at 100, 100? With the old GDI functions I could have used _moveto(100, 100) and then drawn a rectangle. I don''t see this in the new GDI functions?
Please forgive me! =)
Check and see if this is correct?
POINT point;
point.x = 0;
point.y = 0;
MoveToEx(hdc, 500, 500, &point);
This would set the drawing piont on the screen to x = 500 and y = 500. Now why is it when I draw a rectangle or ellipse it always starts in the top left corner? How do I go about moving it to where ever I want it to start drawing at. e.g. Move the normal 0,0 to new 0,0 at 500, 500? Then draw a rectanlge or ellipse?
So my next question is how does one set the videomode in a window. e.g. 640x480 or 800x600 or 1024x768 and then set the color depth to 16.7 million or whatever you like it to be? I would like to have the person be able to select these types of screen resolutions from a table. In the old GDI I used _setvideomode(some mode).
Now with a window already have been defined in the
CreateWindowEx() I have it set to 1024x768 so would changing the videomode do any good?
Please forgive me! =)
Edited by - MARS_999 on June 7, 2001 10:03:28 PM
POINT point;
point.x = 0;
point.y = 0;
MoveToEx(hdc, 500, 500, &point);
This would set the drawing piont on the screen to x = 500 and y = 500. Now why is it when I draw a rectangle or ellipse it always starts in the top left corner? How do I go about moving it to where ever I want it to start drawing at. e.g. Move the normal 0,0 to new 0,0 at 500, 500? Then draw a rectanlge or ellipse?
So my next question is how does one set the videomode in a window. e.g. 640x480 or 800x600 or 1024x768 and then set the color depth to 16.7 million or whatever you like it to be? I would like to have the person be able to select these types of screen resolutions from a table. In the old GDI I used _setvideomode(some mode).
Now with a window already have been defined in the
CreateWindowEx() I have it set to 1024x768 so would changing the videomode do any good?
Please forgive me! =)
Edited by - MARS_999 on June 7, 2001 10:03:28 PM
The truth is that the upper-left corner is ALWAYS the first poing you specify when drawing a rectangle. It all depends on how your code handles mouse coordinates. If the mouse position is above and to the left of the rectangle start, make the MOUSE POSITION the upper-left starting point and the old start the lower-right. If the mouse is below and to the right of the starting point, then keep the starting point the same and say the mouse position is the ending lower-right poing. Basically, switch which point data is the "upper-left" depending on the relation of the mouse to the initial point.
Lastly, you can''t set the video mode of only a specific window: you have to change the entire screen. Window sized are specified in pixels, so if your screen is already at 1024x768 then making a window that big would fill your screen. You can change the actual settings of the video mode with the ChangeDisplaySettings(...); function. Now if you mean you want to change the logical mapping of the window, thats up to your code to calculate and scale of each pixel and move it to its correct location. I don''t think there are any Win32 functions that do that for you, but I could be wrong.
Lastly, you can''t set the video mode of only a specific window: you have to change the entire screen. Window sized are specified in pixels, so if your screen is already at 1024x768 then making a window that big would fill your screen. You can change the actual settings of the video mode with the ChangeDisplaySettings(...); function. Now if you mean you want to change the logical mapping of the window, thats up to your code to calculate and scale of each pixel and move it to its correct location. I don''t think there are any Win32 functions that do that for you, but I could be wrong.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement