如何在Paint.Net中复制选择左上角的像素值

时间:2012-08-01 14:40:32

标签: pixels paint.net

特别是当我为我的html模拟器工作css sprites时,我使用Paint.Net专注于所选图标并读取左上角和顶部以及宽度和高度像素值。所以我可以在CSS课程中使用它们。

有没有简单的方法可以将左侧和上方的值复制到我的剪贴板中,而且我不需要每次都手动输入?

这是我的问题SS;

enter image description here

1 个答案:

答案 0 :(得分:2)

抱歉,目前无法做到。

我尝试为您编写插件,将鼠标坐标复制到剪贴板,或显示相应的Messagebox,但由于插件无法使用C#'using'关键字,因此无法实现。

您可以写一下paint.net作者的功能请求 - 他们很容易添加到程序中

无论如何,代码看起来像:

#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());
    }
}
相关问题