[Handler(Screen.IHandler)] public class Screen : Widget
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.
handler (Screen.IHandler)Handler for the screen.

Properties

BitsPerPixel

#
public int BitsPerPixel { get; }
Gets the number of bits each pixel uses to represent its color value.

Bounds

#
public RectangleF Bounds { get; }
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.
The display's bounds.

ControlObject

public object ControlObject { get; }
Gets the instance of the platform-specific object
inherited fromWidget
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

#
public static RectangleF DisplayBounds { get; }
Gets the display bounds of all screens on the current system.

DPI

#
public float DPI { get; }
Gets the logical Dots/Pixels Per Inch of the screen.

Handler

public object Handler { get; }
Gets the platform-specific handler for this widget
inherited fromWidget

IsDisposed

public bool IsDisposed { get; }
Gets or sets a value indicating whether this Widget has been disposed.
inherited fromWidget
Remarks: When the widget is disposed, it can no longer be used.
true if this instance has been disposed; otherwise, false.

IsPrimary

#
public bool IsPrimary { get; }
Gets a value indicating whether this screen is the primary/main screen.

LogicalPixelSize

#
public float LogicalPixelSize { get; }
Gets the number of physical pixels per logical pixel of this display.
Remarks: On Retina/HighDPI displays, this will usually return 2.0, but can also be a fraction of pixels. Non-retina will return 1.0. This essentially returns the value of RealScale divided by Scale.
The number of physical pixels for each logical pixel.

NativeHandle

public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
inherited fromWidget

Platform

public Platform Platform { get; }
Gets the platform that was used to create the Widget.Handler for this widget
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object

PrimaryScreen

#
public static Screen PrimaryScreen { get; }
Gets the primary screen of the current system.
Remarks: This is typically the user's main screen.
The primary screen.

Properties

public PropertyStore Properties { get; }
Gets the dictionary of properties for this widget
inherited fromWidget

RealDPI

#
public float RealDPI { get; }
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.
The real DP.

RealScale

#
public float RealScale { get; }
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.
The real scale of pixels per point.

Scale

#
public float Scale { get; }
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.
The logical scale of pixels per point.

Screens

#
public static IEnumerable<Screen> Screens { get; }
Gets an enumerable of display screens available on the current system.

Style

public string Style { get; set; }
Gets or sets the style of this widget
inherited fromWidget
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.
// 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

#
public RectangleF WorkingArea { get; }
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.
The working area of the screen.

Methods

Dispose

protected virtual void Dispose(bool disposing)
Handles the disposal of this widget
inherited fromWidget
disposing (bool)True if the caller called Widget.Dispose() manually, false if being called from a finalizer

FromPoint

#
public static Screen FromPoint(PointF point)
Gets the screen that contains the specified point, or the closest screen to the point if it is outside the bounds of all screens.
point (PointF)Point to find the screen.
The screen encompassing or closest the specified point.

FromRectangle

#
public static Screen FromRectangle(RectangleF rectangle)
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..
rectangle (RectangleF)Rectangle to find the screen.
The screen encompassing or closest to the specified rectangle.

GetCallback

protected virtual object GetCallback()
Gets an instance of an object used to perform callbacks to the widget from handler implementations
inherited fromWidget
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.
The callback instance to use for this widget

GetImage

#
public Image GetImage(RectangleF rect)
Gets a copy of a portion of the screen as an image
rect (RectangleF)Rectangle to get the screen contents
A new image (Icon or Bitmap) representing the specified rectangle

Initialize

protected void Initialize()
Initializes the widget handler
inherited fromWidget
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.

OnStyleChanged

protected virtual void OnStyleChanged(EventArgs e)
Handles when the Widget.Style is changed.
inherited fromWidget

ToString

public override string ToString()
Gets a string that represents the current object with its ID if specified.
inherited fromWidget
A string value indicating the type and ID (if specified) of this widget.
Object.ToString

Events