adxSuperPanel© Technical Notes Part II
Home
adxSuperPanel Properties
Getting Started
Gallery
Contact Us
 
About Us and More

Drop Shadows: adxSuperPanel draws the shadow using transferred regions. The shadow appears as a visual extension of the control. To look believable, cast shadow should mimic its source. adxSuperPanel clones of the client GraphicPath, and paints each region in its place. But this is not enough. What happens if you start to modify the transparency level of either regions? The transparency level of the main client is 57. The shade region will start to show underneath the client region:

If Not gpShadow Is Nothing Then
       shadowGradientBrush = Me.CreateShadowBrushWithSoftness(gpShadow)
       shadowRegion = New Region(gpShadow)
       g.FillRegion(mainBrush, mainRegion)
       g.FillRegion(shadowGradientBrush, shadowRegion)

End If

Not good. The entire trick is falling apart. The solution, is to  exclude each region from the other.

If Not gpShadow Is Nothing Then
    shadowGradientBrush = Me.CreateShadowBrushWithSoftness(gpShadow)
    shadowRegion = New Region(gpShadow)
    shadowRegion.Exclude(mainRegion) 'excludes the shade region from the main region
    g.FillRegion(mainBrush, mainRegion)
    g.FillRegion(shadowGradientBrush, shadowRegion)
End If

With same Transparency level the control looks much better:

Shadow Softness: This is a sour point. I have used a GradientLinearBrush with one surrounding color. This property, is not working very well. The path is excellent with round objects but it misses the point with square or not so round corners. To create true shadow softness you need to control individual pixels on the edge. The property works with shadow no wider than 5 pixels. You can try to work with the Transparency property of the shadow to create a better looking effect.

Control designers often restrict property values from going awry. We have done nothing of sorts here. You may go and create some funny oddballs, where the border width property exceeds the width of the control. We were very careful to put some limits where things can crash.

 
Contact: Skyhawk Software
Copyright © 2005, Skyhawk Software Corp. New York, NY . All rights reserved.