请问怎么改变winform窗体 标题的字体大小 背景 和颜色 请问怎么改变winform窗体 标题的字体大小 背景 和颜色 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Drawing.Drawing2D;namespace WindowsApplication1{ public partial class Form1 : Form { [DllImport("user32.dll")] private static extern IntPtr GetWindowDC(IntPtr hWnd); [DllImport("user32.dll")] private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); private const int WM_NCPAINT = 0x0085; private const int WM_NCACTIVATE = 0x0086; private const int WM_NCLBUTTONDOWN = 0x00A1; protected override void WndProc(ref Message m) { base.WndProc(ref m); Rectangle vRectangle = new Rectangle(3, 3, Width-6, 21); switch (m.Msg) { case WM_NCPAINT: case WM_NCACTIVATE: IntPtr vHandle = GetWindowDC(m.HWnd); Graphics vGraphics = Graphics.FromHdc(vHandle); vGraphics.FillRectangle(new LinearGradientBrush(vRectangle, Color.Pink, Color.Purple, LinearGradientMode.BackwardDiagonal), vRectangle); StringFormat vStringFormat = new StringFormat(); vStringFormat.Alignment = StringAlignment.Center; vStringFormat.LineAlignment = StringAlignment.Center; vGraphics.DrawString("Form1", Font, Brushes.BlanchedAlmond, vRectangle, vStringFormat); vGraphics.Dispose(); ReleaseDC(m.HWnd, vHandle); break; case WM_NCLBUTTONDOWN: Point vPoint = new Point((int)m.LParam); vPoint.Offset(-Left, -Top); if (vRectangle.Contains(vPoint)) MessageBox.Show(vPoint.ToString()); break; } } public Form1() { InitializeComponent(); } }} 或者参考http://www.codeproject.com/KB/dialog/GoogleTalkWindowsForm.aspx 关于C#写入数据库的问题 JS读取时间问题 讨论个问题 SqlDataReader 和dataset 效率问题请教下 数据库清洗的标准 如何在C#中获取当前计算机的物理内存大小 相对路径的图标不能显示以及url无故出现乱编码 Xml节点为什么删除不掉 wordpress和discuz的正则表达式 怎么写? 水晶报表建立安装文件的问题 怎样把一个字符重复多次,是用哪个方法? 在Panel控件中绘图问题 应该怎么样发布网站??
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing.Drawing2D;namespace WindowsApplication1
{
public partial class Form1 : Form
{ [DllImport("user32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); private const int WM_NCPAINT = 0x0085;
private const int WM_NCACTIVATE = 0x0086;
private const int WM_NCLBUTTONDOWN = 0x00A1;
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
Rectangle vRectangle = new Rectangle(3, 3, Width-6, 21);
switch (m.Msg)
{
case WM_NCPAINT:
case WM_NCACTIVATE:
IntPtr vHandle = GetWindowDC(m.HWnd);
Graphics vGraphics = Graphics.FromHdc(vHandle);
vGraphics.FillRectangle(new LinearGradientBrush(vRectangle,
Color.Pink, Color.Purple, LinearGradientMode.BackwardDiagonal),
vRectangle); StringFormat vStringFormat = new StringFormat();
vStringFormat.Alignment = StringAlignment.Center;
vStringFormat.LineAlignment = StringAlignment.Center;
vGraphics.DrawString("Form1", Font, Brushes.BlanchedAlmond,
vRectangle, vStringFormat); vGraphics.Dispose();
ReleaseDC(m.HWnd, vHandle);
break;
case WM_NCLBUTTONDOWN:
Point vPoint = new Point((int)m.LParam);
vPoint.Offset(-Left, -Top);
if (vRectangle.Contains(vPoint))
MessageBox.Show(vPoint.ToString());
break;
}
}
public Form1()
{
InitializeComponent();
}
}
}
http://www.codeproject.com/KB/dialog/GoogleTalkWindowsForm.aspx