Computer graphics experiment – using MFC dialog box to realize polygon drawing and filling (scan line filling algorithm) with source code

Content summary: Utilizing dialog-based MFC projects Implement mouse click to draw polygons Implement scanline algorithm to fill polygons For the source code, see Yushan-Ji/ComputerGraphics: ECNU2023 Fall Computer Graphics Course Experiment Code (github.com) Experimental content Polygon input via mouse interaction Fill various polygons, including boundary self-intersections Algorithm description Polygon drawing Use the OnLButtonDown and OnRButtonDown functions […]

MFC—Windows Message Mechanism

Why learn MFC If you are doing GUI development on the Windows platform, MFC (Microsoft Basic Class Library) is a good choice. After all, Windows has a huge accumulated user base and high market acceptance. However, learning MFC not only requires learning to use MFC, but also learning the framework design ideas of MFC. Many […]

[Medical Imaging Principle Experiment – CT Reconstruction] 1. Generate shepp-logan model (C++ (VS MFC) and matlab)

1. Principle (parameters) I thought the book was right, so I took a screenshot of the picture in the book (I didn’t know which book it was…). To put it simply, it was to use 10 ellipse simulation head models. Ellipse parameters in the head model Serial number Center coordinates Major axis Minor axis Rotation […]

3. Example of using C++/MFC to call hiredis library to operate redis under Windows

1. Header file directory Copy the previously downloaded and compiled Redis directory to the newly created project directory, then right-click/Properties of the test project, click C++/General, add the following path to the additional include directory. Note that if there are multiple paths originally, add Add a semicolon at the end and paste: Click on C++/General, […]

[Transfer] CEvent of MFC

Event is used to synchronize different threads. Once a thread ends its use of a global resource, it notifies others that it is available for use by calling SetEvent. If this is deleted, other threads will be blocked When ::WaitForSingleObject(pEvent->m_hObject, INFINITE); is called in a thread, it will wait on this sentence without proceeding. At […]

[Transfer] OPenGL MFC drawing

1. Introduction GDI draws through the device handle (Device Context, hereinafter referred to as “DC”), while OpenGL requires a drawing environment (Rendering Context, hereinafter referred to as “RC”). Each GDI command requires a DC to be passed to it, but unlike GDI, OpenGL uses the current drawing context (RC). Once a current RC is specified […]

MFC form registration WNDCLASS

//Initialization //Initialization includes four parts: definition of window class, registration, creation of window instance and display of window { HWND hwnd; MSG Msg; WNDCLASS wndclass; char lpszClassName[]=”Window”;//Window class name char lpszTitle[]=”Xu Xinpo”; //Window title name //Window class definition //The window class defines the form and function of the window. The window class definition is completed […]

[Transfer] Dragging of MFC borderless windows

Dragging borderless windows in MFC void CXXXXDialog::OnLButtonDown(UINT nFlags, CPoint point) { PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y)); } Remember to add message mapping, otherwise this code will not work. change: Moving a standard window is achieved by clicking the window title bar with the mouse, but for a window without a title bar, you need to use […]

[Transfer] MFC CListCtrl usage tips

The following is not explained. The default view style of listctrl is report. Related classes and processing functions MFC: CListCtrl class SDK: Some macros starting with “ListView_”. Such as ListView_InsertColumn 1. CListCtrl style LVS_ICON: Display a large icon for each item LVS_SMALLICON: Display a small icon for each item LVS_LIST: Displays a list of items […]