[VB6] FIRENZE LABEL - label control with so many functions-VBForums
Results 1 to 30 of 30

Thread: [VB6] FIRENZE LABEL - label control with so many functions

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Lightbulb [VB6] FIRENZE LABEL - label control with so many functions

    FIRENZE LABEL
    version 1.1.1

    last actualization: 26.3.2017


    Created by Martin Vartiak, powered by Cairo Graphics and vbRichClient-Framework.
    LICENSE: http://creativecommons.org/licenses/...1.0/fi/deed.en




    1. Shortly about the project Firenze Label

    All starts simply as always. I was looking for a simple anti-aliasing solution for VB6 because I was never satisfied with original one. Found some examples on the web, but as a graphic designer I was still very disappointed with results. After further search I found very interesting .dll library for graphic use of Cairo Graphics. At the first sight all was so complicated for me. I started to play with that library and decide to make very simple ActiveX component just for me. As I started to add more and more functions it becomes very user friendly component. And now i want to share it with you.



    2. What makes Firenze Label so special?

    Imagine me or you as a graphic designer and now remeber to basic VB6 Label component. Practically you can do nothing special with it, there are missing even some basic functions as a Vertical Alignment. I will try to describe most of the functions of the Firenze Label and you can imagine the endless possibilities of it use. With these properties and functions you can possibly achieve most of the modern design functions.

    Custom Properties:
    BackColor - ordinary back color
    BackColorOpacity - back color with opacity (0-100)
    Border - draws a border around the component
    BorderColorOpacity - opacity of border (0-100)
    BorderCorner - you can apply a mask for corners (i.e. you can mask only top corners for a tab strip)
    BorderPosition - position of border
    BorderRadius - border radius
    BorderSmoothEdge - property for a better and smoother border in some cases
    Border Width - border width
    Caption - main text
    CaptionAlignmentH - horizontal alignment of caption (left/center/right)
    CaptionAlignmentV - vertical alignment of caption (top/middle/bottom)
    CaptionPadding - padding for a caption
    Cursor - you can choose between arrow and hand cursor (as on the website)
    Font - don’t affraid to use all of the modern fonts with proper antialiasing
    FontAwesome - if you lazy downloading custom icons, you can use hex codes of FontAwesome and get so many scalable icons so fast
    ForeColor - simple ForeColor property
    ForeColorOpacity - opacity for ForeColor (0-100)
    Gradient - turn on if you like gradient background
    GradientAngle - determines in which angle should gradient be drawn (0-360)
    GradientColor1 - gradient color 1
    GradientColor1Opacity - opacity for gradient color 1
    GradientColor2 - gradient color 2
    GradientColor2Opacity - opacity for gradient color 2
    ParentControl - child control shares all functionality of the parent control
    Picture - you like modern .png or .svg pictures? (path to the picture)
    PictureAlignmentH - horizontal aligment of picture
    PictureAlignmentV - vertical alignment of picture
    PictureOpacity - picture opacity (0-100)
    PicturePadding - picture padding
    PictureSVGScale - after you load .svg picture, you can scale it up or down
    WordWrap - wordwrap, because why not

    Custom events:
    MouseEnter
    MouseLeave


    Practically you can use opacity on everything. You can use Firenze Label just to show .png or .svg picture if you want. Possibilities are endless.



    3. Next developement

    I have sooo many ideas for the next developement. Possibly I can “hire” someone for a optimalization of code and make it even more fast and pixel perfect.

    Main goals to achieve:
    - add all planned functions
    - custom website
    - custom installation file
    - complete documentation
    - more examples and sample codes



    4. Showcase

    Showtime
    Working examples you can download.

    Name:  admin.jpg
Views: 1073
Size:  18.8 KB
    Name:  einstein.jpg
Views: 1067
Size:  99.0 KB


    What you can achieve with Firenze Label. (Sorry, there are lot of more but this post can have only 5 attachements)

    Name:  calendar.jpg
