2012-05-08 9 views
1

我正在使用ASP.net和C#。現在,我開發了一個Web應用程序。我想將當前主題更改爲Window7(IE8)中的Windows經典主題,因爲在使用其他主題時我的設計無序。我可以在運行時更改主題嗎?我可以這樣做OnPreInit()事件。請幫幫我 。如何在運行時將Window 7中的當前主題更改爲Window經典主題

與問候,

+1

檢查[這](http://davidrobertmattson.com/wordpress/?p=48)出來。 – SimpleVar

+1

基於另一個問題,我認爲是時候拿起一本關於ASP.Net&CSS的書了。 –

+0

@Yorye Nathan ...非常感謝。 – GStar

回答

2

您應該解決您的CSS,而不是改變整個Windows主題,使其工作...

另外,您不能在客戶端上啓動一個進程從一個ASP.Net,從來沒有這裏的少非Web應用程序的答案:

編號:http://davidrobertmattson.com/wordpress/?p=48

//Sets the current theme 
ProcessStartInfo startInfo = new ProcessStartInfo(); 
startInfo.CreateNoWindow = false; 
startInfo.FileName = 「rundll32.exe」; 
string startuppath = Application.StartupPath.ToString(); 
string Arguments = 「Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:\」C:\\Windows\\Resources\\Themes\\Windows Classic.Theme\」"; 
startInfo.Arguments = Arguments; 
try 
{ 
// Start the process with the info we specified. 
// Call WaitForExit and then the using statement will close. 
using (Process exeProcess = Process.Start(startInfo)) 
{ 
exeProcess.WaitForInputIdle(); 

IntPtr p = exeProcess.MainWindowHandle; 
ShowWindow(p, 1); 
SendKeys.SendWait(「{enter}」); 
} 
} 
catch 
{ 
// Log error. 
} 
+0

非常感謝。但是,現在我正在使用Web應用程序。 – GStar

+0

是的,你不能用Web應用程序 - 它在服務器上運行 - 而不是在客戶端PC上。這就是爲什麼我說要得到一本ASP.Net書以及CSS的原因。讓我知道如果有什麼不清楚的? –

+0

是的,我很清楚你的答案。我嘗試了很多改變我的CSS。但我不能。如果您有任何適合我的鏈接,請給我。 – GStar

相關問題