C
C#2y ago
xynx

using System.Drawing;

I am drawing a rectangle box onto my screen but everytime my screen refreshes it gets rid of it, so i made it redraw it everytime my screen refreshes with a 1ms delay but the rectangle box gets really confuses, dm me for code
6 Replies
Angius
Angius2y ago
No DMs Post code here
xynx
xynxOP2y ago
aight
Angius
Angius2y ago
If it's too much, $paste
MODiX
MODiX2y ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
Angius
Angius2y ago
Or link a Github repo
xynx
xynxOP2y ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WHITEBOX
{
public partial class Form1 : Form
{
[DllImport("User32.dll")]
public static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("User32.dll")]
public static extern void ReleaseDC(IntPtr hwnd, IntPtr dc);
public Form1()
{
InitializeComponent();
}

private void tmrRefresh_Tick(object sender, EventArgs e)
{
this.Hide();
tmrRefresh.Interval = 1;
IntPtr desktopPtr = GetDC(IntPtr.Zero);
Graphics g = Graphics.FromHdc(desktopPtr);
int iXScreen = 1920;
int iYScreen = 1080;
int iXSize = 240;
int iYSize = 240;
int iX = (iXScreen / 2) - (iXSize / 2);
int iY = (iYScreen / 2) - (iYSize / 2);
Pen P = new Pen(Color.White, 1);
Rectangle rect = new Rectangle(iX, iY, iXSize, iYSize);
g.DrawRectangle(P, rect);
g.Dispose();
ReleaseDC(IntPtr.Zero, desktopPtr);
}

private void Form1_Load(object sender, EventArgs e)
{
this.Hide();
tmrRefresh.Enabled = true;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WHITEBOX
{
public partial class Form1 : Form
{
[DllImport("User32.dll")]
public static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("User32.dll")]
public static extern void ReleaseDC(IntPtr hwnd, IntPtr dc);
public Form1()
{
InitializeComponent();
}

private void tmrRefresh_Tick(object sender, EventArgs e)
{
this.Hide();
tmrRefresh.Interval = 1;
IntPtr desktopPtr = GetDC(IntPtr.Zero);
Graphics g = Graphics.FromHdc(desktopPtr);
int iXScreen = 1920;
int iYScreen = 1080;
int iXSize = 240;
int iYSize = 240;
int iX = (iXScreen / 2) - (iXSize / 2);
int iY = (iYScreen / 2) - (iYSize / 2);
Pen P = new Pen(Color.White, 1);
Rectangle rect = new Rectangle(iX, iY, iXSize, iYSize);
g.DrawRectangle(P, rect);
g.Dispose();
ReleaseDC(IntPtr.Zero, desktopPtr);
}

private void Form1_Load(object sender, EventArgs e)
{
this.Hide();
tmrRefresh.Enabled = true;
}
}
}
Want results from more Discord servers?
Add your server