المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : c# Need help getting WPF window to draw behind desktop icons



C# Programming
02-24-2011, 04:31 PM
Hello i have tried to get find some examples that draws behind the desktop icons and the ones i found did not do this in windows 7 atleast. so i thought i would have a go at overriding the onpaint or onrender but since im not the best yet! i can't seem to find the right way to do this. so far i managed to draw a circle behind by following this code

[DllImport("user32.dll")]
static extern IntPtr GetDesktopWindow();

[DllImport("user32.dll")]
static extern IntPtr GetDCEx(IntPtr hwnd, IntPtr hrgn, uint flags);

.......
IntPtr hdc = GetDCEx(GetDesktopWindow(), IntPtr.Zero, 1027);
using(Graphics g = Graphics.FromHdc(hdc))
{
g.FillEllipse(Brushes.Red, 0, 0, 400, 400);
}

then i tought what if i copied the e.graphics and put it into the newly created g and then tried to draw but i can't seem to copy the content of the painteventargs, is it even possible?

so i tought i ask the masters here. anyone know how to do something like this?