Results 1 to 11 of 11

Thread: icons???

  1. #1
    Guest

    Question

    Hi again guys,

    I can't find a post related to this yet, but does anyone of you guys know how to create an icon?? well, i mean, putting images into the command buttons. I don't mean, creating a image then put in "image_click", just simply a command button with images on it.

    thanks guy

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Posts
    85

    Thumbs up

    To put images onto a toolbar button you have to add the imagelist control. You then load all of your images using the insert button. Once you have the images loaded you can then call the imagelist from all most any other control. Hope this helps.

  3. #3
    Guest
    erm. sorry.. but where can I find the Imagelist control???

  4. #4
    Addicted Member
    Join Date
    Apr 2000
    Location
    Sheffield, England.
    Posts
    136
    It's on Microsoft Common Controls 6-2, I think.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Press Ctrl+T Search for the Microsoft Windows Common controls and check it, press ok, the three boxes on each other is the imagelistcontrol
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Guest
    thanks guys..

    got it working

  7. #7
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    At design time set the command button sytle to 1 (graphical)
    then add the picture via the picture property.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  8. #8
    Guest
    It'll be better to make your own button using an Image Control. I find that the normal ones are too large when a picture is added.

  9. #9
    Guest

    HeSaidIT

    i have to agree, HeSaidJoe's method is the most simplest, no hassle. But, u would have to create this images urself to ensure the size you wanted.

  10. #10
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    DrawIcon API?

    How about this?

    Code:
    Option Explicit
    Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
    Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
    Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Sub Command2_Click()
        Dim Path$, strSave$, MyDC&, return1&
        'String Buffer
        strSave = String(200, Chr$(0))
        'GetRegEDIT Path
        Path = Left$(strSave, GetWindowsDirectory(strSave, Len(strSave))) + "\REGEdit.exe"
        return1& = ExtractIcon(Me.hwnd, Path, 3)
        MyDC = GetDC(Command1.hwnd)
        'Draw the icon on the CommandButton
        return1 = DrawIcon(MyDC, 0, 0, return1)
    End Sub

  11. #11
    Guest
    Yeah that works good, but it covers up the Caption. I suppose, though, that it would be good if you did not want any text of it (Ie, a Toolbar button)

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