Skip to content

Instantly share code, notes, and snippets.

@SQL-MisterMagoo
SQL-MisterMagoo / Explainer.md
Last active September 4, 2024 00:13
Get Windows Display By Convention - Numbered Top Left To Bottom Right

Windows Displays

...are likely/possibly numbered in the order they are detected - not necessarily in the order they appear in Settings or their physical order on your desk.

So, for example, it might seem natural to number your displays from top left to bottom right - just like reading a book.

This function GetDisplayByConvention() maps a number to a screen based on the Convention described above.

It gets AllScreens, orders them by Top, then by Left, skips the required number and returns the requested screen

@SQL-MisterMagoo
SQL-MisterMagoo / VS Caret Position To Screen.md
Last active October 24, 2024 14:18
Screen position from Caret Position in IWpfTextView
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

using Microsoft.VisualStudio.PlatformUI;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Formatting;