Im trying to print (show in screen ) a screenshot on my main monitor , I think I’ve got all the necessary variables to make that happen but I have no clue how to get past
I have a very good solution, but you need to calculate the position and sizing for your stuff. Unfortunately, I have not figured out how to draw an img to screen yet.
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
namespace DIRECTDRAW
{
class Program
{
[DllImport("user32.dll")]
static extern IntPtr GetDC(IntPtr hwnd);
static void draw(Rectangle r, Brush b, IntPtr hwnd)
{
using (Graphics g = Graphics.FromHdc(hwnd))
{
g.FillRectangle(b, r);
}
}
static void Main(string[] args)
{
int w = 5;
int h = 5;
Point xy = new Point(960 - w, 540 - h);
draw(new Rectangle(xy, new Size(w, h)), new SolidBrush(Color.White), GetDC(IntPtr.Zero));
Thread.Sleep(1);
Main(args);
}
}
}
I put in a loop function so that your "thing" doesn't disappear, and I made the wait part at 1 milisecond so that the dot doesn't flicker. Thankfully it's a console app so it won't freeze.
Found this solution out from Draw Directly To Screen.