2012-12-04 70 views
13

一段時間以來,我已經使用了以下Win32代碼來隱藏桌面(隱藏所有桌面圖標)。以下是我的Win32_Window類,因爲桌面只是一個窗口。隱藏Windows 8桌面圖標

public bool Visible 
{ 
    get { return IsWindowVisible(Handle); } 
    set 
    { 
     ShowWindow(Handle, value ? ShowWindowConsts.SW_SHOW : 
      ShowWindowConsts.SW_HIDE); 
    } 
} 

對於Windows 8,上面不僅隱藏了桌面,而且使其完全變爲空白。現在我認爲這可能被認爲是正常的,因爲命令要隱藏,但直到現在,這還沒有成爲問題,因爲桌面背景圖像仍然可見(這是本意)。

我已經試過這來切換圖標:https://stackoverflow.com/a/6403014/353147,但它不工作在Windows 8

任何人都找到了解決這個?

+0

你可以在這裏找到答案:-) http://stackoverflow.com/questions/6402834/how-to-hide-desktop-icons-programatically –

回答

0

如果您只想隱藏桌面上的圖標,您可以右鍵單擊桌面,轉到「查看」並取消選中「顯示桌面圖標」。

+0

要做到這一點,從代碼? –

0

這裏描述,您可以在註冊表編輯器 HKEY_CURRENT_USER \ SOFTWARE \微軟\的Windows \ CurrentVersion \ Explorer中\高級 變化HideIcons做到這一點,以1

static void HideIcons() 
    { 
     RegistryKey myKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", true); 
     if (myKey != null) 
     { 
      myKey.SetValue("HideIcons", 1); 
      myKey.Close(); 
     } 
    } 

使用註冊表類。

http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx