Results 1 to 15 of 15

Thread: Experts only

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8

    Post

    Hi
    Ok could someone please tell me how to get a files icon onto a command button, there must be a way you can do this, iv looked everywere for some code but i cant find any.

    Please help!!!!

    Thanks
    -=XPS=-

  2. #2
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Talking

    Why don't you use picture box or image box as butons. if you change the picture on events you'll get the same effect as that of a command button;

    Kinjal

  3. #3
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305
    Isn't there a graphical setting on the command button? If not, kinjalgp is right about the picture box. It does the same thing.

    bob

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You can change its style to graphical an you'll be able to show the pictures
    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.

  5. #5
    Lively Member
    Join Date
    Jan 1999
    Location
    India
    Posts
    85
    add Microsoft Forms 2.0 object library to component reference.
    fm20.dll

    Now it gives another command button to which you can assign pictures and text.

    Ramdas

  6. #6
    Guest
    THANK YOU SO MUCH, I DID NOT KNOW THAT....
    this is awesome, thank you, I would have never figured that out.... that form dll thing is awesome, even if it is another dll you have to distribute, THANK YOU

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8
    NO
    I am wanting the user to be able to ad any file icon to the command button
    So it takes the icon from the file and then adds it to the button
    -=XPS=-

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    For getting the icon out of the file and draw it on a DC:
    Code:
    'In declarations:
    Declare Function ExtractIconEx Lib "shell32" Alias "ExtractIconExA" (ByVal lpszFile As String, ByVal nIconIndex As Long, phIconLarge As Long, phIconSmall As Long, ByVal nIcons As Long) As Long
    Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hicon As Long) As Long
    'In code:
    Function GetIconsFromFile(Filename$)
        Dim hIcons()
        ReDim hIcons(ExtractIconEx(Filename, -1, ByVal 0&, ByVal 0&, 0))
        If UBound(hIcons) = 0 Then Exit Function Else ReDim Preserve hIcons(UBound(hIcons) - 1)
        ExtractIconEx Filename, 0, hIcons(0), ByVal 0&, 10
        GetIconsFromFile = hIcons
    End Function
    
    'example:
    Dim hicon&()
    hicon = GetIconsFromFile(yourfilename)
    DrawIcon yourdc&, 0, 0, hicon
    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.

  9. #9
    Member
    Join Date
    May 2000
    Location
    USA-TEXAS-DALLAS
    Posts
    34
    Experts? Even i know this one.... But Kedaman is way outa my league..
    BTW hey Kedaman ever find that VB3 code you were goin to get 4 me?
    -Jeff
    Using VB 6.0 Enterprise
    I Still like to program on my TI-85!

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    What was it about? Sorry, I forget easily.
    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.

  11. #11
    Member
    Join Date
    May 2000
    Location
    USA-TEXAS-DALLAS
    Posts
    34
    well i asked you if you could help me find a way to get my program to know any new window that came up. So if i clicked on "My Computer" the textbox #1 would show "My Computer".......You gave me a VB6 code but since that didnt work on my Vb3 you said that you would find it 4 me.

    Is it still possible?
    -Jeff
    Using VB 6.0 Enterprise
    I Still like to program on my TI-85!

  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Yeah, btw i have vb5 not 6. I'll search for it
    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.

  13. #13
    Junior Member
    Join Date
    Jan 1999
    Location
    Kitchener Ontario Canada
    Posts
    20

    Talking

    I agree with kinjalgp!

    after you use kedaman's Code for retrieving the ICOn , then just use Picturebox control to immitate a Command button, go into the Picture Box's Clikc event, set the width and height of the picture to decrease by a small value, creating the click Simulation,,

    I know you prob wont use this advice but i jsut poseted it cuz i need more posts in my Credits as i am still a damn Juniour member!!., Heh!


  14. #14
    Lively Member Zero's Avatar
    Join Date
    Feb 2000
    Posts
    101

    Easy. All ya gotta do is push somebody into it.

    Hmph. Place an image control directly over the command button. Then use the LoadPicture command to load whatever the user wants to the image. I clarify:

    ***********************
    * _______ .
    *| | .
    *| Image | Button .
    *|_______| .
    * .
    .......................

    My kingdom of a @#$%-ing image tag...

    Anyway, use a right-click -> Bring To Front to get the image in front of the button. Just make sure your text doesn't land under the picture.

  15. #15
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Talking

    Hi XPS.
    I have solved your problem by making an ActiveX control which you'll find at http://www.planetsourcecode.com/vb in the OLE/COM/activeX section you will find the second entry which is my ActiveX control The source code is included


    Kinjal

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