Windows XP Styles mit C##
-
Ich möchte gerne, dass meine mit VS.NET entwickelte Anwendung unter XP entsprechendes Aussehen hat: sprich XP Design.
Ich nutze C##Kann jemand mir helfen?
-
Suche mal nach der Lösung mit der Manifest-Datei. ---> FAQ MFC
-
Das geht auch automatisiert über ein .NET - Plugin.
Schau mal auf http://msdn.microsoft.com/library/?url=/library/en-us/dnwinforms/html/xpthemeaddin_.asp
Das Plugin erweitert das Menu 'Extras' um einen Menupunkt 'XPThemeSupport'. Lad dir das fertige Projekt runter, compilier die das Setup und führ es aus. Funzt wunderbar!
-
Laufen die Progs dann auch nur noch unter XP?
Danke
Buster
-
Falls Du das Aussehen ähnlich Office XP willst, solltest Du Dir die Magic Libary ansehen.
-
he, das war eine C##-Frage! Die passt nicht ins C#-Forum!
-
gibt es dieses Win XP Design .NET Plugin auch kompelliert? Ich habe nur VS C++ 2003 Std. und kann das Projekt nicht kompellieren.
-
Gibts im .NET2 Framework nicht ein paar WindowsXP Controls? (Sind meiner Meinung nach potthässlich, aber wer wollte das schon wisse?)
-
ich habe hier eine einfache lösung anzubieten:
man ruft einfach :
System.Windows.Forms.Application.EnableVisualStyles();
auf, am besten im konstruktor bevor man irgnedetwas anderes macht.
dann kann man wie gewohnt seine CheckBoxen,Progressbars usw. erzeugen.
Dadurch wird veranlasst, dass wenn das xp-style vorhanden ist(ist der fall bei win xp prof/home,win2003) dieses auch zu benutzen.
Allerdings muss man noch das FlatStyle property auf System setzen, dies ist nur für alles was von button abstammt notwendig(Button,CheckBox,RadioButton).
Bsp für Property:
this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;Code-Example:
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace WindowsApplication2 { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ProgressBar progressBar1; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); System.Windows.Forms.Application.EnableVisualStyles(); // // TODO: Add any constructor code after InitializeComponent call // } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.checkBox1 = new System.Windows.Forms.CheckBox(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.SuspendLayout(); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(8, 10); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(304, 20); this.textBox1.TabIndex = 0; this.textBox1.Text = "textBox1"; // // button1 // this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.button1.Location = new System.Drawing.Point(324, 8); this.button1.Name = "button1"; this.button1.TabIndex = 1; this.button1.Text = "button1"; // // checkBox1 // this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.checkBox1.Location = new System.Drawing.Point(216, 40); this.checkBox1.Name = "checkBox1"; this.checkBox1.TabIndex = 2; this.checkBox1.Text = "checkBox1"; // // radioButton1 // this.radioButton1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.radioButton1.Location = new System.Drawing.Point(8, 40); this.radioButton1.Name = "radioButton1"; this.radioButton1.TabIndex = 3; this.radioButton1.Text = "radioButton1"; // // comboBox1 // this.comboBox1.Location = new System.Drawing.Point(8, 70); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(392, 21); this.comboBox1.TabIndex = 4; this.comboBox1.Text = "comboBox1"; // // progressBar1 // this.progressBar1.Location = new System.Drawing.Point(9, 96); this.progressBar1.Name = "progressBar1"; this.progressBar1.Size = new System.Drawing.Size(390, 16); this.progressBar1.TabIndex = 5; this.progressBar1.Value = 10; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(408, 118); this.Controls.Add(this.progressBar1); this.Controls.Add(this.comboBox1); this.Controls.Add(this.radioButton1); this.Controls.Add(this.checkBox1); this.Controls.Add(this.button1); this.Controls.Add(this.textBox1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { } } }