Results 1 to 36 of 36

Thread: [VB6] sButton Multipurpose Control (last update: 31/03/2021)

  1. #1

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Post [VB6] sButton Multipurpose Control (last update: 31/03/2021)

    WHAT IT IS?
    ---------------


    sButton is a multipurpose control (initially created as a button, hence the name)
    It can be used as:
    -Button: with rounded border,shadow,caption,icon or font icon, and alpha for each element.
    -Label: with multiline, alpha, rotation and autosize (width/height/both)
    -Display a PNG: with rotation,effects,resize,alpha and stretch.
    -To display Font Awesome icons (or any other font icon like webdings,etc.)
    -To mimic a checkbox/option.
    -As a magnifier glass.
    -To add Zoom / Translucency effect.

    Can customize image/colors for normal,hover and disabled state.
    Can animate changes in color for border,button,caption (configurable time).
    New events: MouseEnter,MouseLeave,MouseHover (configurable time).
    The control can be filled with 1 color, 2 colors in grandient with angle and alpha,
    texture with position adjust and stretch or windows hatch patterns.
    Can draw outside button area.
    If using image icon, disabling the button auto grey image.
    Support 2 ways of drawing text with effects: GDI Paths or GDI DrawStrings.
    Can have preset or custom hover mousepointer.


    It also include a FontManager class to use custom fonts without requiring
    admin privilegies to install them.


    It use MST for subclassing by wqweto


    Everything on the screenshots is made with sButton's
    Name:  sB_Demo0.jpg
