Results 1 to 13 of 13

Thread: [RESOLVED] Making desktop gadgets with RC5 - RC6

  1. #1

    Thread Starter
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    183

    Resolved [RESOLVED] Making desktop gadgets with RC5 - RC6

    I ask Olaf how to have a text such as time or date transparently in the background.
    Like this picture

    Name:  Sparse.png
Views: 207
Size:  204.9 KB

    Can you send a simple example ?

  2. #2
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,469

    Re: Making desktop gadgets with RC5 - RC6

    Olaf will turn up soon with a simple answer or an easy example but if you want a more convoluted example you could look here: https://github.com/yereverluvinuncle...me-Control-VB6

    You'll see that it has some transparent text above the volume control

    If you look inside cwOverlay.cls you will see:

    Code:
    Private Sub Class_Initialize()
        Dim intervalValue As Integer: intervalValue = 0
        On Error GoTo Class_Initialize_Error
    
        Set W = Cairo.WidgetBase
            W.BackColor = -1  'we don't use any BackColor here, transparent
    Code:
        cream = RGB(235, 217, 179) ' cannot create a constant from an RGB value
        
        'set some Font- and ForeColor-Properties and draw some Text on the Widget
        With W
            .FontSize = 38
            .FontName = "times new roman"
            .FontBold = True
            .ForeColor = vbBlack
            .BackColor = -1
            .Tag = 0.01
            .HoverColor = 0
            .SelectFontSettingsInto CC
            .Refresh
        End With
    
        thisVolumeLevel = Int(fVolume.SystemAudioLevel * 100)
    and a little later:

    Code:
                ' for specific keys perform actions &c
                 Select Case Key
                    Case "cable"
                        Set Pat = Cairo.ImageList(Key).CropSurface(10, 0, 140, 27).CreateSurfacePattern 'cut-out a nice (repeatable) part of the original "cable"-image (via CropSurface)
                       
                        If gblNumericDisplay = "1" Then
                        
                            ' volume level text shadow
                            CC.DrawText 253, 18, 200, 200, thisVolumeLevel & "%", , , 2, True, , someOpacity
        
                            With W
                                .ForeColor = cream
                                .SelectFontSettingsInto CC
                                .Refresh
                            End With
                            
                            ' volume level text
                            CC.DrawText 250, 15, 200, 200, thisVolumeLevel & "%", , , 2, True, , someOpacity
                        End If
    This paints text in an overlay class that also draws the cable in the dieselpunk volume UI.

    There are other ways to do it but this is just an example of one method.
    Last edited by yereverluvinuncleber; Jul 29th, 2024 at 02:40 PM.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  3. #3

    Thread Starter
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    183

    Re: Making desktop gadgets with RC5 - RC6

    Quote Originally Posted by yereverluvinuncleber View Post
    Olaf will turn up soon with a simple answer or an easy example but if you want a more convoluted example you could look here: https://github.com/yereverluvinuncle...me-Control-VB6

    You'll see that it has some transparent text above the volume control

    If you look inside cwOverlay.cls you will see:


    This paints text in an overlay class that also draws the cable in the dieselpunk volume UI.

    There are other ways to do it but this is just an example of one method.
    I can only say that what you did is great
    Thank you for your help, but your project is very professional and complete and of course it is hard for me to understand
    I just want a simple quality text on the screen with no background as a gadget that I can drag
    I will look at your codes again, maybe I understood something
    Last edited by Mojtaba; Jul 29th, 2024 at 05:02 PM.

  4. #4
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,469

    Re: Making desktop gadgets with RC5 - RC6

    The link I gave you is one of my simplest programs using RC. It puts a variety of images from a PSD on a transparent window. It then creates an overlay RC 'widget' with a paint event. The text is drawn at that point.

    I use that project as a basis for all other desktop trinkets I create. I strip out what I don't want and add in anything new that I require. Doing the same will show you a lot of what is required behind the scenes for a RC program.

    Olaf has several demonstration programs that will do the same in a more simple fashion. I advise you to find those or wait until Olaf arrives.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  5. #5
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,469

    Re: Making desktop gadgets with RC5 - RC6

    A little later I will knock up an RC6 program with a simple clock on a transparent background, I'll let you know when it is done.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  6. #6
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,356

    Re: Making desktop gadgets with RC5 - RC6

    Here is a simple example for a transparent form(gadget),
    you can drag around on your Desktop...

    It uses a modally shown RC6.cWidgetForm (encapsulated in Class cfAlpha) -
    and starts from Sub Main (in modMain.bas).

    Here is a Demo-Project:
    https://vbRichClient.com/Downloads/CairoAlphaForm.zip

    The Cairo-Drawing of the contents of this 640x480 Alpha-Form-Gadget happens in the Event:
    Private Sub Canvas_Paint(...)
    ... so you can "knock yourself out" within this Paint-Event (using the CC to draw anything you want on this Form).

    Olaf

  7. #7

    Thread Starter
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    183

    Re: Making desktop gadgets with RC5 - RC6

    Quote Originally Posted by yereverluvinuncleber View Post
    A little later I will knock up an RC6 program with a simple clock on a transparent background, I'll let you know when it is done.
    Thank you, I am waiting for your project

  8. #8

    Thread Starter
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    183

    Re: Making desktop gadgets with RC5 - RC6

    Quote Originally Posted by Schmidt View Post
    Here is a simple example for a transparent form(gadget),
    you can drag around on your Desktop...

    It uses a modally shown RC6.cWidgetForm (encapsulated in Class cfAlpha) -
    and starts from Sub Main (in modMain.bas).

    Here is a Demo-Project:
    https://vbRichClient.com/Downloads/CairoAlphaForm.zip

    The Cairo-Drawing of the contents of this 640x480 Alpha-Form-Gadget happens in the Event:
    Private Sub Canvas_Paint(...)
    ... so you can "knock yourself out" within this Paint-Event (using the CC to draw anything you want on this Form).

    Olaf
    Very good, Olaf, but I mean a completely transparent background that cannot be seen and no modal window
    Again, I learned a few things from this code

  9. #9
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,356

    Re: Making desktop gadgets with RC5 - RC6

    Quote Originally Posted by Mojtaba View Post
    I mean a completely transparent background that cannot be seen -
    and no modal window
    You can do both:
    - switch off the blurred background
    - and show the Form non-modally
    in Sub Main() of modMain.bas...

    Code:
    Sub Main()
      Cairo.SetDPIAwareness
      Cairo.ImageList.AddIconFromResourceFile "frmIco", "shell32", 167 'load an image-resource into the global ImageList (under a given Key)
      
    '  SwitchBlurredBackDrop fMain.Form.hWnd, True 'comment out, or set to false to disable the blurred backdrop
      
      fMain.Form.Show
      
      Cairo.WidgetForms.EnterMessageLoop
    End Sub
    Olaf

  10. #10
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,469

    Re: Making desktop gadgets with RC5 - RC6

    Quote Originally Posted by Mojtaba View Post
    Thank you, I am waiting for your project
    Don't wait for me, my new laptop just died (fried) so I will be a while before I am up and running again. Olaf will guide you.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  11. #11
    Hyperactive Member
    Join Date
    Jul 2022
    Posts
    347

    Re: Making desktop gadgets with RC5 - RC6

    Quote Originally Posted by yereverluvinuncleber View Post
    don't wait for me, my new laptop just died (fried) so i will be a while before i am up and running again. Olaf will guide you.
    rip

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

    Re: Making desktop gadgets with RC5 - RC6

    Quote Originally Posted by Mojtaba View Post
    Thank you, I am waiting for your project
    This forum is not à la carte restaurant where you can order from a menu and then wait on your order while swiping on your phone.

    The principles here are based on receiving guidelines and most of the effort is expected to come from you. You have to write the actual code and everyone else might comment on it if they have something useful to say.

    This is not the first time I get the impression you are not aware of the basic netiquette of every public forum in general so trying to clear things up for you and explain why you might not get quite as many replies to your threads if you keep posting these as drive-in orders.

    cheers,
    </wqw>

  13. #13

    Thread Starter
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    183

    Re: Making desktop gadgets with RC5 - RC6

    Quote Originally Posted by Schmidt View Post
    You can do both:
    - switch off the blurred background
    - and show the Form non-modally
    in Sub Main() of modMain.bas...

    Code:
    Sub Main()
      Cairo.SetDPIAwareness
      Cairo.ImageList.AddIconFromResourceFile "frmIco", "shell32", 167 'load an image-resource into the global ImageList (under a given Key)
      
    '  SwitchBlurredBackDrop fMain.Form.hWnd, True 'comment out, or set to false to disable the blurred backdrop
      
      fMain.Form.Show
      
      Cairo.WidgetForms.EnterMessageLoop
    End Sub
    Olaf
    This is good
    I need to read more about Cairo because I use it in all programs
    Olaf, if you have time, give more up-to-date examples for teaching. Anyway, I appreciate your Help

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