Page 1 of 2 12 LastLast
Results 1 to 40 of 44

Thread: [VB6] ShapeEx: Shape control replacement

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    [VB6] ShapeEx: Shape control replacement

    Note: There is also an OCX version. It has a LineEx control added.

    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: 4865
Size:  3.6 KB

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

    Name:  Shapes.jpg
Views: 7692
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ยบ.

    Flipped: the shape can be flipped horizontally and/or vertically.

    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.

    Style3D: Allows to see the shape with a 3D look.

    This control uses subclassing (but it is optional in IDE, look at the UseSubclassing property).
    Requirements: it uses GDI+, it was introduced in Windows XP.

    Changelog:
    17-sep-22 Added new shape Pie.
    17-sep-22 Improved rendering in some edge cases.
    17-sep-22 Added Style3DEffect property.
    15-sep-22 Added Style3D property.
    01-jul-22 Added al BorderStyle options that were available in the original Shape control.
    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.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [VB6] ShapeEx: Shape control replacement

    Updated, with new shapes, more properties (CurvingFactor and Mirrored), self contained subclassing and bug fixes.

  3. #3
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    597

    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
    4,996

    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)?

  5. #5
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    597

    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
    4,996

    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
    4,996

    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
    198

    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
    4,996

    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
    4,996

    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
    198

    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
    198

    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
    198

    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: 4156
Size:  4.0 KB

    I hope I find some free time to finish it

  15. #15

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    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
    198

    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
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    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
    198

    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
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: [VB6] ShapeEx: Shape control replacement

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

  20. #20
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    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
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    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
    4,996

    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
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    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
    4,996

    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: 2925
Size:  354.4 KB

  25. #25
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    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: 2925
Size:  354.4 KB

  26. #26
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    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
    4,996

    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.

  28. #28
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    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
    5,872

    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
    4,996

    Re: [VB6] ShapeEx: Shape control replacement

    edited

  31. #31
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    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
    4,996

    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
    5,872

    Re: [VB6] ShapeEx: Shape control replacement

    Thanks Eduardo!

  34. #34
    New Member
    Join Date
    Aug 2020
    Posts
    14

    Re: [VB6] ShapeEx: Shape control replacement

    Awesome Control. Really handy. Is there a way to change the border pattern to dotted or dashed? I'm writing a program that will allow me to draw a selection box on an image which will be cropped. Also is there a method of settings its ZOrder to appear on top of a picture box ? Thanks again!
    Last edited by Maddis; Jul 1st, 2022 at 12:16 PM.

  35. #35

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [VB6] ShapeEx: Shape control replacement

    Quote Originally Posted by Maddis View Post
    Awesome Control. Really handy.
    Thank you.

    Quote Originally Posted by Maddis View Post
    Is there a way to change the border pattern to dotted or dashed? I'm writing a program that will allow me to draw a selection box on an image which will be cropped.
    I added options to the BorderStyle property. Now it matches the original.
    Only that the dots and dashes are smaller (with GDI+ than were with GDI), so maybe you want to set a BorderWidth > 1.
    It can draw border styles other than solid with BorderWidth > 1, the original VB Shape control didn't allow that.

    Quote Originally Posted by Maddis View Post
    Also is there a method of settings its ZOrder to appear on top of a picture box ? Thanks again!
    No, because it is a windowless control. If you want to put it over a PictureBox, you need to put the shape control inside a PictureBox also.

    Or you could use this other control, but it is quite limited, it is only like the VB original but that can be placed over PictureBoxes.

  36. #36

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [VB6] ShapeEx: Shape control replacement

    This is a screen shot with new available BorderStyle settings:

    Name:  ShapeEX_BS2.jpg
Views: 1912
Size:  56.3 KB

  37. #37
    New Member
    Join Date
    Aug 2020
    Posts
    14

    Re: [VB6] ShapeEx: Shape control replacement

    Thanks for updating the control and for the advice. Will have a play around later . It will definitely come in useful

  38. #38

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [VB6] ShapeEx: Shape control replacement

    Updated. Added Style3D property.

    Name:  ShapeEx_ScrNew.jpg
Views: 1603
Size:  63.3 KB

  39. #39
    Fanatic Member Peekay's Avatar
    Join Date
    Sep 2006
    Location
    Witbank, South Africa
    Posts
    784

    Re: [VB6] ShapeEx: Shape control replacement

    Eduardo,

    As always I have to hand it to you. Real expertise, but I also appreciate the other contributors.
    I could not have imagined in my wildest dreams that I would get such a response.

    I will study closely and implement.

    Thanks a lot
    PK

  40. #40
    Fanatic Member Peekay's Avatar
    Join Date
    Sep 2006
    Location
    Witbank, South Africa
    Posts
    784

    Re: [VB6] ShapeEx: Shape control replacement

    Eduardo,

    Your program is quite elaborate, but I would like further advice on how to create a shape.
    Attached is a picture of the shapes I need to do, and I will appreciate if you can give me some tips on how to start.

    Name:  Symbols.jpg
Views: 1161
Size:  14.5 KB

    Thanks so much
    PK
    Last edited by Peekay; Feb 8th, 2023 at 01:08 PM.

Page 1 of 2 12 LastLast

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