Ugrás a tartalomhoz

.NET Programming Technologies

Gergely Kovásznai, Csaba Biró

Eszterházy Károly College

BitmapEffects

BitmapEffects

BitmapEffects are from the System.Windows.Media.Effects.Effects.BitmapEffect class. They can be used ubiquitously, more parameterized than the previously known effects.

DropShadowBitmapEffect

A shadow can be placed behind an item with the help of this application.

Properties:

Color        shadow color,

Direction        shadowdirection,

Opacity        shadow opacity,

Softness        shadow softness.

OuterGlowBitmapEffect

OuterGlowBitmapEffect can be used for adding a light circle to the element.

Properties:

GlowColor        light color

GlowSize        light size,

Opacity        light opacity.

BlurBitmapEffect

The GUI elements seem to be blurred with the help of it.

Properties:

Radius        blur radius,

KernelType        kernel type,

EmbossBitmapEffect

Patterns, depth can be assigned to an objects.

Properties:

LightAngle        light angle,

Relief        embossing rate.

BevelBitmapEffect

The previous EmbossBitmapEffect is supplemented with setting the width of the projection, the edge profile and smoothness.

LightAngle        light angle,

Relief        embossing rate,

BevelWidth        bevel width,

EdgeProfile        edge profile,

Smoothness        smoothness.

BitmapEffectGroup

BitmapEffectGroup has to be used if you would like to add even more effect to an item. Any number of effects can be assigned in the Children collection.

Example IX.5 BitmapEffectGroup 1

IX.4. BitmapEffectGroup

<StackPanel Background="yellow">

     <Button Width="150" Height="60" Content="DropShadowBitmapEffect" Margin="10">

          <Button.BitmapEffect>

                 <DropShadowBitmapEffect Color="Red"

                                            Direction="45"

                                            ShadowDepth="10"

                                            Opacity="0.5"

                                            Softness="1" />

           </Button.BitmapEffect>

     </Button>

     <Button Width="150" Height="60" Content="BlurBitmapEffect" Margin="10">

           <Button.BitmapEffect>

                   <BlurBitmapEffect KernelType="Box" Radius="2" />

           </Button.BitmapEffect>

     </Button>

     <Button Width="150" Height="60" Content="BevelBitmapEffect" Margin="10">

           <Button.BitmapEffect>

                    <BevelBitmapEffect BevelWidth="10"

                                       EdgeProfile="BulgedUp"

                                       LightAngle="270"

                                       Relief="0.7"

                                       Smoothness="0.3"/>

                    </Button.BitmapEffect>

     </Button>

     <Button Width="150" Height="60" Content="EmbossBitmapEffect" Margin="10">

            <Button.BitmapEffect>

                    <EmbossBitmapEffect LightAngle="270"

                                       Relief="2"/>

     </Button.BitmapEffect>

     </Button>

     <Button Width="150" Height="60" Content="OuterGlowBitmapEffect" Margin="10">

             <Button.BitmapEffect>

                      <OuterGlowBitmapEffect GlowColor="Red"

                                           GlowSize="10"

                                           Noise="0.7"

                                           Opacity="0.5"/>

                </Button.BitmapEffect>

       </Button>

</StackPanel>

Example IX.6 BitmapEffectGroup 2

<Button Content="BitmapEffectGroup" Height="50" Width="150">

        <Button.BitmapEffect>

             <BitmapEffectGroup>

                <DropShadowBitmapEffect Color="Beige"/>

                <BlurBitmapEffect KernelType="Box" Radius="2"/>

                <BevelBitmapEffect LightAngle="20"/>

             </BitmapEffectGroup>

        </Button.BitmapEffect>

</Button>