WinXp Menus <-- Easy

.net , vb6 United States
  • 17 years ago

    would people please test this program for me.


    Windows XP Style Menus


    Just press the right mouse button


    the code is available for you, and is not complicated.  It uses an Imagelist and a picture box..


    no classes, or complicated menu handling..  I will be developing further for submenus, but its not bad...


    Thanks..

  • 17 years ago

    The menu's look great. Just what I was looking for to add some dazzle to an app.


    Critique...
    If you have the menu open, and an item selected...and then right click somewhere else on the for...you get the menu popping up (good) but EVER item , including spacers are highlighted (BAD)...


    You either need to deselect ALL items when a new instance of the popup is called, or remember whichh item is selected and force it to highlight....


    Other than that, well done...


    Would you mind making your code available?


    stretcheroo@hotmail.com    

  • 17 years ago

    its not co,petely finished, but i like bug reports, thanks, i`ll check it out.


    heres the code



    Example Code



    also, if you could put a blue semi transparent border, instead of the green one, i`d like to know  (When Selecting Items)

  • 17 years ago

    I wished i lived in Australia, sun, sand blue seas, the girls..


    okay, the poisonous insects and spiders that bite your arse when on the bog is bit of a down point, but still..


    better than here...

  • 17 years ago

    re-worked my winxp menus


    available at the same links, as in the previous threads


    the image is now selected along with the text, removed some redundant code


    visible, check, keycodes, submenus and mouse buttons still unsupported


    i`ll let ya know when i get around to it...

  • 17 years ago

    i`ve updated again,  fixed the error that Stretch reported to me


    (if you selected the firstitem then open the menu again, all items would be selected) (easily fixed)
    all items are created from the first control, if that is selected then the background is green, and if the menu is redrawn all items are created green (from the first control)


    will be adding flags/support for different font styles/option box like menus



    also, i need to know how to do gradient fills, semi-transparent fills (like when you click an icon and it goes blue)
    thinking of adding background picture, but picture boxes that have the item text in cant be transparent, i know labels can, but the text doesnt centre vertically..


    any help/bug reports are appreciated..


  • 17 years ago

    well living in australia isnt all that bad... im in melbourne which is(in my opinion) hte best part of australia other than quensland you get a bit of everyting in one day... which can be annoying but then again i dont go out all that much. the girls arent all that bad. and those nasty insects arent everywhere, only if your going bush or outer suburban area's.


    with regards to the WinXP menu's ill take a look tonite.

  • 17 years ago

    Do you mean by gradient fill a solid fill from color 1 to color 2, like form bars on top of windows?  If so, I have the function for you.  Just let me know if you want it.

  • 17 years ago

    Hi again


    I tried your menu. It lookes great


    I don't wanna be a critic but when I rightclicked next to the right border of the form, menu appeared but part of it was hidden

  • 17 years ago

    Everyone knows that Perth is the best place in Australia.


    It's great that people are writing stuff that allows programmers to keep up with the Microsoft interface when they don't put it in the programming system.


    VBSmart also has some nice .Net style controls.

  • 17 years ago

    Interested in submitting this to Developer Fusion when it's finished?

  • 17 years ago

    firstly thanks for all for testing..


    secondly, the menu will disappear because its basically a picturebox, and all controls are limited to inside a form.  although i could put the menu into a borderless form, and that would appear above all other forms/windows, like a proper menu..


    thirdly, i`ve got 4 resources pending (been there for ages), playing gifs, reading registry etc.  I might submit it if it all goes according to plan..


    Webjose: thats exactly what i mean, like the windows titlebar..  I also need to do a pattern, like draw every other dot.  when you select an icon from desktop it puts a blue border on the icon, but it is not solid.  WinXP also does this effect on the menus, but i cant. &nbsp;ive tried fillcolor/fillstyle but they don`t produce the desired effect..


    ill be working on the menus today, so ill let you kow about improvements, lator on..



    Thanks to all..

  • 17 years ago

    everyone take a look at http://www.vbsmart.com as Daniel said.  theres controls to mimic XP style menus/toolbars.


    better than anything i could ever produce.


  • 17 years ago

    updated the menus


    separator is smaller, you can drag the menu about by clicking the pictures or background
    draws mnemonic charactor, keyboard not supported yet.


    supports bold/italic, fixed a hilighting problem



    Had a look at the controls on VBSmart, very nice..  Youd be better off using them though, I will still continue my project. and ill be working on a toolbar as well..


    Windows XP Style Menus




    I`ve just this minute fixed a bug with menus with no picture, and added disabled feature to menu items..



    Fixed the scalemode nonsense, and adjusted some of the colours, now put semi-transparent selection on item



    Is anyone actually still interested ?

  • 17 years ago


     added Up/Down Arrow keys, ESC and Return, Also returns Item Number Selected (Not Complete Yet), i know theres a problem with the arrow keys - selecting separator/disabled items, i will fix it..

  • 17 years ago

    Code:
    Private Function CalculateGradient(ByVal color1 As Long, ByVal color2 As Long, ByVal steps As Long, ByRef arr() As Long) As Boolean


    Dim cont As Long
    Dim red() As Byte
    Dim green() As Byte
    Dim blue() As Byte
    Dim tempRed As Byte
    Dim tempGreen As Byte
    Dim tempBlue As Byte
    Dim temp() As Byte


       On Error GoTo ErrorInGradient
       ReDim red(1 To 2)
       ReDim green(1 To 2)
       ReDim blue(1 To 2)
       GetColorByPieces color1, temp
       red(1) = temp(0)
       green(1) = temp(1)
       blue(1) = temp(2)
       GetColorByPieces color2, temp
       red(2) = temp(0)
       green(2) = temp(1)
       blue(2) = temp(2)
       ReDim arr(0 To steps - 1)
       For cont = LBound(arr) To UBound(arr)
           tempRed = red(1) + Sgn(CLng(red(2)) - CLng(red(1))) * CByte(Abs(CLng(red(2)) - CLng(red(1))) / (steps - 1) * cont)
           tempGreen = green(1) + Sgn(CLng(green(2)) - CLng(green(1))) * CByte(Abs(CLng(green(2)) - CLng(green(1))) / (steps - 1) * cont)
           tempBlue = blue(1) + Sgn(CLng(blue(2)) - CLng(blue(1))) * CByte(Abs(CLng(blue(2)) - CLng(blue(1))) / (steps - 1) * cont)
           arr(cont) = RGB(tempRed, tempGreen, tempBlue)
       Next cont
       CalculateGradient = True
       On Error GoTo 0
       Exit Function


    ErrorInGradient:
       'MsgBox Err.Description
       CalculateGradient = False
    End Function


    Private Sub GetColorByPieces(ByVal color As Long, ByRef arr() As Byte)


       ReDim arr(0 To 2)
       arr(0) = (color And 255)
       arr(1) = ((color And 65535) - arr(0)) / 256
       arr(2) = ((color And 16777215) - (CLng(arr(1)) * 256 + arr(0))) / 65536
    End Sub



    The CalculateGradient function will receive two colors, the amount of "steps", and one array.  Will return false if there is an error, otherwise true.  If true, the array will contain the different colors you requested.  For example, if steps=5, then the array will contain 5 colors:  First will be color1, and last will be color2.


    GetColorByPieces will retrieve the color components for each color.  It is used by CalculateGradient.


    I have a project demonstrating the usage of this function, but I rather email it to you.  What is your email?

  • 17 years ago

    I`ve just this minute updated.


    Keycode support is very nearly there..


    up/down arrows no longer select disabled items.



    Thanks for the gradient



    This is my email address



    Thanks for the example..  I`ve updated menus, i tried to put the code into a module, but it just slowed down. I tried to make it so you could use the routines on different forms..


    You`ll have to copy he picture box and code to all forms you want the menus on..

  • 17 years ago


    a newer version: this time full row select.  but no background behind the picture


    New Style XP Menus


    I`m now working on a toolbar and sub menus..

  • 17 years ago

    Sen,


    Very slick m8


    feedback:
    Not sure if this is a bug or a feature, after left clicking on the file menu and opening it, If I left click on the form's background the menu doesn't close.


    regards


    P

  • 17 years ago

    its a bug


    i`m more woried about submenus, my brains not working no more.


    Thanks for the input..

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It works on my machine.” - Anonymous