private void AddImageInfo() { var path = Path.Combine(WindowUtility.MainForm.CurrentProjectDir, Path.Combine("Resource", treeView1.SelectedNode.FullPath)); if (!File.Exists(path)) { return; } try { using (Image image = Image.FromFile(path)) { AddInfo(Utility.Language["ImageKind"], GetImageFormatString(image.RawFormat)); AddInfo(Utility.Language["ImageWidth"], image.Width); AddInfo(Utility.Language["ImageHeight"], image.Height); AddInfo(Utility.Language["ImageHorizontalDPI"], image.HorizontalResolution); AddInfo(Utility.Language["ImageVerticalDPI"], image.VerticalResolution); foreach (PropertyItem propertyItem in image.PropertyItems) { string val = ""; switch (propertyItem.Type) { case 1: break; case 2: val = System.Text.Encoding.ASCII.GetString(propertyItem.Value); val = val.Trim(new char[] { '\0' }); break; case 3: var uint16Value = BitConverter.ToUInt16(propertyItem.Value, 0); val = uint16Value.ToString(); break; case 4: var uint32Value = BitConverter.ToUInt32(propertyItem.Value, 0); val = uint32Value.ToString(); break; } AddInfo(propertyItem.Id, val); } } var imagePanel = new ImagePanel(); imagePanel.OpenFile(path); ChangePanel(imagePanel); } catch (Exception e) { MessageBox.Show(e.Message); } }