Represents a display on the system.
Constructors
Screen
#public Screen(IHandler handler)
Initializes a new instance of the Screen class with the specified
handler.Remarks: Used by platform implementations to create instances of a screen with a particular handler.
Parameters:
| handler (Screen.IHandler) | Handler for the screen. |
Properties
BitsPerPixel
#Gets the number of bits each pixel uses to represent its color value.
Value: The screen's bits per pixel.
Bounds
#Gets the bounds of the display in the DisplayBounds area.
Remarks: The primary screen's upper left corner is always located at 0,0. A negative X/Y indicates that the screen location is to the left or top of the primary screen. A positive X/Y indicates that the screen location is to the right or bottom of the primary screen.
Value: The display's bounds.
Remarks: This can sometimes be useful to get the platform-specific object. Some handlers may not have any backing object for its functionality, so this may be null. It is more preferred to use the Widget.Handler and cast that to the platform-specific handler class which can give you additional methods and helpers to do common tasks. For example, the Application object's handler for OS X has a AddFullScreenMenuItem property to specify if you want full screen support in your app.
DisplayBounds
#Gets the display bounds of all screens on the current system.
Value: The display bounds of all screens.
IsDisposed
Gets or sets a value indicating whether this Widget has been disposed.
Remarks: When the widget is disposed, it can no longer be used.
Value:
true if this instance has been disposed; otherwise, false.IsPrimary
#Gets a value indicating whether this screen is the primary/main screen.
Value:
true if this is the primary screen; otherwise, false.LogicalPixelSize
#Gets the number of physical pixels per logical pixel of this display.
NativeHandle
public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object
PrimaryScreen
#Gets the primary screen of the current system.
Remarks: This is typically the user's main screen.
Value: The primary screen.
RealDPI
#Gets the real Dots/Pixels Per Inch of the screen, accounting for retina displays.
Remarks: This is similar to DPI, however will give you the 'real' DPI of the screen. For example, a Retina display on OS X will have the RealDPI twice the DPI reported.
Value: The real DP.
RealScale
#Gets the real scale of the pixels of the screen vs. points.
Remarks: The scale can be used to translate points to 'real' pixels. E.g.
var pixels = points * screen.Scale; This is useful when creating fonts that need to be a certain pixel size. Since this is a real scale, this will give you the actual pixel size. This means on retina displays on OS X will appear to be half the physical size as regular displays.Value: The real scale of pixels per point.
Scale
#Gets the logical scale of the pixels of the screen vs. points.
Remarks: The scale can be used to translate points to pixels. E.g.
var pixels = points * screen.Scale; This is useful when creating fonts that need to be a certain pixel size. Since this is a logical scale, this will give you the 'recommended' pixel size that will appear to be the same physical size, even on retina displays.Value: The logical scale of pixels per point.
Screens
#Gets an enumerable of display screens available on the current system.
Value: The screens of the current system.
Remarks: Styles allow you to attach custom platform-specific logic to a widget. In your platform-specific assembly, use Add{H} to add the style logic with the same id.
Example:
// in your UI
var control = new Button { Style = "mystyle" };
// in your platform assembly
using Eto.Mac.Forms.Controls;
Styles.AddHandler<ButtonHandler>("mystyle", handler => {
// this is where you can use handler.Control to set properties, handle events, etc.
handler.Control.BezelStyle = NSBezelStyle.SmallSquare;
});WorkingArea
#Gets the working area of the display, excluding any menu/task bars, docks, etc.
Remarks: This is useful to position your window in the usable area of the screen.
Value: The working area of the screen.
Methods
Dispose
public void Dispose()
Disposes of this widget, supressing the finalizer
Parameters:
| disposing (bool) | True if the caller called Widget.Dispose() manually, false if being called from a finalizer |
FromPoint
#Gets the screen that contains the specified
point, or the closest screen to the point if it is outside the bounds of all screens.Parameters:
| point (PointF) | Point to find the screen. |
Returns: The screen encompassing or closest the specified point.
FromRectangle
#Gets the screen that encompases the biggest part of the specified
rectangle, or the closest screen to the rectangle if it is outside the bounds of all screens..Parameters:
| rectangle (RectangleF) | Rectangle to find the screen. |
Returns: The screen encompassing or closest to the specified rectangle.
GetCallback
Gets an instance of an object used to perform callbacks to the widget from handler implementations
Remarks: The callback should implement the parent class' Widget.ICallback interface so that there only needs to be a single callback for the entire hierarchy. This should return a static instance to avoid having overhead for each instance of your control.
Returns: The callback instance to use for this widget
GetImage
#Gets a copy of a portion of the screen as an image
Parameters:
| rect (RectangleF) | Rectangle to get the screen contents |
Returns: A new image (Icon or Bitmap) representing the specified rectangle
Initialize
protected void Initialize()
Initializes the widget handler
Remarks: This is typically called from the constructor after all of the logic is completed to construct the object. If your handler interface has the AutoInitializeAttribute set to false, then you are responsible for calling this method in your constructor after calling the creation method on your custom handler.
inherited fromWidget
ToString
Gets a string that represents the current object with its ID if specified.
Returns: A string value indicating the type and ID (if specified) of this widget.
Overrides: Object.ToString
Events
inherited fromWidget