Views: 1825
Size:  25.7 KBName:  sB_Demo1.jpg
Views: 2125
Size:  37.4 KBName:  sB_Demo2.jpg
Views: 1752
Size:  27.3 KBName:  sB_Demo4.jpg
Views: 2049
Size:  25.3 KB


    Dependecy: GDI+ installed (so that mean XP and up)

    DOWNLOAD: sButton_v1.8.zip




    STABILITY/BUGS
    ------------------------


    Tested on Windows 7 (32/64),8(64),10(64)
    Stress checked for memory leaks loading and unloading forms with instances of sButton
    thounsands of times. No memory leaks found and compiled program still run stable.
    It 's not optimized but it was created for data driven apps and not games so
    performance is perfectly aceptable.
    This is my first take with GDI and pretty sure some things may be wrong.


    BUG: Control dont autoextend for text rotation
    FIX: Make the control bigger adding 'Button_padding'



    VERSION HISTORY
    --------------------------

    v1.0
    -Added basic Events: MouseEnter,MouseLeave,MouseMove,MouseHover(keep over x time)
    -Tracking of Area is not interrupted by other controls over it.
    -Rounded borders
    -Caption draw using paths
    -Caption text effects (predefined outlines and shadows)
    -Support Font Awesome Icon (Icon size selected in font size)
    -Support PNG icon for Normal/Hover/Disabled state
    -Icon can be resized (option to keep Aspect Ratio)
    (For Font icons use Icon_FA_Font size, for image icon use Icon_Img_SizeW and Icon_Img_SizeH)
    -FA Icon/Other fonts icon selector with live preview (double click Icon_FA_selector property to open)
    -Padding for Button, Text and Icon
    (Button Padding is relative to usercontrol size, other paddings are relative to button area)
    -Color transition animation for Button face,Border and Text
    -Color transition animation selectable Time in MS
    -Allow to set mouse hover pointer with custom and predefined images (.SetMouseHoverPointer)
    -Icon/FA Rotation and Caption Rotation
    -SetPicture/GetPicture methods to change images directly
    -Gradient Fill (2 colors),Texture Fill, Hatched Fill
    -Gradient and texture fill support rotation,displacement and alpha
    -Presets
    -Extra Tag2 and Tag3 for user defined data stored in properties
    -Icon_Img_Opacity also control Font Icon opacity
    -Caption Opacity


    v1.1
    -Added pixeloffset to Path drawing for clearer text
    -Bugfix: icon selector (messed up with last minute changes in v1.0)
    -Bugfix: Removed deleted functions call
    -Changed SendMessage for SendNotifyMessage in FontManager

    v1.2
    -Added Accesskey (detected from caption like standard command button)
    -Auto replace font 'MS Sans Serif' (Raster) with True Type version

    v1.3 (02/03/2020)
    -Added Icon_Img_Scale
    -Icon_Img_AutoResize (resize or stretch img when control is resized)

    v1.4
    -Show focus underlining caption (if TabStop=true and not locked/disabled).
    if there is no caption it will simulate a mousehover


    v1.5
    -Added variable Blur effect (Based on Acrylic blur by Leandro Ascierto)
    -Added variable Zoom effect: Values between 0 and 1 are zoom out.
    Negative values disable tiling filling for zoom out.
    -Font Icon and Caption are not blured/zoomed (intended)
    -Updated Demo 2, Added Demo 5
    -New presets for TextureFill,Blur and Zoom
    -New sub setGlobalOpacity(x) for fast switching of all transparencies (except shadows)
    -Avoid showing focus when form is loaded

    v1.6
    -Not happy with the focus handling I removed code for "Avoid showing focus when form is loaded" from v1.5
    -Added prop ShowFocusType wich control when and how to show focus.
    It can be set to:
    None = 0 'Never show focus
    Tab_Underline = 1 '[DEFAULT] Underline caption text (only if focus is gained pressing TAB key)
    Tab_Over = 2 'Simulate mouse over (only if focus is gained pressing TAB key)
    Always_Underline = 3 'Underline caption text (no matter how it got the focus)
    Always_Over = 4 'Simulate mouse over (no matter how it got the focus)
    Set to Always... when you want to show focus on form load or Tab... when only changing focus with Tab key

    v1.7b)
    -DESIGN MODE: Caption updates as you type
    -Cursor Hand No more hardcoded, now is taken from system (should be DPI aware.Not tested)


    v1.8
    -Added GlobalQualityGFX, GlobalQualityTXT (only affects Caption draw on mode2)
    -Force to not draw using antialias for small img icons when there is no effect (<64px and square AR)
    -Caption Draw Mode names changed to reflect quality type used for each mode:
    now are eS_GFX_Paths and eS_TXT_DrawString wich are affected by diferent Global Quality modes
    -Fixed Bug when disabling button when mouse was over it
    -Fixed Bug when a msgbox was inside click event causing sButton not drawing
    -Fixed Bug when form unload was set on sButton events
    -Fixed and reworked mouse events logic:
    -Hover dont raise if mouse is pressed
    -No more intermitent hover colors when moving with mouse pressed
    -Faster repeated single clicks (thanks Leandro Ascierto for the tip)
    -Added DblClick event

  2. #2

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Name:  sB_Demo3.jpg
Views: 1941
Size:  24.9 KB
    Name:  sB_Demo5.jpg
Views: 1767
Size:  24.0 KB
    Name:  sB_Demo5v2.jpg
Views: 1758
Size:  23.2 KB
    Name:  sB_DemoIconSel.jpg
