Results 1 to 33 of 33

Thread: [VB6] ShapeEx: Shape control replacement

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    [VB6] ShapeEx: Shape control replacement

    It is windowless, as the original.
    It can be used as a direct replacement of the original VB-Shape control (by manually editing the *.frm source files... for the one familiar with doing that).

    Perhaps the main feature over the original control is that is is antialiased. It means that the shape is rendered with more quality:

    Name:  antialias.png
Views: 2168
Size:  3.6 KB

    The second new feature is that it has more shapes.
    Here there is a screenshot:

    Name:  Shapes.jpg
Views: 3398
Size:  30.2 KB

    New properties:

    Opacity: as the names says, it sets the opacity -or transparency-.

    RotationDegrees: the shape can be rotated 0-360º.

    Mirrored: it flips the shape horizontally.

    CurvingFactor: This value applies to shapes that are not normally curved like the rectangle, the triangle and several others. It produces new figures by curving the edges. It accepts values in the range from -100 to 100. 0 meaning not curved.

    Shift: It is an additional value used by some controls: triangle scalene, kite, diamond, trapezoid, parallelogram, star, jagged star, arrow, crescent and talk. It accepts positive and negative values. Most useful values will be often in the range of -10 to 50.

    Vertices: Value used by these shapes: regular polygon, star and jagged star.

    Quality: High or Low (antialiased or not).

    Clickable: It determines whether the control will raise mouse events or not. If False, any control behind it will receive the events instead.

    This control uses subclassing.
    Requirements: it uses GDI+, it was introduced in Windows XP.

    Changelog:
    22-mar-19 Original release
    29-mar-19 Latest update: Improvements, bug fixes. Added another shape. Now the "talk" shape can accept negative values in the Shift property.

    Special thanks to LaVolpe, wqweto and The trick.

    Download from GitHub.
    Last edited by Eduardo-; Mar 22nd, 2021 at 06:53 PM.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Updated, with new shapes, more properties (CurvingFactor and Mirrored), self contained subclassing and bug fixes.
    Last edited by Eduardo-; Mar 25th, 2019 at 08:13 PM.

  3. #3
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    330

    Re: [VB6] ShapeEx: Shape control replacement

    If the shapes can put text inside or drag to resize and movement like MS Office, it will be useful in many applications.
    Last edited by DaveDavis; Mar 29th, 2019 at 08:26 PM.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by DaveDavis View Post
    If the shapes can put text inside
    Hello. To add text there is a control that is specific: the Label. Put a label over the shape and set the backstyle to transparent.
    I don't know if there is much of a a point in adding the capacity to draw text to the ShapeEx control, since it is quite easy to put a label inside the shape.

    The difficulty in adding text capacity to the ShapeEx control itself is that the text should not go outside of the shape, and for some shapes that is quite difficult to do (or impossible).
    So, what's the problem in adding a label over it? You can place the label exactly in the position that you want, after you has set up the shape that you wanted.

    If I decide to add the text capacity (may be in the future), perhaps it will be restricted only to some shapes.

    Quote Originally Posted by DaveDavis View Post
    or drag to resize and movement like MS Office, it will be useful in many applications.
    I don't know what you mean, could you explain?
    Do you mean it to have at run-time some similar capacity as the controls have in the IDE (of showing grips and being able to be moved and resized by the user)?
    Last edited by Eduardo-; Mar 29th, 2019 at 09:29 PM.

  5. #5
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    330

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by Eduardo- View Post
    ... perhaps it will be restricted only to some shapes.
    yes, for star etc, it is not grace to have text into.

    Quote Originally Posted by Eduardo- View Post
    Do you mean it to have at run-time some similar capacity as the controls have in the IDE (of showing grips and being able to be moved and resized by the user)?
    I means we can adjust size at run-time or design-time using mouse.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Ok, I'll keep these feature requests in mind. Thank you.

  7. #7
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [VB6] ShapeEx: Shape control replacement

    Hi Eduardo, I'm checking your ShapeEx, I'm going to use it to test wqweto's MST.

    Your ShapeEx is great, which can generate a lot of irregular graphics, but these graphics are rarely used in our programming. If your ShapeEx could generate Win10 system icons, its usefulness will be greatly improved.
    Attached Images Attached Images  

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by dreammanor View Post
    Hi Eduardo, I'm checking your ShapeEx, I'm going to use it to test wqweto's MST.

    Your ShapeEx is great, which can generate a lot of irregular graphics, but these graphics are rarely used in our programming. If your ShapeEx could generate Win10 system icons, its usefulness will be greatly improved.
    Hello,
    Where are all those Windows 10 icons?
    Perhaps I'll make them at some point.

    About the shapes, I probably never used any shape in my programs, or at least I can't remember.
    The original purpose of this control was to make a shape control replacement but antialiased.

    Anyway, I think that a SVG renderer would be more useful.

  9. #9
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    177

    Re: [VB6] ShapeEx: Shape control replacement

    Amazing contribution Eduardo!!!
    Im working hard on gattering control replacements to give vb6 a modern look. For the IDE Im using AxTools wich is awesome and some controls I found so far are this and the SSTabEx (extended version of sheridan tabs).
    Do you have any more usefull replacements or cool controls to share? (send me a private if you want)

    Im working on creating a set of new controls (a new button with tons of propertys, shadow and autocreate disabled icon) now I changed to ShapeEx for the background object.
    Do you have any transparent rotated antialiased label control?
    I also coded the only Flat combo box arround after not finding anyone wich works (Right now works, but I want to push it a little more and completely replace the dropdown graphic)

    Regards from Argentina!

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by shagratt View Post
    Amazing contribution Eduardo!
    Thank you.

    Quote Originally Posted by shagratt View Post
    Do you have any transparent rotated antialiased label control?
    Here there is one (choose the windowless).

    Or here there is another one from Elroy.

    Quote Originally Posted by shagratt View Post
    Regards from Argentina!
    Greetings
    Last edited by Eduardo-; Jul 16th, 2019 at 08:59 PM. Reason: removed the attachment and added the first link

  11. #11

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by shagratt View Post
    I also coded the only Flat combo box arround after not finding anyone wich works (Right now works, but I want to push it a little more and completely replace the dropdown graphic)
    Here I see there are some flat combos.

    What I do is to set the controls to use the Windows theme, then the comboboxes (and other controls) appear flat.

  12. #12
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    177

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by Eduardo- View Post
    Here I see there are some flat combos.

    What I do is to set the controls to use the Windows theme, then the comboboxes (and other controls) appear flat.
    I tried that approach but the problem is that if you relay on themes you dont really know how it will really look on the client machines. For example my work computer has themes disabled, my home computer got aero (win7) and my laptop windows10. I want to have controls that dont depend on user themes/colors/windows version so I can design wysiwyg and provide the same user experience.

  13. #13
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    177

    Re: [VB6] ShapeEx: Shape control replacement

    [deleted. duplicate post]
    Last edited by shagratt; Jul 16th, 2019 at 09:37 PM.

  14. #14
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    177

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by Eduardo- View Post
    Here I see there are some flat combos.
    Yes, but most of them fail to be fully flat or are not based on standard ComboBox (cant replace the component and get everything working wich is not good for big projects)

    Example:
    Name:  Snap1.png
