Prevent Flickering When Drawing
问题 So I have this code to draw a rectangle on my screen: LOGBRUSH m_LogBrush; HBRUSH m_hBrush; HPEN m_hPen; HDC m_hDC; void DrawBox(int x, int y, int r, int g, int b, int size, int thickness) { // Brush style to hollow m_LogBrush.lbStyle = BS_NULL; // Create a logical brush and select into the context m_hBrush = CreateBrushIndirect(&m_LogBrush); SelectObject(m_hDC, m_hBrush); // Create a logical pen and select into the context m_hPen = CreatePen(PS_SOLID, thickness, RGB(r, g, b)); SelectObject(m