Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在Windows窗体中获取属性ID_C#_Properties_Winforms - Fatal编程技术网

C# 在Windows窗体中获取属性ID

C# 在Windows窗体中获取属性ID,c#,properties,winforms,C#,Properties,Winforms,我在参考资料中有图像,我想获取它们的ID。 我觉得MSDN中的以下代码没有多大帮助 它是怎么得到20624和20625的 如果我可以通过Properties.Resources.Image1访问图像,如何通过编程获取其ID private void DemonstratePropertyItem(PaintEventArgs e) { // Create two images. Image image1 = Image.FromFile("c:\\FakePhoto1.jpg"

我在参考资料中有图像,我想获取它们的ID。 我觉得MSDN中的以下代码没有多大帮助

它是怎么得到20624和20625的

如果我可以通过
Properties.Resources.Image1
访问图像,如何通过编程获取其ID

private void DemonstratePropertyItem(PaintEventArgs e)
{

    // Create two images.
    Image image1 = Image.FromFile("c:\\FakePhoto1.jpg");
    Image image2 = Image.FromFile("c:\\FakePhoto2.jpg");

    // Get a PropertyItem from image1.
    PropertyItem propItem = image1.GetPropertyItem(20624);

    // Change the ID of the PropertyItem.
    propItem.Id = 20625;

    // Set the PropertyItem for image2.
    image2.SetPropertyItem(propItem);

    // Draw the image.
    e.Graphics.DrawImage(image2, 20.0F, 20.0F);
}
MSDN提供了一个及其相应的标签

在您的示例中,20624(0x5090)是
PropertyTagLuminanceTable
,20625(0x5091)是
PropertyTagChrominanceTable

编辑: 请注意,这些ID不是用来访问图像本身,而是用来访问有关图像的元数据。

MSDN提供了一个元数据及其相应的标记

在您的示例中,20624(0x5090)是
PropertyTagLuminanceTable
,20625(0x5091)是
PropertyTagChrominanceTable

编辑:
请注意,这些ID不是用来访问图像本身,而是用来访问图像的元数据。

我完全误解了propertyitem ID的用途。我认为id标识了图像,我可以使用int propId检索它们。谢谢。我完全误解了propertyitem ID的用途。我认为id标识了图像,我可以使用int propId检索它们。谢谢