How can you create a PowerBuilder Windows application with windows which look like iTunes or Napster?

How can you create a PowerBuilder Windows application with windows which look like iTunes or Napster?

i.e. with rounded window edges and shaded colouring - I can't find any way to control this in PowerBuilder

are these some extensions which I can download or purchase to enable me to do this?
do I just need to learn the PBNI to control the windows directly - if so can you find me an example?
OmnipowerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tr1l0b1tCommented:
Hi,

my little contribution ...

~~~~~~~~~~~~~~~~
Shaded colouring :
~~~~~~~~~~~~~~~~
    - Windows : Create a bitmap with the shade effect and place it on the window background.
    - Buttons : Use PictureButtons containing appropiate bitmaps instead CommandButtons.

~~~~~~~~~~~~~~~~
Rounded window edges :
~~~~~~~~~~~~~~~~

You must create a 'region' and call the winAPI "SetWindowRgn()" passing the
window's handle and the 'region' as parameters. The external function declaration is :

    FUNCTION long SetWindowRgn( ulong hWnd, ulong hRgn, boolean bRedraw ) LIBRARY "user32.dll"

there is several external functions to create/manage regions :

    FUNCTION long CreateEllipticRgn(long x1, long y1, long x2, long y2) LIBRARY "gdi32.dll"
    FUNCTION long CreatePolygonRgn(POINT lppt[], int cPoints, int fnPolyFillMode) LIBRARY "gdi32.dll"
    FUNCTION long CreateRectRgn(long x1, long y1, long x2, long y2) LIBRARY "gdi32.dll"
    FUNCTION int CombineRgn(ulong hrgnDest, ulong hrgnSrc1, ulong hrgnSrc2, int fnCombineMode) LIBRARY "gdi32.dll"

where 'POINT' is a simple structure :
    global type point from structure
      long            cx
      long            cy
    end type

Well, here is an easy example (elliptical window) :

///////////////////////////
// Window's Open event

Long      x2, y2
ULong       hWnd
Long      il_newRgn
x2 = UnitsToPixels( this.Width, XUnitsToPixels! )
y2 = UnitsToPixels( this.Height, YUnitsToPixels! )
hWnd = Handle( this )
il_newRgn = CreateEllipticRgn( 0, 0, x2, y2 )
SetWindowRgn( hWnd, il_newRgn, TRUE )

///////////////////////////

If you want a complex user defined shape, you need to create an array with the points and call "CreatePolygonRgn()". When the shape is complex enough, I guess you'll need an utility that generate the point coordinates for you.

///////////////////////////
// Window's Open event

// CreatePolyRgn constants
CONSTANT int ALTERNATE = 1
CONSTANT int WINDING = 2

POINT      lpt_points[8]
ULong       hWnd
Long      ll_newRgn

// point coordinates
lpt_points[1].cx = 0
lpt_points[1].cy = 0
lpt_points[2].cx = 10
lpt_points[2].cy = 6
 ...
lpt_points[8].cx = 80
lpt_points[8].cy = 75

hWnd = Handle(this)
ll_newRgn = CreatePolygonRgn( lpt_points, 8, ALTERNATE )
SetWindowRgn( hWnd, il_newRgn, TRUE )

///////////////////////////

let me know if you have any question.
Regards

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tr1l0b1tCommented:
more ...

This function is very interesting as it lets you create round rectangle regions which are very extended :

    FUNCTION long CreateRoundRectRgn( long nLeftRect, long nTopRect, long nRightRect, long nBottomRect , long nWidthEllipse, long nHeightEllipse) LIBRARY "gdi32.dll"

    nLeftRect,         // x-coordinate of upper-left corner
    nTopRect,         // y-coordinate of upper-left corner
    nRightRect,       // x-coordinate of lower-right corner
    nBottomRect,    // y-coordinate of lower-right corner
    nWidthEllipse,   // width of ellipse
    nHeightEllipse   // height of ellipse

also take in mind the 'CombineRgn' function (mentioned in the above post) :

    FUNCTION int CombineRgn(ulong hrgnDest, ulong hrgnSrc1, ulong hrgnSrc2, int fnCombineMode) LIBRARY "gdi32.dll"

    hrgnDest,      // handle to destination region
    hrgnSrc1,      // handle to 1st source region
    hrgnSrc2,      // handle to 2nd source region
    fnCombineMode   // region combining mode

where 'fnCombineMode' can take these values :

    CONSTANT RGN_AND   = 1    // Creates the intersection of the two combined regions
    CONSTANT RGN_OR    = 2    // Creates the union of two combined regions
    CONSTANT RGN_XOR   = 3   // Creates the union of two combined regions except for any overlapping areas
    CONSTANT RGN_DIFF   = 4   // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2
    CONSTANT RGN_COPY = 5   // Creates a copy of the region identified by hrgnSrc1

Regions can also be used with objects such PictureButtons or CommandButtons just
taking its handle and aplying them a region as described in the next issue :  http://www.experts-exchange.com/Programming/Programming_Languages/PowerBuilder/Q_20486020.html

Anyway, I recommend you to read MS Reference : http://msdn.microsoft.com/library/en-us/gdi/regions_7ab7.asp

Hope it helps
Regards :: Tr1l0b1t
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.