Skip to content

Class Desktop

Kristian Virtanen edited this page Oct 14, 2024 · 8 revisions

Description:

The Desktop class enables retrieving the dimensions of the primary screen and allows setting the desktop wallpaper.

Example codes:

Methods:

  • Desktop.Width

  • Gets the width of the primary screen (desktop) in pixels.

  • Desktop.Height

  • Gets the height of the primary screen (desktop) in pixels.

  • Desktop.SetWallpaper(path_or_url)

  • Sets the desktop wallpaper to the specified file path or URL..

Top

Example code in SmallBasicOE:

TextWindow.WriteLine(Desktop.Width)
TextWindow.WriteLine(Desktop.Height)
Desktop.SetWallpaper("path_to_image")

Top

Example code in C#:

// Create an alias for the SmallBasicOpenEditionDll namespace
using SB = SmallBasicOpenEditionDll;

static class SB_Program
{
    static void Main()
    {
        dynamic sbUrl = "path_to_new_image";

        SB.TextWindow.WriteLine(SB.Desktop.Width);
        SB.TextWindow.WriteLine(SB.Desktop.Height);
        SB.Desktop.SetWallpaper(sbUrl);
    }
}

Top

Clone this wiki locally