Views: 1056
Size:  22.7 KB Name:  icerikdashh.jpg
Views: 1041
Size:  19.9 KB


    5. Download

    IMPORTANT NOTICE:
    you have to add project reference vbRichClient5 (download from http://www.vbrichclient.com/#/en/Downloads.htm)
    icons from the examples are not pictures but windows font FontAwesome, you need to download and install it first (download from http://fontawesome.io/).


    DOWNLOAD Firenze Label source code:
    FirenzeLabel.zip



    PROJECT IS IN DEVELOPEMENT.
    Ask freely if you don't understand to something. I realize I didn't make it well documented for now, but I don't want to spam here a lot of text and explanations. For more questions or explanations send me PM or write here. Enjoy!


    Matt
    Last edited by porkynet; Mar 27th, 2017 at 08:39 AM.

  2. #2

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    What you can achieve with use of Firenze Label control.

    Name:  mittcsnfullpixels.jpg
Views: 701
Size:  32.2 KB Name:  preview.jpg
Views: 705
Size:  22.3 KB Name:  restaurant.jpg
Views: 684
Size:  43.8 KB Name:  weather.jpg
Views: 682
Size:  30.0 KB

  3. #3
    Hyperactive Member
    Join Date
    Sep 2012
    Posts
    404

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Great, thanks very much.

  4. #4
    Member
    Join Date
    May 2016
    Location
    China
    Posts
    46

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    It's beautiful! I did not expect VB6 can do so beautiful, support you do better!!!

  5. #5
    Member
    Join Date
    May 2016
    Location
    China
    Posts
    46

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    My system language is Chinese, there are some pictures why the display is not correct?
    Name:  a.jpg
Views: 679
Size:  21.5 KB

    我的QQ:28978005,欢迎使用中文环境的一起测试这个好代码。
    Last edited by ChenLin; Mar 26th, 2017 at 06:40 PM.

  6. #6

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    As I mentioned it before in the IMPORTANT NOTICE at the end of the post, but I didn't explain it very well.

    1. WHAT IS FONT AWESOME?
    FontAwesome is windows and web font (mostly used on websites, must have for graphic designers) which contains 675 icons as a scalable vector.

    2. INSTALLATION
    You need to download it from http://fontawesome.io/ at first then install it (just copy file "FontAwesome.otf" to "C:\Windows\Fonts".
    Afterwards you will see all the icons used in examples correctly.

    3. USING YOUR OWN FONT AWESOME ICONS
    If you want to use own icon from FontAwesome, then check http://fontawesome.io/cheatsheet/. Every icon have own code, for example fa-home []. To use it in the Firenze Label control you have to choose font FontAwesome (we assume you already installed it) and in FontAwesome property you need to write last two characters from icon code at first and then fourth and third from the end. For example from code [] write just 15f0.

    4. FONT AWESOME IS FAST AND SIMPLE
    Using Font Awesome is fast and simple. Anyways, you can always use own custom icons as a picture. Good website for free modern customizable icons is https://icons8.com/.



    Matt

  7. #7
    Junior Member
    Join Date
    Nov 2011
    Posts
    30

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Loving this control. Just started playing with it.
    Would it be possible to Auto size a large image to fit control.
    Not a problem if not as i would resize an image before displaying.
    Been Looking for a long time a semi transparent label/image control.
    Excellent work.

  8. #8

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Thanks for your positive respond.
    Autoresizing large image should be possible, give me some time and I can implement it.
    After all it's good function, but take care of size of images.
    When you scale down 1 MB .jpg file it will still have have 1 MB.


    Matt

  9. #9
    Junior Member
    Join Date
    Nov 2011
    Posts
    30

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Hi Matt
    I have some fanart pictures that are 1920 x 1080 in different folders
    I am looking to create a display to show an image in a control.
    Over this i will add a movie poster image and to the middle bottom add another control
    with the plot summary. 50 % opacity. trying to make a good looking Movie info screen
    If you add the Autosize feature, will you use GDI to scale image or someother method.
    tks. great work

  10. #10

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by k_zeon View Post
    Hi Matt
    I have some fanart pictures that are 1920 x 1080 in different folders
    I am looking to create a display to show an image in a control.
    Over this i will add a movie poster image and to the middle bottom add another control
    with the plot summary. 50 % opacity. trying to make a good looking Movie info screen
    If you add the Autosize feature, will you use GDI to scale image or someother method.
    tks. great work
    Cairo (graphics library which we use) have scale function already implemented. I'm just need to rewrite some code and test it properly.

  11. #11
    Junior Member
    Join Date
    Nov 2011
    Posts
    30

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    many thanks, look forward to it.
    One other question. Sometimes i need to hold a picture in an image/picture control, then assign it
    ie Pic1.Picture = Pic2.Picture
    Will it be possible to do something like this as well with your control.
    Maybe thinking of a resource file to load images etc from.

    Another idea to make it look cool, is to add a shadow to make an image stand off the screen.
    tks
    Last edited by k_zeon; Mar 27th, 2017 at 03:31 PM.

  12. #12
    Member
    Join Date
    May 2016
    Location
    China
    Posts
    46

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    I added in the code automatically registered font content, we hope to be useful.

    Code:
    '注册字体
    Private Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long
    Private Declare Function RemoveFontResource Lib "gdi32" Alias "RemoveFontResourceA" (ByVal lpFileName As String) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const HWND_BROADCAST = &HFFFF&
    Private Const WM_FONTCHANGE = &H1D
    
    Private Sub Form_Load()
        '方法一:
    '    Dim R As String
    '    R = Dir("C:\WINDOWS\Fonts\FontAwesome.otf") '在C盘WINDOWS文件夹fonts中查找微软雅黑
    '    If R <> "" Then
    '        MsgBox "...填入)确认文件存在"
    '     Else
        '     MsgBox "...填入)确认文件不存在"
        ' End If
        '方法二:
        Dim i, m
        For i = 0 To Screen.FontCount - 1
            If "FontAwesome" = Screen.Fonts(i) Then m = 1
        Next
        If m = 1 Then
            'MsgBox "含有此字体"
        Else
            '安装字体引用
            Debug.Print AddFontResource(App.Path & "\FontAwesome.otf")
            Call SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0) '广播系统字体变化这一消息,如果不要其它程序看见你的字体可以不使用这行
        End If
        
        karo2.Picture = App.Path & "\img\eliteadmin_logo.jpg"
        karo3.Picture = App.Path & "\img\eliteadmin_head.jpg"
    End Sub
    FirenzeLabel.zip

  13. #13
    Fanatic Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    775

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    First off - fantastic work, thanks for sharing!

    One other issue that I think might be solved by a "Stretch" or "Fill" option is that images will work better on a high DPI display. Have a look at this screenshot to see what I get at 150% DPI:

    Name:  2017-03-28_8-47-22.jpg
Views: 615
Size:  26.7 KB

  14. #14

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by k_zeon View Post
    many thanks, look forward to it.
    One other question. Sometimes i need to hold a picture in an image/picture control, then assign it
    ie Pic1.Picture = Pic2.Picture
    Will it be possible to do something like this as well with your control.
    Maybe thinking of a resource file to load images etc from.

    Another idea to make it look cool, is to add a shadow to make an image stand off the screen.
    tks
    "Pic1.Picture = Pic2.Picture" is now possible, but images are loaded from the hard drive instead of the cache.
    I'm not planning to do some caching now. I think cooperation with the LaVolpe ImageList should be possible.

    And shadows of course are planned for the near future

  15. #15

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by ChenLin View Post
    I added in the code automatically registered font content, we hope to be useful.

    Code:
    '注册字体
    Private Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long
    Private Declare Function RemoveFontResource Lib "gdi32" Alias "RemoveFontResourceA" (ByVal lpFileName As String) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const HWND_BROADCAST = &HFFFF&
    Private Const WM_FONTCHANGE = &H1D
    
    Private Sub Form_Load()
        '方法一:
    '    Dim R As String
    '    R = Dir("C:\WINDOWS\Fonts\FontAwesome.otf") '在C盘WINDOWS文件夹fonts中查找微软雅黑
    '    If R <> "" Then
    '        MsgBox "...填入)确认文件存在"
    '     Else
        '     MsgBox "...填入)确认文件不存在"
        ' End If
        '方法二:
        Dim i, m
        For i = 0 To Screen.FontCount - 1
            If "FontAwesome" = Screen.Fonts(i) Then m = 1
        Next
        If m = 1 Then
            'MsgBox "含有此字体"
        Else
            '安装字体引用
            Debug.Print AddFontResource(App.Path & "\FontAwesome.otf")
            Call SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0) '广播系统字体变化这一消息,如果不要其它程序看见你的字体可以不使用这行
        End If
        
        karo2.Picture = App.Path & "\img\eliteadmin_logo.jpg"
        karo3.Picture = App.Path & "\img\eliteadmin_head.jpg"
    End Sub
    FirenzeLabel.zip
    Thanx for the piece of code, but your code solves the problem only in the examples. I need to fix it globally. I think proper installation by a installation file should fix the problem

  16. #16

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by jpbro View Post
    First off - fantastic work, thanks for sharing!

    One other issue that I think might be solved by a "Stretch" or "Fill" option is that images will work better on a high DPI display. Have a look at this screenshot to see what I get at 150% DPI:

    Name:  2017-03-28_8-47-22.jpg
