How to draw images etc. directly on windows
This article uses vs 2019 and .NET Framework 4.7.2 installed on windows 10.
Completed form
It feels like
You can also do this.
If you want the images to be about the same size
100px x 100px
Please prepare about.
Program.cs
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace ConsoleApp1
{
class Program
{
[DllImport("User32.dll")]
static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("User32.dll")]
static extern void ReleaseDC(IntPtr hwnd, IntPtr dc);
static void Main(string[] args)
{
Random rnd = new Random(); //Random instantiation
IntPtr desktopDC = GetDC(IntPtr.Zero);
using (Graphics g = Graphics.FromHdc(desktopDC))
{
//Create an Image object to draw to
Bitmap canvas = new Bitmap("Image path");
while (true)
{
//Create a Graphics object for the Image object
g.DrawImage(canvas, rnd.Next(0, 1920), rnd.Next(0, 1000));
}
}
}
}
}