我如何从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)) ...
-
获取像素颜色最快的方式?(Get Pixel color fastest way?)[2022-04-27]
我发现了一种比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 ... -
获取UIImage的像素颜色(Get Pixel color of UIImage)[2022-10-07]
您无法直接访问原始数据,但通过获取此图像的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: 获得色彩 ...
-
获取并设置像素的颜色(get and set color of pixel)[2024-02-16]
解决方案是将GL_UNSIGNED_BYTE更改为GL_FLOAT而不是从堆栈中pop项目 The solution is to change GL_UNSIGNED_BYTE to GL_FLOAT and not pop items from stack -
在实例中获取像素颜色(get pixel color in instance)[2023-12-19]
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 ... -
获取当前像素后面的像素(Get pixel behind the current pixel)[2022-04-17]
默认帧缓冲区仅保留最顶层的颜色。 要获得您建议的内容,需要特定的渲染管道。 例如,您可以: 创建与目标视口尺寸相同的屏幕外帧缓冲 将仅深度传递渲染到屏幕外帧缓冲区,将深度值存储在附加纹理中 使用特殊着色器重新渲染场景,该着色器仅绘制变换后Z值小于先前记录的深度缓冲区中的值的像素 最后一次渲染的最终结果应该是剥离顶层的原始场景。 编辑: 只需要少量新代码就可以创建屏幕外帧缓冲区,并为其渲染场景的深度版本,并且可以结合使用现有渲染管道来执行步骤1和2。 但是,我无法想到你可以在没有着色器的情况下重新渲染场景以获 ... -
为此,您可能必须创建自己的逻辑。 如果我得到这个权利,你可能想要做这样的事情, 创建一个方法以任何你想要的方式传递该区域,然后使用该方法 getPixel() 您可以获得该区域的颜色,并且很有可能会找到一种颜色或多种颜色的多种色调。 因此,基于此,您可以存储您获得的颜色列表,并且可以比较从数据库中获得的最多颜色,并为此编写逻辑。 我已经使用这个想法从屏幕上获取图标颜色,并使用该颜色编写文本,如android的NovaLauncher。 For this, you might have to create ...