Solved

Transparent non-rectangularness?

Posted on 2001-07-13
10
212 Views
Last Modified: 2010-04-06
Ok experts, this has been driving me mad. I want to create a jazzy little app has a non-rectangular shape. The shape needs to come from a bitmap. Now while using CoolForm will no doubt be everybody's immediate response, there doesn't seem to be a D6 version so I can't.

The effect I'm after is exactly the same as setting the form's brush style to bsClear (and the border to none) and then having a tyransparent TImage on top. Although this works, it all goes nasty when the form gets moved.

Any ideas?

The Neil =:)
0
Comment
Question by:TheNeil
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 8

Expert Comment

by:TOndrej
ID: 6280226
You can use SetWindowRgn, example on http://www.gnomehome.demon.nl/uddf/pages/forms.htm#forms14
0
 
LVL 5

Author Comment

by:TheNeil
ID: 6280336
TOndrej,

That's fine for eliptical windows but I want my form to use the shape of the image (with the transparency) )or a rectangle with the image inside it. It also falls over when you try to move the form - the transparency doesn't get updated

The Neil =:(
0
 
LVL 6

Accepted Solution

by:
Jaymol earned 100 total points
ID: 6280340
Hi TheNiel - I'd recommend downloading the JEDI libraries.  One of the units (I think it's jclGraphics) has a function in it something like SetWindowRGNToBitmap.  (Not too sure on the function name.)

I've used that before for similar reasons and found it to be really good.  Most of the stuff in JEDI has been fully coded so it's simple to use and covers most of the possible problems with the use of such functions.

Good luck,

John.
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 6280378
> That's fine for eliptical windows

A region may be of any shape, e.g. polygon
As Jaymol suggested, have a look at JclGraphics.CreateRegionFromBitmap
www.delphi-jedi.org

> It also falls over when you try to move the form - the transparency doesn't get updated

That's not true. When you set a window region then anything outside of that region is simply no longer a part of the window, updating is automatic by Windows, as well as handling mouse clicks.
E.g. if you have a donut-shaped window region then your window will never see a mouse click into the hole in the middle.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6280381
The function name is CreateRegionFromBitmap and it's in the unit JclGraphics.

John.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 6

Expert Comment

by:Jaymol
ID: 6280382
heh
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6281547
Hello

  Look at article, to how to make cool forms looking
http://delphi.about.com/library/weekly/aa120898.htm


 try TSkinForm, it's free and call, but you have to register if you want the source code
http://www.friendsoft.net/english/index.htm

also look at the forms effects in torry site
http://www.torry.net/effects.htm
http://www.torry.net/nonrect.htm

Best regards
Mohammed Nasman
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6281839
TheNeil, check this out:

http://www.informatics.no/progvareOF.htm

I've been using it to create my irregularly-shaped forms for quite some time...



DragonSlayer.
0
 
LVL 5

Author Comment

by:TheNeil
ID: 6281848
Thanks everyone but Jaymol's solution works just fine so he gets the points

The Neil =:)
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6284893
Thanks.

Glad to help.

John.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now