Results 1 to 3 of 3

Thread: Shaped Forms Made easy (and hard too!)

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    7

    Lightbulb Shaped Forms Made easy (and hard too!)

    Ok, heres my grain of sand to the comunity. Everyone likes forms with a non-squared look, yet its rather hard to find code that works fast.

    I use an old module i found somewhere almost 5 years ago, what the module does is loop tru each pixel of a image in a picturebox, and if the rgb values are the same as the very first pixel of the image, it creates a Windows Region.... when all pixels are searched, the result is a region that can be used to cut a form or a picture box (i think u can cut any kind of object, but i havent tried, and i dont think its very usefull to have a cut-down list box anyway) So in Resume, the module uses a image as a template to cut the form.

    The downside is: if the image is too big, the time it takes to cut the form increases. although the newest processors work pretty fast, its always good to save that CPU power for something else, besides while a 2ghz athlon takes 2 seconds to load the shape, a 400mhz celeron would take up to 10 seconds.

    The reason is that the module reads the template image everytime the program loads.

    This is unnesesary if the image is always gonna be the same. So the solutuion is to store the result in a file. And thats exactly what i did.

    A sample project is attached to the post. To create your own template you need to load a .bmp to Template.frm and Run the project. (you can use other picture formats...ill explain later)

    And to see the diference between the original script and my method you need to load the same bmp to the picturebox in Classic.frm and NeoScript.frm, run the project and click on "compare"

    You can drag the forms arround even if they dont have a dragbar (code is in the forms too) in case they are too big or overlap eachother.

    And you can save the template as a text file by typing a name for the file in the textbox of main.frm and pressing the "save as:" button.

    Finally, to use the template to shape a form, all you need to do is add a richtextbox , a picture box and TransEx0.bas to your project, copy the code in NeoScript.frm and place the template file in the same folder as the project/.exe

    To create templates i recommend using .bmp files, because jpg will change the RGB values of some pixels that were supposed to be "invisible" and when this happens, the affected pixels will not be cut, creating an ugly shaped form.

    I dont know if my method will be usefull to anyone (i do stuff that is very usefull to me, but too complicated or redundant to others) But you can always use the original script to cut a form (Its ideal if you just want to cut a small form)

    Anyway, i hope the explanation i just gave helps. im still working on the script and the example (i wanted to make it an exe that would do the templates automatically, but for some reason you have to manually load the picture in the picturebox in design-time)


    any suggestions are apreciated, and let me know if you modified something, i want to see any improvements to this.

    Ill post a program i made called BeatList later on, all of its forms are shaped using The method i described above.

    ShapeExample.zip contains the project that creates the template.

    ScriptOntherun.zip (inside ShapeExample.zip)contains a project using the template method.
    Attached Files Attached Files

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