# :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 WXOSX nor WXGTK 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. #
#