Articles... Articles, Code, Downloads |
In this Section of the site, you can find brief introductory articles that describe the Source Code available to developers. You can download the code, modify it, and use it in your own applications. All the sources are freely available, with no restrictions, and can be recompiled however you see fit. Happy coding, everyone!
Inno Setup |
In this brief article I want to introduce Inno Setup, a Powerful and Versatile Installation Tool. Inno Setup is a Free and Open-Source Windows Installer developed by Jordan Russell and Martijn Laan. It was first released in 1997 and has since become one of the most popular installers in the world.
Let’s see what are the characteristics:
- Support for all file types, including executable files, library files, data files, etc.
- Support for all Windows operating systems, from Windows Vista onwards.
- Ability to create silent, custom, and network installations.
- Support for file compression, library registration, and font installation.
- Inno Setup is a very versatile tool that can be used to create installations of any type of software. It is particularly well-suited for creating custom software installations that need to meet specific needs.
More...
- It is free and open-source.
- It is very powerful and versatile.
- It is easy to learn and use.
- It is stable and reliable.
The Installer for the version of Speedcrypt is created using this tool. You can download the Source Code for the File I created for the Installation of Speedcrypt below:
Link: | Inno Script | Download: |
File : Speedcrypt.zip
MD5 : 84A70968 F37507FB 962369AF C275A966
SHA-1 : 08959C6F C5BFDD6D 40B38945 307194DA EA98C0B3
SHA-256 : F94C099F 6DDA0031 FA8B86A2 42869D52 24A3A4CC
A8BF487E 367F7C72 872E325E
Size : 1559 B
Generated by EasyHash
Once you have downloaded the Script I created, you only need to specify the Paths and the name of your Application. Clearly also the paths of the Files you want to include in your Setup, such as pre-installation, post-installation, and a License File. If you decide to use my script in your setups, a citation is greatly appreciated. Good Setup. Thank you all!.
XMLConfig |
In this brief article, I want to introduce the use of a configuration file in an application that needs to store settings and other program options. The source code generates a configuration file that you can configure and manipulate as follows:
- Inserting a key
- Changing a key
- Removing a key
- View the value of a key
- View the number of keys
In addition, the code proposes interaction of the configuration file with a ListView and other interesting options. You can enter your data through three text boxes, which are then combined into a single string that you can manipulate as you see fit.
Link: | c# language | Download: |
File : XMLConfig.zip
MD5 : CE1D80ED FA385F55 24F8FB79 9BBB43BC
SHA-1 : 1AE31F4A 9D00B3BA 0F175E47 98DBB18A 91D62B36
SHA-256 : 3D0804EF 899C5CD0 7E258789 6BD8E20D C7B7CEEF
D3ED8F24 626E7C59 C074A1EA
Size : 139922 B
Generated by EasyHash
A well-structured configuration file is the best alternative to the famous Properties.Settings proposed in Visual Studio, which I personally strongly advise against. With your own configuration file, you can make your application free from any constraints and create all the archives you want. If you have downloaded the Source of Speedcrypt, you can personally check all the power of a self-generated configuration file. Good configuration!
ListView Icon |
I take this opportunity, in this article, in addition to the example on how to implement icons in the various rows of a ListView, to illustrate the procedure necessary to be able to insert images via code into a resource file and subsequently into an ImageList. Nothing new, except that, starting from the version of Microsoft Visual Studio Community 2022 (64 bit) 17.11.2 and later (I'm personally working with version 17.11.3), the approach to Resource Files containing images and other has completely changed.
Just thinking about loading images into an ImageList by directly using the component via the "collection item" is scary, for various reasons, including the difficulty in finding and reusing the images by the developer who will reuse the code. Before the above versions, you just had to create the Resource Class and then simply fill it by dragging images or whatever. The code to load images into the Imagelist component was also pretty simple. Let's look at an example:
imageList2.Images.Add(Nuvola_22._22_editcopy);
imageList2.Images.Add(Nuvola_22._22_edittrash);
imageList2.Images.Add(Nuvola_22._22_window_list);
As you can see in the example, three .png images are loaded into the ImageList1 container through the Resource Class called Nuvola_22. For each single image only one line of code.
All in all, a rather simple and convenient procedure. Once the images have been uploaded, they will then be distributed, in order of insertion, to the various components that interface with the ImageList1 container. As mentioned, since version 17.11.2 everything has changed starting from how the various Resource Classes are set and displayed. You get used to it quickly, at least to the graphical setting, problems arise when it comes to storing images. Here is how they are encapsulated in a Byte Type Structure:
The image is then entrusted to the Windows Presentation Foundation (WPF) control and stored in the resource file that specifically belongs to the Nuvola_22 Class. Where does our problem lie?
Our problem, besides getting used to the new graphical interface and correctly interpreting the data flow, clearly lies in the fact that we need to update the code that will populate the ImageList1 container with our .png images, which we will use in various components. It's clear that we must absolutely stick to a single line of code for each image loaded into the container.
To achieve this, we need the Image.FromStream Method and the MemoryStream Class. Using the combination of these procedures, I composed the following code, meeting the set objectives and ensuring continuity with previous projects:
imageList1.Images.Add(Image.FromStream(new MemoryStream(Nuvola_16._16_package))); imageList1.Images.Add(Image.FromStream(new MemoryStream(Nuvola_16._16_date))); imageList1.Images.Add(Image.FromStream(new MemoryStream(Nuvola_16._16_kthememgr))); |
You will find the above-described example in the example named ListView Icon, which you can download and adapt to your applications. The example, in addition to implementing the procedure described above to correctly interact with various resource classes, illustrates some interesting techniques to execute the following procedures:
- Alternate row colors
- extract and display icon from a file
- Insert an icon for each column of the ListView
- Inserting Images into an ImageList Container via Code
In the image on the right, you can see a screenshot of the example, giving you an idea of how you can customize a ListView by adding icons to each column of the grid. In the example, all the columns have an icon, but you can clearly choose which columns you want to contain the image based on your needs and your project. Please note that the icon in the field named ID is extracted from the files you put in the list.
Below you can download the application with the source code keeping in mind that I made it with the latest version of Visual Studio that you can download at the following Web Address.
Link: | c# language | Download: |
File : ListView Icon.zip
MD5 : 4970E1CB 59B02CDC 61063703 DD88EBD3
SHA-1 : DD795327 EE92D72B 6220D1FE B14AB8B0 D10E80E3
SHA-256 : 31BCD525 CAF5A8CB A81A1186 E2D51E8A D4E6D645
63231DF1 D25C4880 8F55AF43
Size : 131072 B
Generated by EasyHash
I hope that the article and the related code will be useful to you. If that’s the case, please share it and make it available for as many people as possible to download. If you find my work interesting, don’t forget that you can also make a donation if you wish. This will help support my efforts. Thank you!