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 […]
Tag: mfc
[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 Thunder seven form special effects, using DWM to achieve Aero Glass effect
Starting with Windows Vista, the Aero Glass effect is applied to Home Premium and above systems (Home Basic does not have this effect). This effect is controlled by DWM (Desktop Window Manager). For general programs, this effect will be applied to the window border by default. But if we want more control, such as making […]
[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 […]