Results 1 to 10 of 10

Thread: Dynamic Shape Form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Dynamic Shape Form

    I need to create a shape form dynamic at runtime.
    I want to create forms like picture attach but i'm stuck...and i need help
    I found this on PSC from LaVolpe :
    http://www.planetsourcecode.com/vb/s...58319&lngWId=1
    but I'm not very good on graphics...programming...so please help..
    Attached Images Attached Images     
    Attached Files Attached Files
    Last edited by cliv; Apr 7th, 2010 at 02:00 AM.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: Dynamic Shape Form

    Updated. The zip in the first post contains the updates.

  3. #3
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    441

    Re: Dynamic Shape Form

    If you are interested can visit this link, use a class to use PNG images, unfortunately could not explain how it works because it complicates my language, but if you want you can put these images in PNG format with transparency and I can make an example.
    leandroascierto.com Visual Basic 6 projects

  4. #4
    New Member
    Join Date
    Apr 2010
    Posts
    5

    Re: Dynamic Shape Form

    Open frmShapedRgns, select the picture box, go to properties, load your picture into it (picture property). Run the program. Hit the button. Later stop program, go to frmtest, and position some controls to see where they fall, and experiment, I guess it's masking that domiannt bg color in your pic, so try high contrast images, and just see what falls out. you could sample the colors as they seem to work, and go to photoshop or something, and play around with shapes, based on that color palette, contrast.



    then, as a quick cheat to run frmtest as your main form, you vanish frmShapeRgn at load, before clicking your shaped form, frmtest, into view

    in frmShapeRgn load event>>>

    Private Sub Form_Load()
    cboRotation.ListIndex = 0 '<<< if you comment out these these you'll also have the mask visible
    Command2.Enabled = False '<<< if you comment out these you'll also have the mask visible, and in two pieces, even the command button if you stretch it over masked and visible, will be cut in half, and both pieces will be movable, making 1 form into 2, and a bissected control, thats weird
    chkAntiRgn = 0 '<<< if you comment out these you'll also have the mask visible
    Me.Visible = False '<<<added
    Command1_Click '<<<<added
    End Sub

    in half:


    Both halves of command1 button can be clicked.

    A sample high contrat pic:
    Last edited by 10west; Apr 7th, 2010 at 04:24 AM.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: Dynamic Shape Form

    Thank you for reply...but you don't understand me....i'm sorry maybe i'm not so clear...
    I want to creat Dynamic shape combine "Icon" and "Panel" on runtime from code according my need...My shape form must be different and they will be not be "static picture" but shape create from code, combine base shape (Panel and Icon)
    I figure out how work LaVolpe module and i use from my code but i don't need "static picture"
    Last edited by cliv; Apr 7th, 2010 at 06:04 AM.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: Dynamic Shape Form

    Quote Originally Posted by LeandroA View Post
    If you are interested can visit this link, use a class to use PNG images, unfortunately could not explain how it works because it complicates my language, but if you want you can put these images in PNG format with transparency and I can make an example.

    Thank you. Very interesting .....

  7. #7
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    Re: Dynamic Shape Form

    If I understand correctly, you are going to have to use
    Paintpicture or Bitblt to draw the icon pics onto the panel pics
    and use the resulting picture as your form shape. For example,
    I used Paint to paint Icon1 onto Panel1 & it worked fine,
    although the icon pics need to be about half their size
    to fit in the upper left corner.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: Dynamic Shape Form

    Quote Originally Posted by VBClassicRocks View Post
    If I understand correctly, you are going to have to use
    Paintpicture or Bitblt to draw the icon pics onto the panel pics
    and use the resulting picture as your form shape. For example,
    I used Paint to paint Icon1 onto Panel1 & it worked fine,
    although the icon pics need to be about half their size
    to fit in the upper left corner.
    Can be Paint with transparency...? Can you post sourcecode..?

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Dynamic Shape Form

    Quote Originally Posted by cliv View Post
    Can be Paint with transparency...? Can you post sourcecode..?
    Shaped forms that contain controls are problematic.

    1. Using a form shaping routine like the one you referenced requires one color to be transparent throughout the entire image. The downside with using regions is that your shape has jaggies around corners and diagonal lines.

    2. Using SetLayeredWindowAttributes and UpateLayeredWindow APIs allows you to create a shape based off a nice alphablended PNG and supports alphablended edges. However, controls on the form become invisible and non-reactive to GUI changes (focus, pressed, hot, etc, etc). You may want to search the forum for those key API names and find some examples and read about additional issues encountered.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: Dynamic Shape Form

    Quote Originally Posted by LaVolpe View Post
    Shaped forms that contain controls are problematic.

    1. Using a form shaping routine like the one you referenced requires one color to be transparent throughout the entire image. The downside with using regions is that your shape has jaggies around corners and diagonal lines.

    2. Using SetLayeredWindowAttributes and UpateLayeredWindow APIs allows you to create a shape based off a nice alphablended PNG and supports alphablended edges. However, controls on the form become invisible and non-reactive to GUI changes (focus, pressed, hot, etc, etc). You may want to search the forum for those key API names and find some examples and read about additional issues encountered.

    Thank you LaVolpe...your advice are always welcome...Thank you

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