Views: 1713
Size:  4.0 KB

    I hope I find some free time to finish it

  15. #15

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Here there is another one.

  16. #16
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    177

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by Eduardo- View Post
    Here there is another one.
    Thanks Eduardo! As you can see that one fail to do a full flat on the bottom line. I based my work on that one and modified the paint proc to my taste.

  17. #17
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,354

    Re: [VB6] ShapeEx: Shape control replacement

    how to put on button?
    it's can't use zorder .

  18. #18
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    177

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by xiaoyao View Post
    how to put on button?
    it's can't use zorder .
    Same happen with shapes and lines and any control that is not 'windowed' (image control,shape,lines,etc. )
    You can put it inside a picturebox to have zorder. But doing that you will lose the transparency that is the advantage of windowless controls.

  19. #19
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,354

    Re: [VB6] ShapeEx: Shape control replacement

    It's repeated.
    Last edited by xiaoyao; Mar 29th, 2021 at 05:48 PM.

  20. #20
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,354

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by shagratt View Post
    Same happen with shapes and lines and any control that is not 'windowed' (image control,shape,lines,etc. )
    You can put it inside a picturebox to have zorder. But doing that you will lose the transparency that is the advantage of windowless controls.
    Code:
    Private Sub UserControl_Show()
    If Not Ambient.UserMode Then
        UserControl.BackStyle = 1
    Else
        ShowAllChildArea
    End If
    End Sub
    
    Sub ShowAllChildArea()
    Dim Obj As Control
    Dim id As Long
    For Each Obj In ContainedControls
        id = id + 1
        If id > Area.Count - 1 Then Load Area(id)
        Area(id).Width = Obj.Width
        Area(id).Height = Obj.Height
    
        Area(id).Left = Obj.Left
        Area(id).Top = Obj.Top
        Area(id).Visible = True
    Next
    End Sub


    VB6 UserControl-Transparency Container-VBForums
    https://www.vbforums.com/showthread....ency-Container
    With my transparent container approach, it only takes a few lines of code to break this barrier for many "usercontrols" that cannot be superimposed on other controls. The downside is that you need one more "user control". You're welcome to change it, and you'll end up with only one user control.
    Attached Images Attached Images  
    Last edited by xiaoyao; Mar 29th, 2021 at 05:30 PM.

  21. #21
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,354

    Re: [VB6] ShapeEx: Shape control replacement

    change sample about "shift " value to 5552,If the width of the control is only 300 pixels, sometimes the actual content part displayed is only 200 pixels, or maybe 600 pixels, exceeding the size of the control itself.Is there any way to get the actual coordinates of the final display image?rect info。
    I tested it yesterday and found that the text label on my transparent container displayed a slightly different color.my label font color is red
    Last edited by xiaoyao; Mar 29th, 2021 at 05:40 PM.

  22. #22

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by xiaoyao View Post
    how to put on button?
    it's can't use zorder .
    It is possible with this control instead, but it has only standard (VB6 original) shapes.

    Quote Originally Posted by xiaoyao View Post
    change sample about "shift " value to 5552,If the width of the control is only 300 pixels, sometimes the actual content part displayed is only 200 pixels, or maybe 600 pixels, exceeding the size of the control itself.Is there any way to get the actual coordinates of the final display image?rect info
    Currently not.

    Quote Originally Posted by xiaoyao View Post
    I tested it yesterday and found that the text label on my transparent container displayed a slightly different color.my label font color is red
    Humm, color should be accurate. In any case please post (a minimal) sample test project.

  23. #23
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,354

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by Eduardo- View Post
    It is possible with this control instead, but it has only standard (VB6 original) shapes.



    Currently not.



    Humm, color should be accurate. In any case please post (a minimal) sample test project.
    https://www.vbforums.com/showthread....ency-Container

    Use this module together, and then add our control to this container.Add a transparent label. The text color is red.

  24. #24

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by xiaoyao View Post
    https://www.vbforums.com/showthread....ency-Container

    Use this module together, and then add our control to this container.Add a transparent label. The text color is red.
    I see perfect red (255-0-0).

    Name:  Test_Sh1.png
