首页 \ 问答 \ 我如何从TortoiseHg获得完整版本?(How can I get a complete version from TortoiseHg)

我如何从TortoiseHg获得完整版本?(How can I get a complete version from TortoiseHg)

我使用TortoiseHg作为我的源代码控件来开发用.NET / C#编写的CMS项目。 我不知道如何从源代码库获取完整版本。 可能吗? 指定日期的版本。

谢谢。


I am using TortoiseHg as my source control for developing a CMS project written in .NET/C#. I don't know how can I get a whole complete version from my source repository. Is it possible? a version for a specified date.

Thank you.


原文:https://stackoverflow.com/questions/1458619
更新时间:2022-08-07 22:08

最满意答案

using System;
using System.Drawing;
using System.Runtime.InteropServices;

sealed class Win32
{
    [DllImport("user32.dll")]
    static extern IntPtr GetDC(IntPtr hwnd);

    [DllImport("user32.dll")]
    static extern Int32 ReleaseDC(IntPtr hwnd, IntPtr hdc);

    [DllImport("gdi32.dll")]
    static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos);

    static public System.Drawing.Color GetPixelColor(int x, int y)
    {
       IntPtr hdc = GetDC(IntPtr.Zero);
       uint pixel = GetPixel(hdc, x, y);
       ReleaseDC(IntPtr.Zero, hdc);
       Color color = Color.FromArgb((int)(pixel & 0x000000FF),
                    (int)(pixel & 0x0000FF00) >> 8,
                    (int)(pixel & 0x00FF0000) >> 16);
       return color;
    }
}

使用此功能,您可以执行以下操作:

public static class ControlExts
{
    public static Color GetPixelColor(this Control c, int x, int y)
    {
        var screenCoords = c.PointToScreen(new Point(x, y));
        return Win32.GetPixelColor(screenCoords.X, screenCoords.Y);
    }
}

所以,在你的情况下你可以这样做:

var desiredColor = myForm.GetPixelColor(10,10);

using System;
using System.Drawing;
using System.Runtime.InteropServices;

sealed class Win32
{
    [DllImport("user32.dll")]
    static extern IntPtr GetDC(IntPtr hwnd);

    [DllImport("user32.dll")]
    static extern Int32 ReleaseDC(IntPtr hwnd, IntPtr hdc);

    [DllImport("gdi32.dll")]
    static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos);

    static public System.Drawing.Color GetPixelColor(int x, int y)
    {
       IntPtr hdc = GetDC(IntPtr.Zero);
       uint pixel = GetPixel(hdc, x, y);
       ReleaseDC(IntPtr.Zero, hdc);
       Color color = Color.FromArgb((int)(pixel & 0x000000FF),
                    (int)(pixel & 0x0000FF00) >> 8,
                    (int)(pixel & 0x00FF0000) >> 16);
       return color;
    }
}

Using this, you can then do:

public static class ControlExts
{
    public static Color GetPixelColor(this Control c, int x, int y)
    {
        var screenCoords = c.PointToScreen(new Point(x, y));
        return Win32.GetPixelColor(screenCoords.X, screenCoords.Y);
    }
}

So, in your case you can do:

var desiredColor = myForm.GetPixelColor(10,10);

相关问答

更多
  • 因为我面临类似的问题,所以有一点搜索引导我到这里。 你的代码工作正常。 问题可能会从您的图像中提出。 码: //On the top of your swift extension UIImage { func getPixelColor(pos: CGPoint) -> UIColor { let pixelData = CGDataProviderCopyData(CGImageGetDataProvider(self.CGImage)) ...
  • 我发现了一种比GetPixel更快的完美方式: HDC hdc, hdcTemp; RECT rect; BYTE* bitPointer; int x, y; int red, green, blue, alpha; while(true) { hdc = GetDC(HWND_DESKTOP); GetWindowRect(hWND_Desktop, &rect); int MAX_WIDTH = rect.right; int MAX_HEIG ...
  • 您无法直接访问原始数据,但通过获取此图像的CGImage可以访问它。 这里是一个链接到另一个问题,回答您的问题和其他您可能有关详细的图像处理: CGImage You can't access the raw data directly, but by getting the CGImage of this image you can access it. here is a link to another question that answers your question and others you ...
  • 最后我修复了这个问题并发表了一篇文章来解释这个,你可以达到这个目的 Finally I fixed this problem and post an article to explain this, you can reach at this
  • 你不应该试图“获得像素的颜色”。 处理棋盘的逻辑知道棋盘布局是什么以及它着色的像素,所以它应该保留足够的这些信息,以便它可以分辨出被点击的方块。 执行此操作的OOP方法是:定义一个类Chessboard其目的是表示在窗口中绘制的棋盘(或Swing组件,或其他)。 应该有一种绘制棋盘的方法; 该方法将跟踪用于绘制每个方块的像素范围。 (由于每个正方形可能具有相同的高度和宽度,因此您实际上不需要保留像素坐标数组;仅保留棋盘左上角的坐标就足够了,您将添加类似width * columnNumber或height ...
  • C ++ SetPixel和GetPixel函数 window.h库的一部分 将Pixel设置为与颜色一致的coords COLORREF SetPixel( _In_ HDC hdc, _In_ int X, _In_ int Y, _In_ COLORREF crColor ); 返回指定坐标处的像素颜色 COLORREF GetPixel( _In_ HDC hdc, _In_ int nXPos, _In_ int nYPos ); SDL: 获得色彩 ...
  • 解决方案是将GL_UNSIGNED_BYTE更改为GL_FLOAT而不是从堆栈中pop项目 The solution is to change GL_UNSIGNED_BYTE to GL_FLOAT and not pop items from stack
  • using System; using System.Drawing; using System.Runtime.InteropServices; sealed class Win32 { [DllImport("user32.dll")] static extern IntPtr GetDC(IntPtr hwnd); [DllImport("user32.dll")] static extern Int32 ReleaseDC(IntPtr hwnd, IntPtr ...
  • 默认帧缓冲区仅保留最顶层的颜色。 要获得您建议的内容,需要特定的渲染管道。 例如,您可以: 创建与目标视口尺寸相同的屏幕外帧缓冲 将仅深度传递渲染到屏幕外帧缓冲区,将深度值存储在附加纹理中 使用特殊着色器重新渲染场景,该着色器仅绘制变换后Z值小于先前记录的深度缓冲区中的值的像素 最后一次渲染的最终结果应该是剥离顶层的原始场景。 编辑: 只需要少量新代码就可以创建屏幕外帧缓冲区,并为其渲染场景的深度版本,并且可以结合使用现有渲染管道来执行步骤1和2。 但是,我无法想到你可以在没有着色器的情况下重新渲染场景以获 ...
  • 为此,您可能必须创建自己的逻辑。 如果我得到这个权利,你可能想要做这样的事情, 创建一个方法以任何你想要的方式传递该区域,然后使用该方法 getPixel() 您可以获得该区域的颜色,并且很有可能会找到一种颜色或多种颜色的多种色调。 因此,基于此,您可以存储您获得的颜色列表,并且可以比较从数据库中获得的最多颜色,并为此编写逻辑。 我已经使用这个想法从屏幕上获取图标颜色,并使用该颜色编写文本,如android的NovaLauncher。 For this, you might have to create ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)