How to copy selection top left pixel values in Paint.Net

777 views Asked by At

Especially while I am working css sprites for my html mock ups, I am using Paint.Net to focus on selected icon and read left and top and also width and height pixel values. So I can use them in my CSS class.

Is there easy way to copy left and top values into my clipboard and I do not need to manually type every time?

Here is SS for my issue;

enter image description here

1

There are 1 answers

0
Jack L. On BEST ANSWER

Sorry, currently it is not possible.

I've tried to write a plugin for you, that copies mouse coordinates to clipboard, or show appropriate Messagebox, but it isn't possible as plugins cannot use C# 'using' keyword.

You can write to paint.net authors for your feature request- it would be very easy for them to add to the program

Anyway, the code would look like:

#region UICode
bool Amount1 = true; // [0,1] Copy to clipboard
bool Amount2 = false; // [0,1] Show popup
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();

    int a = System.Windows.Forms.Cursor.Position.X;
    // or int a = Selection.Left;
    int b = System.Windows.Forms.Cursor.Position.Y;
    // or int b = Selection.Top;

    if (Amount1)
    {
        Clipboard.SetText(a.ToString() + ", " + b.ToString());
    }

    if (Amount2)
    {
        MessageBox.Show(a.ToString() + ", " + b.ToString());
    }
}