Privacy policy. The GetStockObject function retrieves a handle to one of the stock pens, brushes, fonts, or palettes. It is not recommended that you employ this method to obtain the current font used by dialogs and windows. SystemParametersInfo will take into account the current theme and provides font information for captions, menus, and message dialogs.
Using a gray stock brush in any other style of window can lead to misalignment of brush patterns after a window is moved or sized. The origins of stock brushes cannot be adjusted. It is not necessary but it is not harmful to delete stock objects by calling DeleteObject. See Setting the Pen or Brush Color for an example of setting colors.
For an example, see Setting the Pen or Brush Color. Device Context Functions. A single bitmap cannot be selected into more than one DC at the same time. CreateFont , CreateFontIndirect. CreatePen , CreatePenIndirect. If the selected object is not a region and the function succeeds, the return value is a handle to the object being replaced.
If the selected object is a region and the function succeeds, the return value is one of the following values. If an error occurs and the selected object is not a region, the return value is NULL. This function returns the previously selected object of the specified type. An application should always replace a new object with the original, default object after it has finished drawing with the new object.
For an example, see Setting the Pen or Brush Color. Active Oldest Votes. Or am I wrong? The bitmap is not deleted on the DeleteObject call when it is selected on a DC.
And then the bitmap is deleted on the DeleteDC call. Roman: I agree, there is some undocumented magic happening. But if I were you, I would not want my code to depend on that magic because there's no guarantee it will continue to work in the future.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses.
Featured on Meta.
0コメント