change display position in csharp

To change the display position, you can use GDI+ graphics in csharp. Here's how you can do it:

main.cs
using System.Drawing;

// Get the screen and create a graphics object
Screen screen = Screen.PrimaryScreen;
Graphics graphics = Graphics.FromHwnd(IntPtr.Zero);

// Move the graphics to the desired display position
graphics.TranslateTransform(screen.Bounds.Left + 100, screen.Bounds.Top + 100);

// Draw something at the new position
Pen pen = new Pen(Color.Red);
graphics.DrawLine(pen, 0, 0, 100, 100);
403 chars
13 lines

In the code above, we first get the primary screen and create a graphics object from it. Then, we use the TranslateTransform method of the graphics object to move it to the desired position. Finally, we draw something on the graphics object at the new position.

Note that this will only change the display position of the graphics object, not the actual screen display. If you want to change the position of an application window, you need to use the SetWindowPos function from the Win32 API.

gistlibby LogSnag