Help needed for c# picturebox as 'Button'

Discussion in 'Computer Programming, Emulation, and Game Modding' started by V0LT!GE, Jul 14, 2016.

  1. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    Hey guys!
    Need help with c# in visual Studio really quickly..
    so my Problem is that i want a picturebox, when i hover with my mouse over it that it changes its Image
    but i dont know how to do that ;D
    could you guys help me ?
     


  2. Nyap

    Nyap HTML Noob

    Banned
    973
    344
    Jan 13, 2016
    That Chaos Site
    if you want a GUI or the ability to display images you need to learn a gui library like GTK or Qt
    stay the fuck away from .net

    edit: actually I might be wrong
    dunno how C# works
     
    Last edited by Nyap, Jul 14, 2016
  3. Kliffcom

    Kliffcom GBAtemp Regular

    Member
    144
    76
    Aug 26, 2014
    Gambia, The
    there is a hover event on the picturebox use that
     
    loco365 and evandixon like this.
  4. fafaffy

    fafaffy GBAtemp Fan

    Member
    331
    160
    Sep 1, 2012
    United States
    Select the picture box. On the properties panel (usually in the bottom right), you'll see an icon that looks similar to a thunder bolt (events). On the list of events, I believe you want to double click the OnMouseHover event. It'll create the event for you, and you can (via code) change what image the picture box shows.

    — Posts automatically merged - Please don't double post! —

    Nothing is wrong with .NET especially with the introduction of mono
     
  5. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    i now what These Events are and where to find them xD dont feel attacked :D
    but i dont know how to Code that piece of Code that changes the Image file :(

    Edit: and what could i use to create some UIs for visual Basic or to create some Buttons?
     
    Last edited by V0LT!GE, Jul 14, 2016
  6. Kliffcom

    Kliffcom GBAtemp Regular

    Member
    144
    76
    Aug 26, 2014
    Gambia, The
    give me a moment i can do this for you
     
  7. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    really? thank u ! :D
     
  8. evandixon

    evandixon PMD Researcher

    Member
    1,674
    796
    May 29, 2009
    United States
    What Kliffcom said.
    Except using .Net, it's is way easier to make UIs.

    Although I would recommend WPF over Windows Forms for these reasons:
    - UI scaling works better
    - Animations are easier
    - You can easily use MVVM to reduce the amount of coupled code you have to write

    The disadvantages:
    - No open/save file dialogs (I usually reference Windows Forms for this)
    - You either have to use different classes for images, or have to convert
    - Mono doesn't support it (but IMO this doesn't matter too much since the majority of people use Windows anyway, and the benefits outweigh this disadvantage)
     
  9. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    so which piece of Software is it? is it hard to hanlde cuz im still a bit (3 month) new to c#
    EDIT: or can i still use visual Studio for that picturebox im ok for suggestions :P
    EDIT2: and can it be that i said smth wrong? i mean that i use visual studo and not Basic srry xD
     
    Last edited by V0LT!GE, Jul 14, 2016
  10. fafaffy

    fafaffy GBAtemp Fan

    Member
    331
    160
    Sep 1, 2012
    United States
    WPF is amazing and built into Visual a Studio but is a lot more difficult to conceptualize and properly use. I wouldn't recommend you jump into yet at the moment.
     
    evandixon likes this.
  11. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    oh oke:D
    other suggestions?
     
  12. fafaffy

    fafaffy GBAtemp Fan

    Member
    331
    160
    Sep 1, 2012
    United States
    Google, stack overflow, and an ungodly amount of patience.
     
  13. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    im learing already programming so i'll have ungodly amount of Patience xD
     
  14. Kliffcom

    Kliffcom GBAtemp Regular

    Member
    144
    76
    Aug 26, 2014
    Gambia, The
    quite simple and not perfect but her it is:
     

    Attached Files:

  15. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    is it a full pjrojectmap? :) or just a Notepad file thingy?
     
  16. fafaffy

    fafaffy GBAtemp Fan

    Member
    331
    160
    Sep 1, 2012
    United States
    OP, if you're in college you can get this for free. However, (and I may be wrong) you seem younger and may need to go the way of pirates, but I strongly encourage you to use resharper. It's an amazing plugin that will pay off in the long run if you learn how to properly use it.
     
  17. Kliffcom

    Kliffcom GBAtemp Regular

    Member
    144
    76
    Aug 26, 2014
    Gambia, The
    It is the full project
     
  18. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    i start visiting college this year so thanks:) trying it out first tons of tutorials xD
    — Posts automatically merged - Please don't double post! —

    oh oke :)
    hope u did comments :P
     
    Last edited by V0LT!GE, Jul 14, 2016
  19. Kliffcom

    Kliffcom GBAtemp Regular

    Member
    144
    76
    Aug 26, 2014
    Gambia, The
    No sorry. it is just one line since the event is not in the mainform. The picture used are in the resources
     
  20. V0LT!GE
    OP

    V0LT!GE Advanced Member

    Newcomer
    99
    25
    Feb 13, 2016
    Gambia, The
    thank u and ive a question .. how can i reset the picturebox to the default 1. Picture? so when i leave the picturebox it has to be resetted to the first Picture and in this case GBATemp pĂ­cture?