.Net 很好,可是我想使用XP的那种外观. 怎么做呢?
VB,VC++的解决都可以:)
把所有控件的FlatStyle属性设为System,注意有的可视控件没有这个属性
然后把下面的代码添加到#Region 区的InitializeComponent()后面(这个需要放在任何初始化代码前面),OK,试着运行一下。
Dim x As String
Dim y As Integer
Dim AppName As String
Dim ManFileName As String
Dim AlreadyExists As String
Find the name of this application
x = Application.ExecutablePath
y = x.LastIndexOf("\")
y = y + 1
AppName = x.Substring(y, x.Length - y)
Create the name for the XML file
ManFileName = AppName & ".xml"
See if the manifest exists
If System.IO.File.Exists(ManFileName) Then
AlreadyExists = "Y"
Else
FileOpen(1, ManFileName, OpenMode.Binary)
FilePut(1, "<?xml version=1.0 encoding=UTF-8 standalone=yes?>" & vbCrLf)
FilePut(1, "<assembly xmlns=urn:schemas-microsoft-com:asm.v1 manifestVersion=1.0>" & vbCrLf)
FilePut(1, "<assemblyIdentity version=1.0.0.0 processorArchitecture=X86 name=zx.exe type=win32 />" & vbCrLf)
FilePut(1, "<description>zxapplication</description>" & vbCrLf)
FilePut(1, "<dependency>" & vbCrLf)
FilePut(1, "<dependentAssembly>" & vbCrLf)
FilePut(1, "<assemblyIdentity type=win32 name=Microsoft.Windows.Common-Controls version=6.0.0.0 processorArchitecture=X86 publicKeyToken=6595b64144ccf1df language=* />" & vbCrLf)
FilePut(1, "</dependentAssembly>" & vbCrLf)
FilePut(1, "</dependency>" & vbCrLf)
FilePut(1, "</assembly>" & vbCrLf)
FileClose(1)
Open a new instance of the app and close this one
so the manifest is picked up
Shell(AppName, AppWinStyle.NormalFocus)
End
End If
主要是增加一些pictureBox然后对它们的又击事件进行编码!
private void changeWinState()
{
if(!ismax)
{
this.WindowState = FormWindowState.Maximized;
ismax=true;
this.TitleLabel.Text = "最大化!";
}
else
{
this.WindowState = FormWindowState.Normal;
ismax=false;
this.TitleLabel .Text = "默认大小!";
}
}
private void picBox_DoubleClick(object sender, System.EventArgs e)
{
changeWinState();
}
private void TitleLabel_DoubleClick(object sender, System.EventArgs e)
{
changeWinState();
}
private void picBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
m_pOffset = new Point(-e.X, -e.Y);
}
private void picBox_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
Point mousePos = Control.MousePosition;
mousePos.Offset(m_pOffset.X, m_pOffset.Y);
Location = mousePos;
}
}
private void button1_Click(object sender, System.EventArgs e)
{
Application.Exit ();
}
private void pictureBox4_MouseEnter(object sender, System.EventArgs e)
{
this.pictureBox4 .Image = System.Drawing.Bitmap.FromFile("close2.bmp");
}
private void pictureBox4_MouseLeave(object sender, System.EventArgs e)
{
this.pictureBox4 .Image = System.Drawing.Bitmap.FromFile("close1.bmp");
}
private void pictureBox4_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.pictureBox4 .Image = System.Drawing.Bitmap.FromFile("close3.bmp");
}
private void pictureBox4_Click(object sender, System.EventArgs e)
{
Application.Exit ();
}
}
http://expert.csdn.net/Expert/icView1.asp?id=2093334