Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Intel corner

Custom Window Shape

Round windows in Windows.

Issue: 2.6 (July/August 2004)
Author: Christian Schmitz
Author Bio: Christian Schmitz is the creator of the Monkeybread Software REALbasic Plugins.
Article Description: No description available.
Article Length (in bytes): 11,443
Starting Page Number: 42
RBD Number: 2621
Resource File(s):

Download Icon 2621.sit Updated: Thursday, July 15, 2004 at 12:00 PM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

What do we want to do?

The first part of the article round window. For this we will use a special class WinRegion to define a region. A region is basically something like a picture mask, but it is built using bitmap and/or vector data. We create such a region and then assign it to a normal REALbasic window.

The second part will improve this class to give you some more commands. For example you can add one region to another to create more complex regions.

Use the class WinRegion

The following code simply allocates a WinRegion object. An oval region is then created and the region is assigned to the window.

Sub Open()

dim r as WinRegion

r=new WinRegion

r.CreateOval(20,-20,200,200)

r.SetWindowRegion self

End Sub

To implement this functionality, we create a new REALbasic project and add a class named "WinRegion". We add a private property "handle as integer" to store the region reference.

Clean up: FreeHandle and the destructor

The first method for this class is the FreeHandle method which will free the handle as advertised. The Windows API contains a function called "DeleteObject" which can be used to free handles for graphical objects like pens, regions, and patterns. The function returns an integer where a value of 0 means failure.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com