This is a multi-part message in MIME format.

------=_NextPart_000_0062_01C4B605.5C8CA770
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I want to draw my own colors into the titlebar of a Form.=20

I tried to get the WM_NCPAINT-message and drawed into a the non client =
region:
protected override void WndProc(ref System.Windows.Forms.Message msg)
{
if( (msg.Msg =3D=3D WM_NCPAINT))
{
IntPtr hdc;
if (msg.WParam.ToInt32() =3D=3D 1)=20
{
hdc =3D GetDC(msg.HWnd);
//hdc =3D GetDCEx(msg.HWnd, (IntPtr)msg.WParam, =
DCX_WINDOW|DCX_INTERSECTRGN);
// Paint into this DC
Graphics g =3D Graphics.FromHdc(hdc);
g.FillRectangle(new SolidBrush(Color.Red), -20,-20, =
this.Width, this.Height);=20
ReleaseDC(msg.HWnd, hdc);msg.Result =3D (IntPtr)0;
//g.Dispose();
}
}
else=20
{
base.WndProc(ref msg);
}
}

But this did not work. Than I found something with a borderless Form. =
First creating a 1 px bigger non client area, and then paint into, but =
the code example couldn't include into my project (I do not know why), =
because of using of NatvieMethods.

Now I really don't know anymore. I only want to use my own color for a =
gradient titlebar and be indepentend of fucking windows themes and =
coloring

Thank you your best comments :) And please help me!!

Robert.



------=_NextPart_000_0062_01C4B605.5C8CA770
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2523" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I want to draw my own colors into the =
titlebar of a=20
Form. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I tried to get the WM_NCPAINT-message =
and drawed=20
into a the non client region:</FONT>
<P><FONT face=3DCourier size=3D2>protected override void WndProc(ref=20
System.Windows.Forms.Message msg)<BR></FONT><FONT face=3DCourier=20
size=3D2>{<BR></FONT><FONT face=3DCourier size=3D2>&nbsp;&nbsp;&nbsp; =
if( (msg.Msg =3D=3D=20
WM_NCPAINT))<BR></FONT><FONT face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;{<BR></FONT><FONT face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; IntPtr =
hdc;<BR></FONT><FONT=20
face=3DCourier size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if=20
(msg.WParam.ToInt32() =3D=3D 1) <BR></FONT><FONT face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<BR></FONT><FONT =
face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; hdc =
=3D=20
GetDC(msg.HWnd);<BR></FONT><FONT face=3DCourier =
size=3D2>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //hdc =3D GetDCEx(msg.HWnd,=20
(IntPtr)msg.WParam, DCX_WINDOW|DCX_INTERSECTRGN);<BR></FONT><FONT =
face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // =
Paint into=20
this DC<BR></FONT><FONT face=3DCourier size=3D2>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Graphics g =3D=20
Graphics.FromHdc(hdc);<BR></FONT><FONT face=3DCourier =
size=3D2>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g.FillRectangle(new =
SolidBrush(Color.Red),=20
-20,-20, this.Width, this.Height); </FONT><FONT face=3DCourier=20
size=3D2><BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
ReleaseDC(msg.HWnd, hdc);</FONT><FONT face=3DCourier size=3D2>msg.Result =
=3D=20
(IntPtr)0;<BR></FONT><FONT face=3DCourier size=3D2>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //g.Dispose();<BR></FONT><FONT=20
face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR></FONT><FON=
T=20
face=3DCourier size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;}<BR></FONT><FONT =
face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp; else <BR></FONT><FONT face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp; {<BR></FONT><FONT face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; base.WndProc(ref=20
msg);<BR></FONT><FONT face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;}<BR></FONT><FONT face=3DCourier=20
size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2>But this did not work. Than I found =
something with a=20
borderless Form. First creating a 1 px bigger non client area, and then =
paint=20
into, but the code example couldn't include into my project (I do not =
know why),=20
because of using of NatvieMethods.</FONT></P>
<P><FONT face=3DArial size=3D2>Now I really don't know anymore. I only =
want to use=20
my own color for a gradient titlebar and be indepentend of fucking =
windows=20
themes and coloring</FONT></P>
<P><FONT face=3DArial size=3D2>Thank you your best comments :) And =
please help=20
me!!</FONT></P>
<P><FONT face=3DArial size=3D2>Robert.</FONT></P>
<P><FONT face=3DCourier size=3D2></FONT>&nbsp;</P></DIV></BODY></HTML>

------=_NextPart_000_0062_01C4B605.5C8CA770--