QIconLibrary Documentations

IconFileReader

Constructors

  Name Description
IconFileReader() Initializes new instance of the IconFileReader class

IconFileReader Properties

  Name Description
Qicon ExtractIcon(string filePath) Loads .ico file from drive and returns a QIcon
QIcon[] ExtractIconsFromResource(string filePath) Loads & Extracts all .ico files from a resource file and returns a QIcon array

IconFileWriter

Constructors

  Name Description
IconFileWriter() Initializes new instance of the IconFileWriter class

IconFileWriter Properties

  Name Description
bool Save(QIcon icon, string filePath) Saves QIcon to drive and returns a status boolean

QIcon Code Example
QIcon contains your icon images
QIcon is also a wrapper for both IconFileReader & IconFileWriter


  //
  // CREATE NEW ICON WITH IMAGES
  //

  // create new Qicon
  QIcon icon = new QIcon();

  // load QImage from filepath on drive
  QImage image256 = QImage.LoadQImageFromFile("C:\\Users\\Thoosje\\Images\\image256x256.png");
  // add QImage to icon
  icon.Add(image256);

  // load QImage from filepath on drive
  QImage image128 = QImage.LoadQImageFromFile("C:\\Users\\Thoosje\\Images\\image128x128.png");
  // add QImage to icon
  icon.Add(image128);

  // save QIcon to filepath on drive
  icon.Save("C:\\Users\\Thoosje\\Images\\MyIcon.ico");

  //
  // EXTRACT & UPDATE ICON FROM FILE
  //

  // extract icon from dile on disk
  QIcon icon = QIcon.OpenFile("C:\\Users\\Thoosje\\Images\\MyIcon.ico");

  // load QImage from filepath on drive
  QImage image64 = QImage.LoadQImageFromFile("C:\\Users\\Thoosje\\Images\\image64x64.png");
  // add QImage to icon
  icon.Add(image64);

  // save QIcon to filepath on drive
  icon.Save("C:\\Users\\Thoosje\\Images\\MyIcon.ico");
  

IconFileReader Example


  // create & initialize IconFileReader
  IconFileReader iconFileReader = new IconFileReader();

  // extract icon from dile on disk
  QIcon icon = iconFileReader.ExtractIcon("C:\\Users\\Thoosje\\Images\\MyIcon.ico");
  // extract all icons from resource file on disk
  QIcon[] iconsFromResource = iconFileReader.ExtractIconsFromResource("C:\\Windows\\System32\\imageres.dll");
  

IconFileWriter Example


  // create & initialize IconFileReader
  IconFileReader iconFileReader = new IconFileReader();
  // extract icon from dile on disk
  QIcon icon = iconFileReader.ExtractIcon("C:\\Users\\Thoosje\\Images\\MyIcon.ico");

  // create & initialize IconFileReader
  IconFileWriter iconFileWriter = new IconFileWriter();
  // write icon to filepath on disc
  iconFileWriter.Save(icon, "C:\\Users\\Thoosje\\Images\\MyIconBackup.ico");