110,501
社区成员
发帖
与我相关
我的任务
分享
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case Win32API.WM_NCPAINT:
case Win32API.WM_NCACTIVATE:
IntPtr vHandle = Win32API.GetWindowDC(m.HWnd);
Graphics vGraphics = Graphics.FromHdc(vHandle);
//在标题栏上 DrawImage,绘制图片,用到了一个皮肤,所以有 XTheme这个东西,可忽略
double vMul = (double)Resources.logoString.Height/(this.XTheme.CaptionHeight - 10);
vGraphics.DrawImage(Resources.logoString, new Rectangle(this.XTheme.IconSize.Width + 10, 7, (int)(Resources.logoString.Width/vMul), this.XTheme.CaptionHeight-10),
0, 0, Resources.logoString.Width, Resources.logoString.Height, GraphicsUnit.Pixel);
vGraphics.Dispose();
Win32API.ReleaseDC(m.HWnd, vHandle);
break;
default:
base.WndProc(ref m);
break;
}
}