Views: 615
Size:  26.7 KB
    Thank for the support and for the poiting out the problem. I will look at this and find a solution to fix it. Scaling will be available soon.

  17. #17
    Addicted Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    211

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Very cool , thanks for sharing!

    I think it would be nice to have a "UserControl-Free" version too. I mean a "Pure" CairoWidget to add to other standard Widgets: https://github.com/vbRichClient/vbWidgets.

    Just a suggestion....
    * PhotoModularFX project forum
    * Check out my Photo/Video to cartoon and Other projects
    * for my PSC Source Codes look here

  18. #18

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by reexre View Post
    Very cool , thanks for sharing!

    I think it would be nice to have a "UserControl-Free" version too. I mean a "Pure" CairoWidget to add to other standard Widgets: https://github.com/vbRichClient/vbWidgets.

    Just a suggestion....
    ActiveX control is very easy to use even for the beginners. Just place it on the form and change properties how you like it. No actual coding for you.

    I think Olaf Schmidt should say his opinion first

  19. #19
    Fanatic Member
    Join Date
    Apr 2012
    Posts
    873

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by reexre View Post
    Very cool , thanks for sharing!

    I think it would be nice to have a "UserControl-Free" version too. I mean a "Pure" CairoWidget to add to other standard Widgets: https://github.com/vbRichClient/vbWidgets.

    Just a suggestion....
    Personally, I don't agree. It's great that porkynet has wrapped-up all this into an ActiveX for beginners but anybody that is using vbWidgets should have no problem doing any of this stuff for themselves. So why have one more widget to maintain when it is just a derivation of other existing widgets. My two cents...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  20. #20
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,107

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by porkynet View Post
    ActiveX control is very easy to use even for the beginners. Just place it on the form and change properties how you like it. No actual coding for you.

    I think Olaf Schmidt should say his opinion first
    I'm with Colin on this...

    I appreciate the efforts you have put into this (making it usable behind a normal VB-UserControl, simply changing properties in the Property-Grid),
    but the vbWidgets-Project does already contain appropriate Widgets, which one can use to reproduce your Demo-Screens just as well
    (DPI-aware Zooming/Scaling being supported out of the box then, when using vbWidgets-based Forms).

    Your Screens are really nice to look at - thanks for encouraging others with these design-ideas,
    to try out the Cairo-Drawing in vbRichClient5.

    Good Job, keep it up...

    As for FontAwesome (with regards to the problem of "shipping the resource")...

    I could put a Demo into the CodeBank, which shows how to use it from a (compressed)
    RichClient-Resource-Archive (a *.wac-file instead of a Font-File, having a size of only 126kB)
    then rendering these Symbols as SVGs over their "friendly name"-Key (instead of an
    "AscW-Value" which points into a Font-Resource).

    This FontAwesome-SVG-Demo would show a (free scalable) Output like the following:



    ...with support to set different ForeColors and BackColors for the SVG-Symbols...

    The circular ColorChooser at the Bottom of the ScreenShot is implemented as
    an RC5- 'cwClass' (a Widget) - the Form being a normal VB-Form which shows how
    to incorporate such Widgets together with "normal Controls" in the VB-Form-Designer.


    Olaf

  21. #21
    Hyperactive Member
    Join Date
    Jul 2013
    Posts
    310

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    The circular ColorChooser at the Bottom of the ScreenShot is implemented as
    an RC5- 'cwClass' (a Widget) - the Form being a normal VB-Form which shows how
    to incorporate such Widgets together with "normal Controls" in the VB-Form-Designer.
    I like it, Olaf. This demo in codebank would be nice
    Carlos

  22. #22
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,107

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by Carlos Rocha View Post
    I like it, Olaf. This demo in codebank would be nice
    Just uploaded it into the Codebank here:
    http://www.vbforums.com/showthread.p...vbRichClient5)

    Olaf

  23. #23
    Junior Member
    Join Date
    Nov 2011
    Posts
    30

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Hi Matt. Just looking to see how you are getting on with adding new features to your usercontrol.
    ie the scaleimage etc.
    looking forward to it.

    thanks

  24. #24
    Junior Member
    Join Date
    Nov 2011
    Posts
    30

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    just wanted to know if there is any new development on this usercontrol.. tks

  25. #25

    Thread Starter
    New Member
    Join Date
    Dec 2015
    Location
    Slovakia
    Posts
    13

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    not now, but i can do that if people will interested in

  26. #26
    Junior Member
    Join Date
    Nov 2011
    Posts
    30

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    yes, i am interested. was waiting for the extra features that you were going to do.

  27. #27
    Member
    Join Date
    May 2016
    Location
    China
    Posts
    46

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Caption if you can set the shortcut key is better!
    QQ: 289778005

  28. #28
    New Member
    Join Date
    Jul 2017
    Posts
    2

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Hi, Matt!

    I've compiled your example code to show for my friends, but I don't know why the app always crash right after form unload.

    FontAwesome is installed, vbRichClient5 too... Everything works fine until the form unload.

    Name:  Error.JPG
Views: 148
Size:  67.6 KB

  29. #29
    Fanatic Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    775

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Try calling new_C.CleanupRichClientDll in the Form_Unload event and see if that helps.

  30. #30
    New Member
    Join Date
    Jul 2017
    Posts
    2

    Re: [VB6] FIRENZE LABEL - label control with so many functions

    Quote Originally Posted by jpbro View Post
    Try calling new_C.CleanupRichClientDll in the Form_Unload event and see if that helps.
    Thanks jpbro!

    You solved the problem!

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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.