惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 妖居

ASP.NET MVC Tips #2 - 令人混乱的Get、Post、Return View和Return Redirect ASP.NET MVC Tips #1 - 支持上传文件的ModelBinder How to migrate MsSql database to MySql Windows Workflow Foundation 使用小例 使用异步委托解决Windows Application应用Duplex Service时出现的Deadlock问题 字节数组、数值和十六进制字符串的转换 表格化固定长、CSV文件编辑器工具 iMatrixitor 发布 Getting Started With LINQ in Visual Basic (翻译 + 评论) 使用接口实现附带插件功能的程序 两个简单方法加速DataGridView 使用.NET自带的功能制作简单的注册码 不是说“Peek 不会更改 StreamReader 的当前位置”么。MS骗人的! 《Introducing Visual Basic 2005》中看到的一些VB2005的新特性 VB.NET函数的返回值问题(从CSDN论坛一个问题想到的) Add-in and Automation Development In VB.NET 2003 (Finished) Add-in and Automation Development In VB.NET 2003 (8) 模拟IE地址栏的TextBox小控件 Add-in and Automation Development in VB.NET 2003 (6-7) Add-in and Automation Development In VB.NET 2003 (5)
在WinXP环境下显示XP风格的控件
妖居 · 2005-04-14 · via 博客园 - 妖居

通过标准的.NET Windows Application我们只能建立一个使用Comctl32.dll Version 5的应用程序。即便我们的程序运行在Windows XP系统下,外观仍旧沿用了Windows 2000。实际上通过简单的设置,就可以让我们的程序在Windows XP下面显示为新的程序外观。

首先我们建立自己的Windows Application,然后拖拽一个按钮(Button),一个进度条(ProgressBar),一个组合框(ComboBox),一个单选框(RadioButton)和一个复选框(CheckBox)。这些控件是在Windows XP下面有其特殊的显示效果。我们把其中的FlatStyle属性设置为System。这个操作表示我们这些控件的平面外观样式使用操作系统的默认值。

之后我们在我们应用程序的文件目录建立一个manifest文件。假如我们的应用程序AssemblyNamemyapp,那么这个文件名就是myapp.exe.manifest。编辑这个文件的内容。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity

   version="1.0.0.0"

   processorArchitecture="X86"

   name="Microsoft.Winweb.[AssemblyName]"

   type="win32"

/>

<description>.NET control deployment tool</description>

<dependency>

   <dependentAssembly>

     <assemblyIdentity

       type="win32"

       name="Microsoft.Windows.Common-Controls"

       version="6.0.0.0"

       processorArchitecture="X86"

       publicKeyToken="6595b64144ccf1df"

       language="*"

     />

   </dependentAssembly>

</dependency>

</assembly>

其中name="Microsoft.Winweb.[AssemblyName]"的部分写入自己程序的AssemblyName。比如这个程序我们就写成name="Microsoft.Winweb.myapp"。保持执行文件和这个manifest文件在同一目录下。这样,如果我们的程序在Windows XP系统下面运行,那么就会自动显示Windows XP的效果。

程序代码如下:

