[Mono-winforms-list] How to Paint NonClient Area

András Mocsáry amocsy at gmail.com
Tue Feb 23 21:43:54 EST 2010


I'd like to ask for help on how to paint the nonclient area under mono using
winforms.

I've read that mono emulates the msg codes like WM_NCPAINT, thus I wrote:

        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            //WM_NCPAINT =0x0085
            if (m.Msg == 0x0085)//nonclient paint
            {
                Graphics g = Graphics.FromHwndInternal(this.Handle);
                g.DrawImage(BeautyButtons.Properties.Resources.btnBorder4,
0, 0);
            }
        }
But does not works.

Under widnows I used:
                IntPtr pTarget = GetWindowDC(targetHandle);
                Graphics thisGraph = Graphics.FromHdc(pTarget);
                //Top
                thisGraph.DrawImage(sourceBitmap, 0, 0, wdth,
titleBarheight);
                ...
                ReleaseDC(targetHandle, pTarget);
Note that under windows it can be pointed to any other window. For the
project that's not necessary.
On the contrary, it would be best if a purely managed solution would exists,
which would run under most mono platforms.

Thx for your advice

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20100224/dc749028/attachment.html 


More information about the Mono-winforms-list mailing list