A simple MFC (Microsoft Foundation Classes) application for creating and managing rectangles by clicking two points.
This is a Windows application built with MFC that allows users to create rectangles interactively by clicking two points on the screen. The application supports creating multiple rectangles and deleting them by right-clicking.
- Create Rectangles: Click two points with the left mouse button to create a rectangle
- First click sets the first corner point
- Second click sets the opposite corner point and creates the rectangle
- Delete Rectangles: Right-click on a rectangle to delete it
- Multiple Rectangles: Support for up to 30 rectangles simultaneously
- OpenGL Support: OpenGL context is initialized (available for future enhancements)
-
Create a Rectangle:
- Click the left mouse button at the first corner position
- Click the left mouse button again at the opposite corner position
- A rectangle will be drawn between these two points
-
Delete a Rectangle:
- Right-click anywhere inside a rectangle
- The rectangle will be removed from the screen
- Microsoft Visual C++ (MFC)
- Windows operating system
- OpenGL libraries (for context initialization)
GlmfcnView.cpp/h- View class handling drawing and mouse eventsOnDraw()- Renders all rectanglesOnLButtonDown()- Handles rectangle creationOnRButtonDown()- Handles rectangle deletion
GlmfcnDoc.cpp/h- Document class storing rectangle datarectangles[30]- Array storing up to 30 rectanglesrectanglesCount- Current number of rectangleshasFirstPoint- Flag indicating if first point is setfirstPoint- Coordinates of the first click point
Glmfcn.cpp/h- Main application class
- Open the project in Visual Studio
- Build the solution (Build → Build Solution)
- Run the application (Debug → Start Debugging or F5)
- Rectangles are stored in a fixed-size array of
CRectobjects - Maximum capacity: 30 rectangles
- Each rectangle is defined by two corner points
- Uses GDI (Graphics Device Interface) for rendering
- Rectangles are drawn with system button face color brush
- Double buffering is not implemented for GDI drawing
- OpenGL context is initialized but not currently used for rendering
- Available for future 3D graphics enhancements
This project is part of a computer graphics course work.