Public Class Form1

    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()

        MyBase.New()

        'This call is required by the Windows Form Designer.

        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

        If disposing Then

            If Not (components Is Nothing) Then

                components.Dispose()

            End If

        End If

        MyBase.Dispose(disposing)

    End Sub

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer. 

    'Do not modify it using the code editor.

    Friend WithEvents Button1 As System.Windows.Forms.Button

    Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox

    Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton

    Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox

    Friend WithEvents HScrollBar1 As System.Windows.Forms.HScrollBar

    Friend WithEvents VScrollBar1 As System.Windows.Forms.VScrollBar

    Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar

    Friend WithEvents ToolBarButton1 As System.Windows.Forms.ToolBarButton

    Friend WithEvents ToolBarButton2 As System.Windows.Forms.ToolBarButton

    Friend WithEvents ToolBarButton3 As System.Windows.Forms.ToolBarButton

    Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar

    Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        Me.Button1 = New System.Windows.Forms.Button

        Me.CheckBox1 = New System.Windows.Forms.CheckBox

        Me.RadioButton1 = New System.Windows.Forms.RadioButton

        Me.ComboBox1 = New System.Windows.Forms.ComboBox

        Me.HScrollBar1 = New System.Windows.Forms.HScrollBar

        Me.VScrollBar1 = New System.Windows.Forms.VScrollBar

        Me.ToolBar1 = New System.Windows.Forms.ToolBar

        Me.ToolBarButton1 = New System.Windows.Forms.ToolBarButton

        Me.ToolBarButton2 = New System.Windows.Forms.ToolBarButton

        Me.ToolBarButton3 = New System.Windows.Forms.ToolBarButton

        Me.StatusBar1 = New System.Windows.Forms.StatusBar

        Me.ProgressBar1 = New System.Windows.Forms.ProgressBar

        Me.SuspendLayout()

        '

        'Button1

        '

        Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.System

        Me.Button1.Location = New System.Drawing.Point(32, 144)

        Me.Button1.Name = "Button1"

        Me.Button1.TabIndex = 0

        Me.Button1.Text = "Button1"

        '

        'CheckBox1

        '

        Me.CheckBox1.FlatStyle = System.Windows.Forms.FlatStyle.System

        Me.CheckBox1.Location = New System.Drawing.Point(40, 200)

        Me.CheckBox1.Name = "CheckBox1"

        Me.CheckBox1.TabIndex = 1

        Me.CheckBox1.Text = "CheckBox1"

        '

        'RadioButton1

        '

        Me.RadioButton1.FlatStyle = System.Windows.Forms.FlatStyle.System

        Me.RadioButton1.Location = New System.Drawing.Point(152, 200)

        Me.RadioButton1.Name = "RadioButton1"

        Me.RadioButton1.TabIndex = 2

        Me.RadioButton1.Text = "RadioButton1"

        '

        'ComboBox1

        '

        Me.ComboBox1.Location = New System.Drawing.Point(144, 152)

        Me.ComboBox1.Name = "ComboBox1"

        Me.ComboBox1.Size = New System.Drawing.Size(121, 20)

        Me.ComboBox1.TabIndex = 3

        Me.ComboBox1.Text = "ComboBox1"

        '

        'HScrollBar1

        '

        Me.HScrollBar1.Location = New System.Drawing.Point(160, 120)

        Me.HScrollBar1.Name = "HScrollBar1"

        Me.HScrollBar1.TabIndex = 4

        '

        'VScrollBar1

        '

        Me.VScrollBar1.Location = New System.Drawing.Point(256, 48)

        Me.VScrollBar1.Name = "VScrollBar1"

        Me.VScrollBar1.TabIndex = 5

        '

        'ToolBar1

        '

        Me.ToolBar1.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.ToolBarButton1, Me.ToolBarButton2, Me.ToolBarButton3})

        Me.ToolBar1.DropDownArrows = True

        Me.ToolBar1.Location = New System.Drawing.Point(0, 0)

        Me.ToolBar1.Name = "ToolBar1"

        Me.ToolBar1.ShowToolTips = True

        Me.ToolBar1.Size = New System.Drawing.Size(292, 28)

        Me.ToolBar1.TabIndex = 6

        '

        'StatusBar1

        '

        Me.StatusBar1.Location = New System.Drawing.Point(0, 251)

        Me.StatusBar1.Name = "StatusBar1"

        Me.StatusBar1.Size = New System.Drawing.Size(292, 22)

        Me.StatusBar1.TabIndex = 7

        Me.StatusBar1.Text = "StatusBar1"

        '

        'ProgressBar1

        '

        Me.ProgressBar1.Location = New System.Drawing.Point(24, 64)

        Me.ProgressBar1.Name = "ProgressBar1"

        Me.ProgressBar1.TabIndex = 8

        '

        'Form1

        '

        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)

        Me.ClientSize = New System.Drawing.Size(292, 273)

        Me.Controls.Add(Me.ProgressBar1)

        Me.Controls.Add(Me.StatusBar1)

        Me.Controls.Add(Me.ToolBar1)

        Me.Controls.Add(Me.VScrollBar1)

        Me.Controls.Add(Me.HScrollBar1)

        Me.Controls.Add(Me.ComboBox1)

        Me.Controls.Add(Me.RadioButton1)

        Me.Controls.Add(Me.CheckBox1)

        Me.Controls.Add(Me.Button1)

        Me.Name = "Form1"

        Me.Text = "Form1"

        Me.ResumeLayout(False)

    End Sub

#End Region

End Class

Mainfest文件如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity

   version="1.0.0.0"

   processorArchitecture="X86"

   name="Microsoft.Winweb.WindowsApplication1"

   type="win32"

/>

<description>.NET control deployment tool</description>

<dependency>

   <dependentAssembly>

     <assemblyIdentity

       type="win32"

       name="Microsoft.Windows.Common-Controls"

       version="6.0.0.0"

       processorArchitecture="X86"

       publicKeyToken="6595b64144ccf1df"

       language="*"

     />

   </dependentAssembly>

</dependency>

</assembly>