Views: 442
Size:  354.4 KB
    Last edited by Eduardo-; Apr 6th, 2021 at 12:16 AM.

  25. #25
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,354

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by Eduardo- View Post
    I see perfect red (255-0-0).
    Test project attached.
    add label and shapeEx control in my usercontrol ,set label Transparent
    Name:  Test_Sh1.png
Views: 442
Size:  354.4 KB

  26. #26
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,354

    Re: [VB6] ShapeEx: Shape control replacement

    I upload the source code in this forum example of the space is only 10 megabytes, how to become larger? Like a hundred megabytes.

  27. #27

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by xiaoyao View Post
    I upload the source code in this forum example of the space is only 10 megabytes, how to become larger? Like a hundred megabytes.
    IDK.

    About the issue, I think that the rendering of the text gets blended with the the background color due to anti-aliasing, and since the transparent color is only one (no shades) then what you are seeing is part of the background blended with the caption of the label that didn't get transparent because the color didn't match exactly.
    For true transparency render the text with GDI+.

    And BTW that has nothing to do with the ShapeEx control.
    Last edited by Eduardo-; Apr 5th, 2021 at 10:46 PM.

  28. #28
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,354

    Re: [VB6] ShapeEx: Shape control replacement

    Can you set the thickness of the border line, or no border, set to fill the middle area with an image, or fill the image to the border

  29. #29
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    4,596

    Re: [VB6] ShapeEx: Shape control replacement

    Eduardo, just tried it for the first time and it looks good.
    Can you explain what the need is for the subclassing?
    In a quick test I disabled the subclassing and didn’t notice a difference.

  30. #30

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    edited
    Last edited by Eduardo-; May 29th, 2021 at 10:49 AM.

  31. #31
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    4,596

    Re: [VB6] ShapeEx: Shape control replacement

    Thanks for the extensive reply, but you mention “click the tabs”.
    My question is about the ShapeEx control, which this thread is about.

  32. #32

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,274

    Re: [VB6] ShapeEx: Shape control replacement

    Yes, sorry, the subclassing is for ensuring a correct painting (and background erasing) when the figure goes out of the rectangle.
    For most cases you can remove it without any difference.

  33. #33
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    4,596

    Re: [VB6] ShapeEx: Shape control replacement

    Thanks Eduardo!

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