Assembly : System.Drawing (dans system.drawing.dll)
SyntaxePublic NotInheritable Class SystemIcons
Dim instance As SystemIcons
public sealed class SystemIcons
public ref class SystemIcons sealed
public final class SystemIcons
public final class SystemIcons
ExempleL'exemple de code suivant illustre le chargement d'une bitmap à partir d'un descripteur Icon à l'aide de l'énumération GraphicsUnit, et l'utilisation de la méthode Round pour dessiner les contours du rectangle d'une bitmap.
Cet exemple est conçu pour être utilisé avec Windows Forms. Créez un formulaire qui contient un bouton nommé Button2. Collez le code dans le formulaire et associez cette méthode à l'événement Click du bouton.
Private Sub Button2_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button2.Click Dim bitmap1 As Bitmap = Bitmap.FromHicon(SystemIcons.Hand.Handle) Dim formGraphics As Graphics = Me.CreateGraphics() Dim units As GraphicsUnit = GraphicsUnit.Point Dim bmpRectangleF As RectangleF = bitmap1.GetBounds(units) Dim bmpRectangle As Rectangle = Rectangle.Round(bmpRectangleF) formGraphics.DrawRectangle(Pens.Blue, bmpRectangle) formGraphics.Dispose() End Sub
private void Button2_Click(System.Object sender, System.EventArgs e) { Bitmap bitmap1 = Bitmap.FromHicon(SystemIcons.Hand.Handle); Graphics formGraphics = this.CreateGraphics(); GraphicsUnit units = GraphicsUnit.Point; RectangleF bmpRectangleF = bitmap1.GetBounds(ref units); Rectangle bmpRectangle = Rectangle.Round(bmpRectangleF); formGraphics.DrawRectangle(Pens.Blue, bmpRectangle); formGraphics.Dispose(); }
void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) { Bitmap^ bitmap1 = Bitmap::FromHicon( SystemIcons::Hand->Handle ); Graphics^ formGraphics = this->CreateGraphics(); GraphicsUnit units = GraphicsUnit::Point; RectangleF bmpRectangleF = bitmap1->GetBounds( units ); Rectangle bmpRectangle = Rectangle::Round( bmpRectangleF ); formGraphics->DrawRectangle( Pens::Blue, bmpRectangle ); delete formGraphics; }
private void button2_Click(System.Object sender, System.EventArgs e) { Bitmap bitmap1 = Bitmap.FromHicon(SystemIcons.get_Hand().get_Handle()); Graphics formGraphics = this.CreateGraphics(); GraphicsUnit units = GraphicsUnit.Point; RectangleF bmpRectangleF = bitmap1.GetBounds(units); Rectangle bmpRectangle = Rectangle.Round(bmpRectangleF); formGraphics.DrawRectangle(Pens.get_Blue(), bmpRectangle); formGraphics.Dispose(); } //button2_Click
Sécurité des threads
Plates-formesWindows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