Results 1 to 3 of 3

Thread: Get the system icons (messagebox icons) by code

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Get the system icons (messagebox icons) by code

    I didnt know it was this easy to access them. Just look at the System.Drawing.SystemIcons namespace. For example

    System.Drawing.SystemIcons.Error.ToBitmap will return the error icon shown in a messagebox
    hope this will be helpful to some people
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Hyperactive Member
    Join Date
    May 2002
    Location
    Wisconsin, USA
    Posts
    279
    Originally posted by crpietschmann
    Here is an example of how to make a system icon the icon of a form.
    Code:
    Me.Icon = System.Drawing.SystemIcons.Information
    It's that simple.

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    big thanks to MrPolite for finding the Systemicons ( pointing them out ).
    here's some code i built to show how to get all the system icons without having to type each one out....
    VB Code:
    1. Dim mi As Reflection.MemberInfo() = GetType(Drawing.SystemIcons).GetMembers
    2.         Dim m As Reflection.MemberInfo
    3.         For Each m In mi
    4.             If m.MemberType = Reflection.MemberTypes.Property Then
    5.                 Dim o As Object = m.ReflectedType.InvokeMember(m.Name, Reflection.BindingFlags.GetProperty, Nothing, o, Nothing)
    6.                 If TypeOf o Is Icon Then
    7.                     Me.Icon = DirectCast(o, Icon)
    8.                     Threading.Thread.Sleep(500) '/// just to give you time to see your form's icon change through each system icon.
    9.                 End If
    10.             End If
    11.         Next
    Last edited by dynamic_sysop; Dec 28th, 2003 at 01:29 PM.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width