Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Transparent non-rectangularness?

Posted on 2001-07-13
10
Medium Priority
?
225 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 400 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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
 
LVL 6

Expert Comment

by:Jaymol
ID: 6280382
heh
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses

916 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