09-21-2022, 03:48 PM
(09-19-2022, 01:05 PM)Spriggsy Wrote:(09-18-2022, 08:28 PM)madscijr Wrote:Drawing Rectangles - Win32 apps | Microsoft Learn (searched "draw rectangle msdn win32")(09-18-2022, 08:17 PM)Spriggsy Wrote: I would just Google some of the drawing functions for Windows. Google is good at finding MSDN pages.
Thanks, Spriggsy.
I did some reading, which led to more reading, and so on and so on. Too much information!
Figuring out how to put all this together is not so simple.
If there is a simple example hidden in there of drawing a rectangle of color(r,g,b) & length/width on the screen at x/y, I haven't found it yet.
I realize that being self-directed in learning is an important skill in life, and especially programming, but jeez louise
I knew there is a reason I prefer BASIC, LOL.
I'll have to return to this stuff when I have more time and bandwidth.
Stay tuned!
- Using Filled Shapes 01/07/2021
- FillRect function (winuser.h) 10/13/2021
- Creating Colored Pens and Brushes 01/07/2021
- GetSysColorBrush function (winuser.h) 10/13/2021
A brush is a bitmap that the system uses to paint the interiors of filled shapes.
- RGB macro (wingdi.h) 04/01/2021
- Rectangle function (wingdi.h) 10/13/2021
- Setting the Pen or Brush Color 01/07/2021
- Using the WM_PAINT Message - Win32 apps 01/07/2021
You can use the WM\_PAINT message to carry out the drawing necessary for displaying information.
- CreateHatchBrush
- CreatePatternBrush
- CreateSolidBrush function (wingdi.h)
CreateSolidBrush ( GetSysColor (nIndex)). An application must not register a window class for a window using a system brush. To register a window class with a system color, see the documentation of the hbrBackground member of the WNDCLASS or WNDCLASSEX structures. To paint with a system color brush, an application should use GetSysColorBrush (nIndex) instead of CreateSolidBrush.
- Filled Shape Functions
- Filled Shapes Overview
- GetStockObject
- RECT
- PAINTSTRUCT (winuser.h) - Win32 apps
The PAINTSTRUCT structure contains information for an application. This information can be used to paint the client area of a window owned by that application.
- Drawing in the Client Area - Win32 apps
You use the BeginPaint and EndPaint functions to prepare for and complete the drawing in the client area.
- MoveToEx function (wingdi.h) - Win32 apps
The MoveToEx function updates the current position to the specified point and optionally returns the previous position.
- Creating Colored Pens and Brushes - Win32 apps
Although you can specify any color for a pen when creating it, the system uses only colors that are available on the device.
- Invalidating the Client Area - Win32 apps
The system is not the only source of WM\_PAINT messages. The InvalidateRect or InvalidateRgn function can indirectly generate WM\_PAINT messages for your windows. These functions mark all or part of a client area as invalid (that must be redrawn).
- CreateRectRgn function (wingdi.h) - Win32 apps
The CreateRectRgn function creates a rectangular region.
- Using Rectangles (Windows GDI) - Win32 apps
The example in this section illustrates how to use the rectangle functions. It consists of the main window procedure from an application that enables the user to move and size a bitmap.
- DeleteObject
System color brushes are owned by the system so you don't need to destroy them. Although you don't need to delete the logical brush that GetSysColorBrush returns, no harm occurs by calling
- Brush Functions
- Brushes Overview
- GetSysColor function
For system color index values. An application can retrieve the current system colors by calling this. To paint with a system color brush, an application should use GetSysColorBrush (nIndex) instead of CreateSolidBrush, because GetSysColorBrush returns a cached brush instead of allocating a new one.
- SetSysColors function
An application can set the current system colors by calling this.
- WNDCLASS
- WNDCLASSEX structure
An application must not register a window class for a window using a system brush. To register a window class with a system color, see the documentation of the hbrBackground member of the WNDCLASS or WNDCLASSEX structures.
- COLORREF
- Color Macros
- Colors Overview
- GetBValue
- GetGValue
- GetRValue
- PALETTEINDEX
- PALETTERGB
- RGBQUAD
- RoundRect
- WM_PAINT message
to carry out the drawing necessary for displaying information. Because the system sends WM_PAINT messages to your application when your window must be updated or when you explicitly request an update, you can consolidate the code for drawing in your application's window procedure.
- Drawing in the Client Area
- Redrawing the Entire Client Area
- Redrawing in the Update Region
- Invalidating the Client Area
- Drawing a Minimized Window
- Drawing a Custom Window Background