Results 1 to 16 of 16

Thread: custom shape buttons

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982

    Talking

    Does anyone know how to make custom shape buttons, something like arrows, circles and ovals.

    Any help would be appreciated.


    Things I do when I am bored: DotNetable

  2. #2
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    well, if you created normal buttons, you could cut them at certain places (using SetWindowRgn). But they wouldn't be 3-D. I can give you an example if you so desire!
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    you may also want to consider the LCARS button from kedaman

    http://www.geocities.com/kedasu/kedacode.html
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    i can turn any object into a button including the form. So when you click it it goes down then up. if you want a ex.. telll me,

    it goes like this though
    Object = well like a label name or picture name ex:

    lblYourName

    Code:
    on mouse down put this code
    
    object appearance = 0
    object borderstyle = 0
    
    then on mouse up put 
    
    object appearance = 1
    object borderstyle = 1
    try it though
    I hope this helped if it did tell me please thank you.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  5. #5
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    i think mines would be esier cause u can draw a shape and pake it into a button . Am i right ?
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  6. #6
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    yeh, but your method won't support curves, i don't know if windows can draw 3d in curves. You may have to use an image with white on the top and black on the bottom and swap it to get the 3d effect on a curved surface
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  7. #7
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    ive drawn curves before... (createellipticalrgn)
    Is this what you meant?
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982

    Smile buttons

    Any examples would be appreciated.


    Things I do when I am bored: DotNetable

  9. #9
    Hyperactive Member Alan777's Avatar
    Join Date
    Jan 2001
    Location
    New Zealand
    Posts
    303
    One of my favorite subjects in VB is control creation.
    It is not too hard to create any kind of button you like by making your own "owner drawn" activeX controls.

    All you need is a good book to get you started.
    I will send an example soon. (have to make one first!)
    "Today's mighty oak is just yesterday's nut,
    that held its ground."

  10. #10
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Look at this example on vbworld for odd shaped forms and you will get a way to change the shape of any window that exposes it handle property. http://www.vb-world.net/articles/shapedforms/

  11. #11
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752
    I have once created a circular button. What I did was that I used the CreateEllipticRgn APi on a usercontrol. Then 2 arcs were drawn at the edges of the circle, one black and one white . And in the mousedown and mouseup events you can switch the colors to produce the pressing effect
    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  12. #12
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752
    Do anyone has anyideas to create a round 3d form?
    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  13. #13
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    I would imagine you could probably create one the same way as the button. Just supply the form handle instead of the button one.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  14. #14
    Addicted Member KrishnaSantosh's Avatar
    Join Date
    Feb 2001
    Location
    Coimbatore
    Posts
    210
    Public Declare Function CreateEllipticRgn Lib "gdi32" Alias "CreateEllipticRgn" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

    Public Declare Function SetWindowRgn Lib "user32" Alias "SetWindowRgn" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

    private sub form_Load()
    dim hrgn as long
    hrgn=createellipticrgn(0,0,button1.width/screen.twipsperpixelx,button1.height/screen.twipsperpixelsy)

    setwindowrgn button1.hwnd,hrgn,true

    End Sub

    Incase of problems Please EMail Me.

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    I thought you may like to know what the conclusion of my testing all the different suggestions made regarding my question.

    JasonLpz
    A good suggestion if you want something quick to code but not really efficient. I you perform a lot of rapid mouse clicks there are some mouse clicks which are missed and nothing happens at all.

    KrishnaSantosh
    The efficiency loss mentioned above is overcome and not a single mouse click is lost. Unfortunately you loose some of the 3D look.

    crptblade
    The LCars button is not 3D

    faisalkm
    I think this is the preffered method as it will give greater scope for custom functionality and is really a more refined version of the KrishnaSantosh version.

    thanks to everyone who posted suggestions.


    Things I do when I am bored: DotNetable

  16. #16
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    If you do use KrishnaSantosh's code, remember to use deleteobject api call just after SetWindowRegion to free up memory.

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