Questo blog post mostra come impostare il riquadro utente (immagine). In un commento vicino alla fine (Michael Anthony, 10 aprile, 22:45), il commentatore descrive come ottenere l'immagine. Ho raccolto le informazioni in uno snippet C#. Ricorda che questo è basato su una funzione di Windows Shell non documentata.
using System;
using System.Text;
using System.Drawing;
[DllImport("shell32.dll", EntryPoint = "#261",
CharSet = CharSet.Unicode, PreserveSig = false)]
public static extern void GetUserTilePath(
string username,
UInt32 whatever, // 0x80000000
StringBuilder picpath, int maxLength);
public static string GetUserTilePath(string username)
{ // username: use null for current user
var sb = new StringBuilder(1000);
GetUserTilePath(username, 0x80000000, sb, sb.Capacity);
return sb.ToString();
}
public static Image GetUserTile(string username)
{
return Image.FromFile(GetUserTilePath(username));
}
Si noti che questa funzione Shell crea il file \ Users \ <UTENTE> \ AppData ... \ <UTENTE> .bmp e restituisce il nome del file.
Inoltre, l'ho provato su Win7. Non ho idea della sua compatibilità con le precedenti versioni di Windows.
Crediti a Joco e Michael Anthony.
fonte
2011-08-31 07:40:54
Si dovrebbe prendere in considerazione l'inversione di risposte alle vostre domande (incluse ma non limitate a quelle che accettate) –