Views: 1885
Size:  33.6 KB
    (Icon selector with live preview)

  3. #3
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: VB6 - sButton Multipurpose Control

    There doesn't appear to be any coding question here, so is posted in the wrong forum. I would think this should be in the CodeBank. I've reported the thread, so the moderator's should move it if they agree.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  4. #4

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by passel View Post
    There doesn't appear to be any coding question here, so is posted in the wrong forum. I would think this should be in the CodeBank. I've reported the thread, so the moderator's should move it if they agree.
    Thanks Passel. Yes, I posted it wrong and send a PM to a moderator because I didn't know how to move it myself.

  5. #5
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: VB6 - sButton Multipurpose Control

    You have to use

    Code:
    Private Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    with HWND_BROADCAST instead of plain SendMessage or risk hanging when a top-level window is owned by a process that does not spin msg pump. (It did here on my PC).

    cheers,
    </wqw>

  6. #6
    Lively Member
    Join Date
    Sep 2016
    Location
    Texas panhandle
    Posts
    64

    Re: VB6 - sButton Multipurpose Control

    Very nice.
    Two issues:
    'DrawTextUnicode Can't create FontFamily: [MS Sans Serif] in immediate window

    pvAdjustBorderPadding not found in project

  7. #7
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: VB6 - sButton Multipurpose Control

    Moved, and thanks for the contribution.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  8. #8

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by wqweto View Post
    You have to use

    Code:
    Private Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    with HWND_BROADCAST instead of plain SendMessage or risk hanging when a top-level window is owned by a process that does not spin msg pump. (It did here on my PC).

    cheers,
    </wqw>

    Never thought about that case. Updated! Thanks!

  9. #9

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by VBClassic04 View Post
    Very nice.
    Two issues:
    'DrawTextUnicode Can't create FontFamily: [MS Sans Serif] in immediate window

    pvAdjustBorderPadding not found in project
    The First one... I think MS Sans Serif is not a True Type font, but a Raster font. The True Type version is called "Microsoft San Serif". GDI can only work with True Type (I run in some problem on windows 7 with Opentype so to be sure just use True Type) (https://en.wikipedia.org/wiki/Microsoft_Sans_Serif)

    Second one... Done!!! Originally I made the control to work in windowed and windowless mode, but later I decided it was a headache and not gainging enough for the windowed version. So scrapped that part and missed to remove that function call.Now its deleted. Thanks!!!

  10. #10
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    506

    Re: VB6 - sButton Multipurpose Control

    good job

  11. #11
    New Member
    Join Date
    Aug 2018
    Posts
    8

    Re: VB6 - sButton Multipurpose Control

    Excelente control, una consulta, al arrancar el proyecto me salta esto en el log:

    DrawTextUnicode Can't create FontFamily: [Font Awesome 5 Free Solid]

    Y si tengo agregado el font

    Gracias

  12. #12
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VB6 - sButton Multipurpose Control

    Great project! (it's best to have a vb.net version if you can. )

    This is the problem I found in my test:

    1. Registering fonts at startup will cause explorer to restart.

    2. The button does not respond to the shortcut key.
    QQ: 289778005

  13. #13
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VB6 - sButton Multipurpose Control

    Great project! (it's best to have a vb.net version if you can. )

    This is the problem I found in my test:

    1. Registering fonts at startup will cause explorer to restart.

    2. The button does not respond to the shortcut key.

    Name:  无标题.jpg
Views: 1869
Size:  28.7 KB
    QQ: 289778005

  14. #14

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by YvanB View Post
    Excelente control, una consulta, al arrancar el proyecto me salta esto en el log:

    DrawTextUnicode Can't create FontFamily: [Font Awesome 5 Free Solid]

    Y si tengo agregado el font

    Gracias
    Tenes instalado el font en version TRUE TYPE ? porque yo tuve problemas con la version OTF.
    Podes intentar compilar el proyecto y correr el exe para testear. Desde el IDE no corre la rutina de instalación porque se supone que esta pensada para las pc de los usuarios.


    ENGLISH:
    Do you have the TRUE TYPE version of the font installed? I got problems if the one installed was in OTF format.
    Try compiling the project and run the exe file. Running from the IDE will not install the fonts cause its intended for the end users pc and not the developing machine.

  15. #15

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by ChenLin View Post
    Great project! (it's best to have a vb.net version if you can. )

    This is the problem I found in my test:

    1. Registering fonts at startup will cause explorer to restart.

    2. The button does not respond to the shortcut key.
    Hi ChenLin!

    1) Happened to me on windows 10... other OS's seems fine. I call it a microsoft bug :/ Can you test removing the broadcast after installing the font?
    2) That's not a bug... Unfortunatelly I have not implemented it yet for now you should capture the keys in the form (with keypreview set to true) and then call the apropiate click event. I will add it to the TODO list.

  16. #16

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by VBClassic04 View Post
    Very nice.
    Two issues:
    'DrawTextUnicode Can't create FontFamily: [MS Sans Serif] in immediate window

    pvAdjustBorderPadding not found in project
    I added a font auto replace for that font so now it can work without problems when for some reason windows make a font substitution with that specific font.

  17. #17

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by ChenLin View Post
    Great project! (it's best to have a vb.net version if you can. )
    I dont like .Net at all... I moved to web, but still love to code in VB6.


    Quote Originally Posted by ChenLin View Post
    2. The button does not respond to the shortcut key.
    I added it now in v1.2!

  18. #18
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VB6 - sButton Multipurpose Control

    These icons don't display correctly. I registered fonts when I was in formload.

    Name:  无标题.jpg
Views: 1857
Size:  21.5 KB
    QQ: 289778005

  19. #19
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by ChenLin View Post
    These icons don't display correctly. I registered fonts when I was in formload.

    Name:  无标题.jpg
Views: 1857
Size:  21.5 KB
    This problem is a font problem.There are differences in fonts for different language versions. You can modify them yourself

  20. #20
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by shagratt View Post
    WHAT IT IS?
    ---------------


    sButton is a multipurpose control (initially created as a button, hence the name)
    It can be used as:
    -Button: with rounded border,shadow,caption,icon or font icon, and alpha for each element.
    -Label: with multiline, alpha, rotation and autosize (width/height/both)
    -Display a PNG: with rotation,effects,resize,alpha and stretch.
    -To display Font Awesome icons (or any other font icon like webdings,etc.)
    -To mimic a checkbox/option.


    Can customize image/colors for normal,hover and disabled state.
    Can animate changes in color for border,button,caption (configurable time).
    New events: MouseEnter,MouseLeave,MouseHover (configurable time).
    The control can be filled with 1 color, 2 colors in grandient with angle and alpha,
    texture with position adjust and stretch or windows hatch patterns.
    Can draw outside button area.
    If using image icon, disabling the button auto grey image.
    Support 2 ways of drawing text with effects: GDI Paths or GDI DrawStrings.
    Can have preset or custom hover mousepointer.


    It also include a FontManager class to use custom fonts without requiring
    admin privilegies to install them.


    It use MST for subclassing by wqweto


    Everything on the screenshots is made with sButton's
    Attachment 174927
    Name:  sB_Demo1.jpg
Views: 2125
Size:  37.4 KB
    Attachment 174931
    Name:  sB_Demo4.jpg
Views: 2049
Size:  25.3 KB


    Dependecy: GDI+ installed (so that mean XP and up)

    DOWNLOAD: Attachment 174975




    STABILITY/BUGS
    ------------------------


    Tested on Windows 7 (32/64),8(64),10(64)
    Stress checked for memory leaks loading and unloading forms with instances of sButton
    thounsands of times. No memory leaks found and compiled program still run stable.
    It 's not optimized but it was created for data driven apps and not games so
    performance is perfectly aceptable.
    This is my first take with GDI and pretty sure some things may be wrong.


    BUG: Control dont autoextend for text rotation
    FIX: Make the control bigger adding 'Button_padding'



    VERSION HISTORY
    --------------------------

    v1.0
    -Added basic Events: MouseEnter,MouseLeave,MouseMove,MouseHover(keep over x time)
    -Tracking of Area is not interrupted by other controls over it.
    -Rounded borders
    -Caption draw using paths
    -Caption text effects (predefined outlines and shadows)
    -Support Font Awesome Icon (Icon size selected in font size)
    -Support PNG icon for Normal/Hover/Disabled state
    -Icon can be resized (option to keep Aspect Ratio)
    (For Font icons use Icon_FA_Font size, for image icon use Icon_Img_SizeW and Icon_Img_SizeH)
    -FA Icon/Other fonts icon selector with live preview (double click Icon_FA_selector property to open)
    -Padding for Button, Text and Icon
    (Button Padding is relative to usercontrol size, other paddings are relative to button area)
    -Color transition animation for Button face,Border and Text
    -Color transition animation selectable Time in MS
    -Allow to set mouse hover pointer with custom and predefined images (.SetMouseHoverPointer)
    -Icon/FA Rotation and Caption Rotation
    -SetPicture/GetPicture methods to change images directly
    -Gradient Fill (2 colors),Texture Fill, Hatched Fill
    -Gradient and texture fill support rotation,displacement and alpha
    -Presets
    -Extra Tag2 and Tag3 for user defined data stored in properties
    -Icon_Img_Opacity also control Font Icon opacity
    -Caption Opacity


    v1.1
    -Added pixeloffset to Path drawing for clearer text
    -Bugfix: icon selector (messed up with last minute changes in v1.0)
    -Bugfix: Removed deleted functions call
    -Changed SendMessage for SendNotifyMessage in FontManager

    v1.2
    -Added Accesskey (detected from caption like standard command button)
    -Auto replace font 'MS Sans Serif' (Raster) with True Type version
    I have some suggestions
    1. broderroundedpx : When set to a circle, dragging the control will not be able to maintain the circle.
    2. icon size keepAR When the picture is set, dragging the control cannot adapt the size of the control .you can add Scale by control size

  21. #21

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by xxdoc123 View Post
    1. broderroundedpx : When set to a circle, dragging the control will not be able to maintain the circle.
    Hi xxdoc123! With draggin you mean resizing ? When you set the preset it maintain the circle, but the preset is not stored (this is intentionally), so after saving the form and reopening its up to you to keep the circle.


    Quote Originally Posted by xxdoc123 View Post
    2. icon size keepAR When the picture is set, dragging the control cannot adapt the size of the control .you can add Scale by control size
    I think Icon and button sizes are not related. Keeping Aspect Ratio was intented for when you change only one of the dimensions. If I got all my icons in 32x32 and make one button bigger for the caption dosnt mean I should resize the button icon automatically
    At some point I though about adding a "Button_Icon_Scale" propertie but forget it... gonna add it to the todo list. Thanks!

  22. #22

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control

    Quote Originally Posted by xxdoc123 View Post
    you can add Scale by control size
    Added 'Icon_Img_Scale' on v1.3

  23. #23
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VB6 - sButton Multipurpose Control (last update: 02/03/2020)

    How do I get the Icon_FA_Code value? I selected a font, but I don't know how this Icon_FA_Code should be entered.
    QQ: 289778005

  24. #24
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 - sButton Multipurpose Control (last update: 02/03/2020)

    Quote Originally Posted by ChenLin View Post
    How do I get the Icon_FA_Code value? I selected a font, but I don't know how this Icon_FA_Code should be entered.
    in the code you can find fontview. #2 the picture show the fontview

  25. #25

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control (last update: 02/03/2020)

    Quote Originally Posted by ChenLin View Post
    How do I get the Icon_FA_Code value? I selected a font, but I don't know how this Icon_FA_Code should be entered.
    You have 2 ways:
    1) As xxdoc123 told you, there is a property wich open the Icon selector. Its called "Icon_FA_Selector", just double click in the value and it will open.
    2) If you are using Font Awesome, you can have this codes from the cheatsheets:
    https://fontawesome.com/cheatsheet

  26. #26

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control (last update: 26/04/2020)

    Updated...

    v1.4

    -Show focus underlining caption (if TabStop=true and not locked/disabled).
    if there is no caption it will simulate a mousehover


    v1.5
    -Added variable Blur effect (Based on Acrylic blur by Leandro Ascierto)
    -Added variable Zoom effect: Values between 0 and 1 are zoom out.
    Negative values disable tiling filling for zoom out.
    -Font Icon and Caption are not blured/zoomed (intended)
    -Updated Demo 2, Added Demo 5
    -New presets for TextureFill,Blur and Zoom
    -New sub setGlobalOpacity(x) for fast switching of all transparencies (except shadows)
    -Avoid showing focus when form is loaded


  27. #27
    New Member
    Join Date
    Apr 2020
    Posts
    5

    Re: VB6 - sButton Multipurpose Control (last update: 26/04/2020)

    hello thank you for your work.. i'm trying to use it but i'v few questions...
    1) i try to put png image as button background but i'm not able (or maybe impossible to do) make to change background color of the button onmouseover... so if i make a png with text and image the background remain transparent don't get the color backgroud that i choose.
    2) if i add icon image from font or icon image from file i use control activeresize to make all controls on form resize by screen resolution the icon will not be resized still remain little but the button and the caption are bigger...

    i'm not able to use this 2 features or are not present?

    thank you

  28. #28

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control (last update: 26/04/2020)

    Quote Originally Posted by dillo83 View Post
    hello thank you for your work.. i'm trying to use it but i'v few questions...
    1) i try to put png image as button background but i'm not able (or maybe impossible to do) make to change background color of the button onmouseover... so if i make a png with text and image the background remain transparent don't get the color backgroud that i choose.
    2) if i add icon image from font or icon image from file i use control activeresize to make all controls on form resize by screen resolution the icon will not be resized still remain little but the button and the caption are bigger...

    i'm not able to use this 2 features or are not present?

    thank you
    I have a hard time trying to understand your question...
    1) You want to use an image as background? How?
    You can use it as a texture setting it in "ButtonFillImage" and setting "ButtonFillStyle" to TextureFill... in that case you cant use any color.
    But also you can put your image as an icon and backcolor will be behind the image (or blend with the transparency of the png)... in that case you can. Check your "ButtonColorOpacityHover", should not be 0 or it will ignore the color on mouseover.

    2) I dont know what is activeresize.... You should resize it accordingly in your form_resize event. Example: If your FA_icon use the same fontsize as the caption, try after calling activeresize to set the ControlName.Icon_FA_font.fontsize = ControlName.font.fontsize
    This "activeresize" resize the icons on standard commanbuttons or have the same problem???

  29. #29
    New Member
    Join Date
    Apr 2020
    Posts
    5

    Re: VB6 - sButton Multipurpose Control (last update: 26/04/2020)

    hello thank you for your answer...
    now i'm trying to use fontawesome for the icon but the control dont recognize the cheatsheets of the icons... other fonts all ok i can use the icons but font awesome no just appear square...
    about the icon font size i tried to make icon_fa_font.fontsize = controlname.font.size it works (i must add some number from the font.size to the icon.size because the icon will be very little but not such a big problem)

    finally is it possible to create an ocx of the control to use in the project of my software?

  30. #30
    New Member
    Join Date
    Apr 2020
    Posts
    5

    Re: VB6 - sButton Multipurpose Control (last update: 26/04/2020)

    -----
    Last edited by dillo83; May 1st, 2020 at 10:50 AM. Reason: double post

  31. #31

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control (last update: 26/04/2020)

    Quote Originally Posted by dillo83 View Post
    hello thank you for your answer...
    now i'm trying to use fontawesome for the icon but the control dont recognize the cheatsheets of the icons... other fonts all ok i can use the icons but font awesome no just appear square...
    about the icon font size i tried to make icon_fa_font.fontsize = controlname.font.size it works (i must add some number from the font.size to the icon.size because the icon will be very little but not such a big problem)
    Are you using the included font awesome? Make sure you dont have an installed font awesome in Open Type format registered. It can cause problems

    finally is it possible to create an ocx of the control to use in the project of my software?
    Of course! Just make a UC project with all the files inside the USERCONTROL folder... you dont need the demo files or any font

  32. #32
    New Member
    Join Date
    Apr 2020
    Posts
    5

    Re: VB6 - sButton Multipurpose Control (last update: 26/04/2020)

    ok thank you,

    i tried to install the font awesome in the folder zip and with this i see icons (but is not possible to use the font awesome pro?)

    i was able to make the ocx with few line code change about public\private enum etc...

    when i put the control on the windows form i'm not able to do the bring to front still remain on back... is it possible to do something to have the control in front?
    is it possible to evitate that when button click change color? i mean.. if i click the button he change like onhover and make underline the caption.. is possible to evitate that? i setup the button and i want remain the same if i click or not... the hover change it's cool but i wish that the button remain the same when clicked not remain like hover
    Last edited by dillo83; May 2nd, 2020 at 05:00 AM.

  33. #33

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control (last update: 03/05/2020)

    Update:

    v1.6
    -Not happy with the focus handling I removed code for "Avoid showing focus when form is loaded" from v1.5
    -Added prop ShowFocusType wich control when and how to show focus.
    It can be set to:
    None = 0 'Never show focus
    Tab_Underline = 1 '[DEFAULT] Underline caption text (only if focus is gained pressing TAB key)
    Tab_Over = 2 'Simulate mouse over (only if focus is gained pressing TAB key)
    Always_Underline = 3 'Underline caption text (no matter how it got the focus)
    Always_Over = 4 'Simulate mouse over (no matter how it got the focus)
    Set to Always... when you want to show focus on form load or Tab... when only changing focus with Tab key

  34. #34

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: VB6 - sButton Multipurpose Control (last update: 26/04/2020)

    Quote Originally Posted by dillo83 View Post
    (but is not possible to use the font awesome pro?)
    Its totally posible! I use it! but for the demo I packed the distributable version (non pro). You just need to install the TTF version only.


    ... is it possible to do something to have the control in front?
    No without loosing some functionality. Its a windowless control (like label, image, shapes) so It can be on top of that controls but never on top of a TextBox or any windowed control. One trick you can do is to put a picturebox ontop of yuour controls and put the sButton inside the picturebox.

    is it possible to evitate that when button click change color?
    Yes! Download v1.6 I just changed that because I also dont like how it ended working in 1.5 , now you have total control on how to show focus (or not show it at all)

  35. #35
    New Member
    Join Date
    Apr 2020
    Posts
    5

    Re: [VB6] sButton Multipurpose Control (last update: 03/05/2020)

    thank you i'm glad you agree with the focus.. (i was able to block this with the modify status but thank you for your update!)

    for your exeperience... is more fast the load of this button or the load of a jpg inside picturebox? i ask because i'm trying to make more fast and less hungry of pc resource my application.... at the moment every single button inside software is a picture box with inside an image loaded from file jpg (not inside exe but withloadpicture from folder everytime load a form)

  36. #36

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    198

    Re: [VB6] sButton Multipurpose Control (last update: 31/03/20210)

    Update:

    v1.7b)
    -DESIGN MODE: Caption updates as you type
    -Cursor Hand No more hardcoded, now is taken from system (should be DPI aware.Not tested)


    v1.8
    -Added GlobalQualityGFX, GlobalQualityTXT (only affects Caption draw on mode2)
    -Force to not draw using antialias for small img icons when there is no effect (<64px and square AR)
    -Caption Draw Mode names changed to reflect quality type used for each mode:
    now are eS_GFX_Paths and eS_TXT_DrawString wich are affected by diferent Global Quality modes
    -Fixed Bug when disabling button when mouse was over it
    -Fixed Bug when a msgbox was inside click event causing sButton not drawing
    -Fixed Bug when form unload was set on sButton events
    -Fixed and reworked mouse events logic:
    -Hover dont raise if mouse is pressed
    -No more intermitent hover colors when moving with mouse pressed
    -Faster repeated single clicks (thanks Leandro Ascierto for the tip)
    -Added DblClick event

Tags for this Thread

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