# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # {Wx::ClientDC} is primarily useful for obtaining information about the window from outside EVT_PAINT() handler. # Typical use of this class is to obtain the extent of some text string in order to allocate enough size for a window, e.g. # ```ruby # # Create the initially empty label with the size big enough to show # # the given string. # text = Wx::ClientDC.draw_on(self) do |dc| # Wx::StaticText.new( # self, Wx::ID_ANY, "", # Wx::Point.new, # dc.get_text_extent("String of max length"), # Wx::ST_NO_AUTORESIZE) # end # ``` # # While {Wx::ClientDC} may also be used for drawing on the client area of a window from outside an EVT_PAINT() handler in some ports, this does not work on all platforms (neither {Wx::OSX} nor {Wx::GTK} with GTK 3 Wayland backend support this, so drawing using {Wx::ClientDC} simply doesn't have any effect there) and the only portable way of drawing is via {Wx::PaintDC}. To redraw a small part of the window, use {Wx::Window#refresh_rect} to invalidate just this part and check {Wx::Window#get_update_region} in the paint event handler to redraw this part only. # # {Wx::ClientDC} objects should normally be constructed as temporary stack objects, i.e. don't store a {Wx::ClientDC} object. # A {Wx::ClientDC} object is initialized to use the same font and colours as the window it is associated with. # === # # Category: Device Contexts # @see Wx::DC # @see Wx::MemoryDC # @see Wx::PaintDC # @see Wx::WindowDC # @see Wx::ScreenDC # # # # @note This class is untracked and should not be derived from nor instances extended! class ClientDC < WindowDC end # ClientDC end