Knowledge increases when shares to others.
Sunday, January 27
Monday, January 21
Print Document, Data Grid View in c# windows form application
Download source code: Download Here
C# Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Forms;
namespace PrintDocumnentTutorial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
dataGridView1.Columns.Add("SrNO", "Sr No.");
dataGridView1.Columns.Add("Empname", "Employee Name");
}
private void button2_Click(object sender, EventArgs e)
{
dataGridView1.AutoGenerateColumns = false;
dataGridView1.AllowUserToAddRows = false;
dataGridView1.Rows.Clear();
dataGridView1.Rows.Add();
dataGridView1.Rows[0].Cells[0].Value = 1;
dataGridView1.Rows[0].Cells[1].Value = "Umair";
}
private void button1_Click(object sender, EventArgs e)
{
if (dataGridView1.Rows.Count == 0)
{
System.Windows.MessageBox.Show("Data is Empty");
}
else
{
printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font fh = new System.Drawing.Font(new FontFamily("Arial"), 12);
Bitmap dataGridViewImage = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
dataGridView1.DrawToBitmap(dataGridViewImage, new Rectangle(0, 15, this.dataGridView1.Width, this.dataGridView1.Height));
e.Graphics.DrawImage(dataGridViewImage, 0, 15);
e.Graphics.DrawString("add1", fh, Brushes.Black, new System.Drawing.Point(0, (this.dataGridView1.Height + 200)));
e.Graphics.DrawString("add2", fh, Brushes.Black, new System.Drawing.Point(0, (this.dataGridView1.Height + 215)));
e.Graphics.DrawString("add3", fh, Brushes.Black, new System.Drawing.Point(0, (this.dataGridView1.Height + 230)));
}
}
}
C# Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Forms;
namespace PrintDocumnentTutorial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
dataGridView1.Columns.Add("SrNO", "Sr No.");
dataGridView1.Columns.Add("Empname", "Employee Name");
}
private void button2_Click(object sender, EventArgs e)
{
dataGridView1.AutoGenerateColumns = false;
dataGridView1.AllowUserToAddRows = false;
dataGridView1.Rows.Clear();
dataGridView1.Rows.Add();
dataGridView1.Rows[0].Cells[0].Value = 1;
dataGridView1.Rows[0].Cells[1].Value = "Umair";
}
private void button1_Click(object sender, EventArgs e)
{
if (dataGridView1.Rows.Count == 0)
{
System.Windows.MessageBox.Show("Data is Empty");
}
else
{
printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font fh = new System.Drawing.Font(new FontFamily("Arial"), 12);
Bitmap dataGridViewImage = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
dataGridView1.DrawToBitmap(dataGridViewImage, new Rectangle(0, 15, this.dataGridView1.Width, this.dataGridView1.Height));
e.Graphics.DrawImage(dataGridViewImage, 0, 15);
e.Graphics.DrawString("add1", fh, Brushes.Black, new System.Drawing.Point(0, (this.dataGridView1.Height + 200)));
e.Graphics.DrawString("add2", fh, Brushes.Black, new System.Drawing.Point(0, (this.dataGridView1.Height + 215)));
e.Graphics.DrawString("add3", fh, Brushes.Black, new System.Drawing.Point(0, (this.dataGridView1.Height + 230)));
}
}
}
Thursday, January 17
Filing in C# WPF Application
Download Source Code: FileCode
Xaml :
<Window x:Class="FileHandling.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBox Height="23" HorizontalAlignment="Left" Margin="190,106,0,0" Name="filedatatxt" VerticalAlignment="Top" Width="120" />
<Button Content="Write Text" Height="23" HorizontalAlignment="Left" Margin="235,135,0,0" Name="writeBtn" VerticalAlignment="Top" Width="75" Click="writeBtn_Click" />
</Grid>
</Window>
Xaml :
<Window x:Class="FileHandling.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBox Height="23" HorizontalAlignment="Left" Margin="190,106,0,0" Name="filedatatxt" VerticalAlignment="Top" Width="120" />
<Button Content="Write Text" Height="23" HorizontalAlignment="Left" Margin="235,135,0,0" Name="writeBtn" VerticalAlignment="Top" Width="75" Click="writeBtn_Click" />
</Grid>
</Window>
C#:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace FileHandling
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// Reading from file which is located in debug folder
// Begins
string[] lines = File.ReadAllLines("Highscore.txt");
foreach (string tempLines in lines) {
MessageBox.Show(tempLines);
}
// Ends
}
private void writeBtn_Click(object sender, RoutedEventArgs e)
{
StreamWriter writeFile = new StreamWriter("Highscore.txt",true);
writeFile.WriteLine(filedatatxt.Text);
writeFile.Close();
}
}
}
Blur Effect in C# WPF Xaml
XAML Code :
<Window x:Class="blurEffects.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Height="40" Width="100" Content="Blur effect with radius 5">
<Button.Effect>
<BlurEffect Radius="5"></BlurEffect>
</Button.Effect>
</Button>
</Grid>
</Window>
<Window x:Class="blurEffects.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Height="40" Width="100" Content="Blur effect with radius 5">
<Button.Effect>
<BlurEffect Radius="5"></BlurEffect>
</Button.Effect>
</Button>
</Grid>
</Window>
Cool Bounce Animation in C# and Xaml WPF
Source Code : Download here
Video Tutorial :
C# Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Effects;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MainMenuTutorial
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
startMenuAnimation(label1, new Thickness(93, -30, 0, 0), label1.Margin);
startMenuAnimation(label2, new Thickness(198, -30, 0, 0), label2.Margin);
startMenuAnimation(label3, new Thickness(303, -30, 0, 0), label3.Margin);
}
public void startMenuAnimation(Label label, Thickness initialThickness, Thickness finalThickness) {
ThicknessAnimation dropButtons = new ThicknessAnimation();
dropButtons.From = initialThickness;
dropButtons.To = finalThickness;
BounceEase bounceEaseAnimation = new BounceEase();
dropButtons.EasingFunction = bounceEaseAnimation;
bounceEaseAnimation.Bounciness = 3;
label.BeginAnimation(MarginProperty, dropButtons);
}
public void moveAnimation(Label label, Thickness initialMargin, Thickness finalMargin) {
ThicknessAnimation ButtonMovement = new ThicknessAnimation();
ButtonMovement.From = initialMargin;
ButtonMovement.To = finalMargin;
ButtonMovement.Duration = TimeSpan.FromMilliseconds(200);
label.BeginAnimation(MarginProperty, ButtonMovement);
}
public void moveAnimation(Label label, Thickness initialMargin)
{
ThicknessAnimation ButtonMovement = new ThicknessAnimation();
ButtonMovement.To = initialMargin;
ButtonMovement.Duration = TimeSpan.FromMilliseconds(200);
label.BeginAnimation(MarginProperty, ButtonMovement);
}
private void label1_MouseEnter(object sender, MouseEventArgs e)
{
moveAnimation(label1, label1.Margin, new Thickness(label1.Margin.Left, (label1.Margin.Top - 5), label1.Margin.Right, label1.Margin.Bottom));
}
private void label2_MouseEnter(object sender, MouseEventArgs e)
{
moveAnimation(label2, label2.Margin, new Thickness(label2.Margin.Left, (label2.Margin.Top - 5), label2.Margin.Right, label2.Margin.Bottom));
}
private void label3_MouseEnter(object sender, MouseEventArgs e)
{
moveAnimation(label3, label3.Margin, new Thickness(label3.Margin.Left, (label3.Margin.Top - 5), label3.Margin.Right, label3.Margin.Bottom));
}
private void label3_MouseLeave(object sender, MouseEventArgs e)
{
moveAnimation(label3, new Thickness(303, 243, 0, 0));
}
private void label1_MouseLeave(object sender, MouseEventArgs e)
{
moveAnimation(label1, new Thickness(93, 243, 0, 0));
}
private void label2_MouseLeave(object sender, MouseEventArgs e)
{
moveAnimation(label2, new Thickness(198, 243, 0, 0));
}
}
}
Xaml Code:
<Window x:Class="MainMenuTutorial.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" WindowStartupLocation="CenterScreen">
<Grid>
<Label Content="Menu Button 1" MouseEnter="label1_MouseEnter" MouseLeave="label1_MouseLeave" Height="28" HorizontalAlignment="Left" Margin="93,243,0,0" Name="label1" VerticalAlignment="Top" Width="Auto" BorderThickness="2" HorizontalContentAlignment="Center" FontWeight="Bold" FontStretch="Condensed">
<Label.Effect>
<DropShadowEffect BlurRadius="10" Color="Red" ShadowDepth="2" />
</Label.Effect>
<Label.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#B9310000" Offset="0" />
<GradientStop Color="#C3B44343" Offset="1" />
</LinearGradientBrush>
</Label.BorderBrush>
<Label.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFB44343" Offset="0" />
<GradientStop Color="#FF310000" Offset="1" />
</LinearGradientBrush>
</Label.Background>
<Label.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF767676" Offset="1" />
</LinearGradientBrush>
</Label.Foreground>
</Label>
<Label BorderThickness="2" MouseEnter="label2_MouseEnter" MouseLeave="label2_MouseLeave" Content="Menu Button 2" FontStretch="Condensed" FontWeight="Bold" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="198,243,0,0" Name="label2" VerticalAlignment="Top" Width="Auto">
<Label.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFB44343" Offset="0" />
<GradientStop Color="#FF310000" Offset="1" />
</LinearGradientBrush>
</Label.Background>
<Label.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#B9310000" Offset="0" />
<GradientStop Color="#C3B44343" Offset="1" />
</LinearGradientBrush>
</Label.BorderBrush>
<Label.Effect>
<DropShadowEffect BlurRadius="10" Color="Red" ShadowDepth="2" />
</Label.Effect>
<Label.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF767676" Offset="1" />
</LinearGradientBrush>
</Label.Foreground>
</Label>
<Label BorderThickness="2" MouseEnter="label3_MouseEnter" MouseLeave="label3_MouseLeave" Content="Menu Button 3" FontStretch="Condensed" FontWeight="Bold" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="303,243,0,0" Name="label3" VerticalAlignment="Top" Width="Auto">
<Label.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFB44343" Offset="0" />
<GradientStop Color="#FF310000" Offset="1" />
</LinearGradientBrush>
</Label.Background>
<Label.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#B9310000" Offset="0" />
<GradientStop Color="#C3B44343" Offset="1" />
</LinearGradientBrush>
</Label.BorderBrush>
<Label.Effect>
<DropShadowEffect BlurRadius="10" Color="Red" ShadowDepth="2" />
</Label.Effect>
<Label.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF767676" Offset="1" />
</LinearGradientBrush>
</Label.Foreground>
</Label>
</Grid>
</Window>
Video Tutorial :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Effects;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MainMenuTutorial
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
startMenuAnimation(label1, new Thickness(93, -30, 0, 0), label1.Margin);
startMenuAnimation(label2, new Thickness(198, -30, 0, 0), label2.Margin);
startMenuAnimation(label3, new Thickness(303, -30, 0, 0), label3.Margin);
}
public void startMenuAnimation(Label label, Thickness initialThickness, Thickness finalThickness) {
ThicknessAnimation dropButtons = new ThicknessAnimation();
dropButtons.From = initialThickness;
dropButtons.To = finalThickness;
BounceEase bounceEaseAnimation = new BounceEase();
dropButtons.EasingFunction = bounceEaseAnimation;
bounceEaseAnimation.Bounciness = 3;
label.BeginAnimation(MarginProperty, dropButtons);
}
public void moveAnimation(Label label, Thickness initialMargin, Thickness finalMargin) {
ThicknessAnimation ButtonMovement = new ThicknessAnimation();
ButtonMovement.From = initialMargin;
ButtonMovement.To = finalMargin;
ButtonMovement.Duration = TimeSpan.FromMilliseconds(200);
label.BeginAnimation(MarginProperty, ButtonMovement);
}
public void moveAnimation(Label label, Thickness initialMargin)
{
ThicknessAnimation ButtonMovement = new ThicknessAnimation();
ButtonMovement.To = initialMargin;
ButtonMovement.Duration = TimeSpan.FromMilliseconds(200);
label.BeginAnimation(MarginProperty, ButtonMovement);
}
private void label1_MouseEnter(object sender, MouseEventArgs e)
{
moveAnimation(label1, label1.Margin, new Thickness(label1.Margin.Left, (label1.Margin.Top - 5), label1.Margin.Right, label1.Margin.Bottom));
}
private void label2_MouseEnter(object sender, MouseEventArgs e)
{
moveAnimation(label2, label2.Margin, new Thickness(label2.Margin.Left, (label2.Margin.Top - 5), label2.Margin.Right, label2.Margin.Bottom));
}
private void label3_MouseEnter(object sender, MouseEventArgs e)
{
moveAnimation(label3, label3.Margin, new Thickness(label3.Margin.Left, (label3.Margin.Top - 5), label3.Margin.Right, label3.Margin.Bottom));
}
private void label3_MouseLeave(object sender, MouseEventArgs e)
{
moveAnimation(label3, new Thickness(303, 243, 0, 0));
}
private void label1_MouseLeave(object sender, MouseEventArgs e)
{
moveAnimation(label1, new Thickness(93, 243, 0, 0));
}
private void label2_MouseLeave(object sender, MouseEventArgs e)
{
moveAnimation(label2, new Thickness(198, 243, 0, 0));
}
}
}
Xaml Code:
<Window x:Class="MainMenuTutorial.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" WindowStartupLocation="CenterScreen">
<Grid>
<Label Content="Menu Button 1" MouseEnter="label1_MouseEnter" MouseLeave="label1_MouseLeave" Height="28" HorizontalAlignment="Left" Margin="93,243,0,0" Name="label1" VerticalAlignment="Top" Width="Auto" BorderThickness="2" HorizontalContentAlignment="Center" FontWeight="Bold" FontStretch="Condensed">
<Label.Effect>
<DropShadowEffect BlurRadius="10" Color="Red" ShadowDepth="2" />
</Label.Effect>
<Label.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#B9310000" Offset="0" />
<GradientStop Color="#C3B44343" Offset="1" />
</LinearGradientBrush>
</Label.BorderBrush>
<Label.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFB44343" Offset="0" />
<GradientStop Color="#FF310000" Offset="1" />
</LinearGradientBrush>
</Label.Background>
<Label.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF767676" Offset="1" />
</LinearGradientBrush>
</Label.Foreground>
</Label>
<Label BorderThickness="2" MouseEnter="label2_MouseEnter" MouseLeave="label2_MouseLeave" Content="Menu Button 2" FontStretch="Condensed" FontWeight="Bold" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="198,243,0,0" Name="label2" VerticalAlignment="Top" Width="Auto">
<Label.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFB44343" Offset="0" />
<GradientStop Color="#FF310000" Offset="1" />
</LinearGradientBrush>
</Label.Background>
<Label.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#B9310000" Offset="0" />
<GradientStop Color="#C3B44343" Offset="1" />
</LinearGradientBrush>
</Label.BorderBrush>
<Label.Effect>
<DropShadowEffect BlurRadius="10" Color="Red" ShadowDepth="2" />
</Label.Effect>
<Label.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF767676" Offset="1" />
</LinearGradientBrush>
</Label.Foreground>
</Label>
<Label BorderThickness="2" MouseEnter="label3_MouseEnter" MouseLeave="label3_MouseLeave" Content="Menu Button 3" FontStretch="Condensed" FontWeight="Bold" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="303,243,0,0" Name="label3" VerticalAlignment="Top" Width="Auto">
<Label.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFB44343" Offset="0" />
<GradientStop Color="#FF310000" Offset="1" />
</LinearGradientBrush>
</Label.Background>
<Label.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#B9310000" Offset="0" />
<GradientStop Color="#C3B44343" Offset="1" />
</LinearGradientBrush>
</Label.BorderBrush>
<Label.Effect>
<DropShadowEffect BlurRadius="10" Color="Red" ShadowDepth="2" />
</Label.Effect>
<Label.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF767676" Offset="1" />
</LinearGradientBrush>
</Label.Foreground>
</Label>
</Grid>
</Window>
Cool User Interface Designing With C# Animations and XAML Code
Source Code : Download Here
Screen Shot :
C# Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Effects;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void LeftLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/Display.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void LeftLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void CenterLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/inventoryManage.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void CenterLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void RightLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/NewSale.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void RightLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void LeftLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
LeftImg.Effect = null;
}
private void LeftLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
LeftImg.Effect = effectsImg;
}
private void CenterLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 0.7;
CenterImg.BeginAnimation(OpacityProperty, img);
CenterLabel.BeginAnimation(OpacityProperty, img);
image2.BeginAnimation(OpacityProperty, img);
RightImg.BeginAnimation(OpacityProperty, img);
RightLabel.BeginAnimation(OpacityProperty, img);
image3.BeginAnimation(OpacityProperty, img);
LeftImg.BeginAnimation(OpacityProperty, img);
LeftLabel.BeginAnimation(OpacityProperty, img);
image1.BeginAnimation(OpacityProperty, img);
//Hide Items
CenterImg.Visibility = System.Windows.Visibility.Hidden;
CenterLabel.Visibility = System.Windows.Visibility.Hidden;
image2.Visibility = System.Windows.Visibility.Hidden;
RightImg.Visibility = System.Windows.Visibility.Hidden;
RightLabel.Visibility = System.Windows.Visibility.Hidden;
image3.Visibility = System.Windows.Visibility.Hidden;
LeftImg.Visibility = System.Windows.Visibility.Hidden;
LeftLabel.Visibility = System.Windows.Visibility.Hidden;
image1.Visibility = System.Windows.Visibility.Hidden;
//ends
DoubleAnimation img1 = new DoubleAnimation();
img1.To = 0.7;
img1.From = 0;
CenterImg1.BeginAnimation(OpacityProperty, img1);
CenterLabel1.BeginAnimation(OpacityProperty, img1);
image21.BeginAnimation(OpacityProperty, img1);
RightImg1.BeginAnimation(OpacityProperty, img1);
RightLabel1.BeginAnimation(OpacityProperty, img1);
image31.BeginAnimation(OpacityProperty, img1);
ExtremeRightImg.BeginAnimation(OpacityProperty, img1);
ExtremeRightLabel.BeginAnimation(OpacityProperty, img1);
image32.BeginAnimation(OpacityProperty, img1);
Extremeimage1.BeginAnimation(OpacityProperty, img1);
ExtremeLeftImg.BeginAnimation(OpacityProperty, img1);
ExtremeLeftLabel.BeginAnimation(OpacityProperty, img1);
LeftImg1.BeginAnimation(OpacityProperty, img1);
LeftLabel1.BeginAnimation(OpacityProperty, img1);
image112.BeginAnimation(OpacityProperty, img1);
//Visible Items
CenterImg1.Visibility = System.Windows.Visibility.Visible;
CenterLabel1.Visibility = System.Windows.Visibility.Visible;
image21.Visibility = System.Windows.Visibility.Visible;
RightImg1.Visibility = System.Windows.Visibility.Visible;
RightLabel1.Visibility = System.Windows.Visibility.Visible;
image31.Visibility = System.Windows.Visibility.Visible;
image32.Visibility = System.Windows.Visibility.Visible;
ExtremeRightImg.Visibility = System.Windows.Visibility.Visible;
ExtremeRightLabel.Visibility = System.Windows.Visibility.Visible;
Extremeimage1.Visibility = System.Windows.Visibility.Visible;
ExtremeLeftImg.Visibility = System.Windows.Visibility.Visible;
ExtremeLeftLabel.Visibility = System.Windows.Visibility.Visible;
LeftImg1.Visibility = System.Windows.Visibility.Visible;
LeftLabel1.Visibility = System.Windows.Visibility.Visible;
image112.Visibility = System.Windows.Visibility.Visible;
//Ends
}
private void CenterLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
CenterImg.Effect = effectsImg;
}
private void RightLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
RightImg.Effect = null;
}
private void RightLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
RightImg.Effect = effectsImg;
}
private void CenterLabel1_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/NewSale.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void CenterLabel1_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void CenterLabel1_MouseDown(object sender, MouseButtonEventArgs e)
{
CenterImg1.Effect = null;
}
private void CenterLabel1_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
CenterImg1.Effect = effectsImg;
}
private void RightLabel1_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/Delete.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void RightLabel1_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void RightLabel1_MouseDown(object sender, MouseButtonEventArgs e)
{
RightImg1.Effect = null;
}
private void RightLabel1_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
RightImg1.Effect = effectsImg;
}
private void ExtremeLeftLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/Update.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void ExtremeLeftLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void ExtremeLeftLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
ExtremeLeftImg.Effect = null;
}
private void ExtremeLeftLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
ExtremeLeftImg.Effect = effectsImg;
}
private void LeftLabel1_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/ViewSale.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void LeftLabel1_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void LeftLabel1_MouseDown(object sender, MouseButtonEventArgs e)
{
LeftImg1.Effect = null;
}
private void LeftLabel1_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
LeftImg1.Effect = effectsImg;
}
private void ExtremeRightLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/BackIcon.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void ExtremeRightLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void ExtremeRightLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = .7;
img.From = 0;
CenterImg.BeginAnimation(OpacityProperty, img);
CenterLabel.BeginAnimation(OpacityProperty, img);
image2.BeginAnimation(OpacityProperty, img);
RightImg.BeginAnimation(OpacityProperty, img);
RightLabel.BeginAnimation(OpacityProperty, img);
image3.BeginAnimation(OpacityProperty, img);
LeftImg.BeginAnimation(OpacityProperty, img);
LeftLabel.BeginAnimation(OpacityProperty, img);
image1.BeginAnimation(OpacityProperty, img);
//Visible Items
CenterImg.Visibility = System.Windows.Visibility.Visible;
CenterLabel.Visibility = System.Windows.Visibility.Visible;
image2.Visibility = System.Windows.Visibility.Visible;
RightImg.Visibility = System.Windows.Visibility.Visible;
RightLabel.Visibility = System.Windows.Visibility.Visible;
image3.Visibility = System.Windows.Visibility.Visible;
LeftImg.Visibility = System.Windows.Visibility.Visible;
LeftLabel.Visibility = System.Windows.Visibility.Visible;
image1.Visibility = System.Windows.Visibility.Visible;
//ends
//Hidden Items
DoubleAnimation img1 = new DoubleAnimation();
img.To = 0;
img.From = 0.7;
CenterImg1.BeginAnimation(OpacityProperty, img1);
CenterLabel1.BeginAnimation(OpacityProperty, img1);
image21.BeginAnimation(OpacityProperty, img1);
RightImg1.BeginAnimation(OpacityProperty, img1);
RightLabel1.BeginAnimation(OpacityProperty, img1);
image31.BeginAnimation(OpacityProperty, img1);
ExtremeRightImg.BeginAnimation(OpacityProperty, img1);
ExtremeRightLabel.BeginAnimation(OpacityProperty, img1);
image32.BeginAnimation(OpacityProperty, img1);
Extremeimage1.BeginAnimation(OpacityProperty, img1);
ExtremeLeftImg.BeginAnimation(OpacityProperty, img1);
ExtremeLeftLabel.BeginAnimation(OpacityProperty, img1);
LeftImg1.BeginAnimation(OpacityProperty, img1);
LeftLabel1.BeginAnimation(OpacityProperty, img1);
image112.BeginAnimation(OpacityProperty, img1);
CenterImg1.Visibility = System.Windows.Visibility.Hidden;
CenterLabel1.Visibility = System.Windows.Visibility.Hidden;
image21.Visibility = System.Windows.Visibility.Hidden;
RightImg1.Visibility = System.Windows.Visibility.Hidden;
RightLabel1.Visibility = System.Windows.Visibility.Hidden;
image31.Visibility = System.Windows.Visibility.Hidden;
image32.Visibility = System.Windows.Visibility.Hidden;
ExtremeRightImg.Visibility = System.Windows.Visibility.Hidden;
ExtremeRightLabel.Visibility = System.Windows.Visibility.Hidden;
Extremeimage1.Visibility = System.Windows.Visibility.Hidden;
ExtremeLeftImg.Visibility = System.Windows.Visibility.Hidden;
ExtremeLeftLabel.Visibility = System.Windows.Visibility.Hidden;
LeftImg1.Visibility = System.Windows.Visibility.Hidden;
LeftLabel1.Visibility = System.Windows.Visibility.Hidden;
image112.Visibility = System.Windows.Visibility.Hidden;
}
private void ExtremeRightLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
ExtremeRightImg.Effect = effectsImg;
}
}
}
Screen Shot :
XAML Code :
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="450" Width="750">
<Grid>
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF003431" Offset="0" />
<GradientStop Color="#FF00C7B8" Offset="1" />
</LinearGradientBrush>
</Grid.Background>
<Image Height="64" Source="buttonImg/button.png" Visibility="Hidden" Opacity=".7" HorizontalAlignment="Center" Margin="471,0,31,61" Name="ExtremeRightImg" Stretch="Fill" VerticalAlignment="Bottom" Width="125" >
<Image.Effect>
<DropShadowEffect Direction="270" BlurRadius="15" ShadowDepth="7" />
</Image.Effect>
</Image>
<Image Height="35" Visibility="Hidden" Source="buttonIcons/backIcon.png" Opacity=".6" HorizontalAlignment="Center" Margin="514,0,74,90" Name="image32" Stretch="Fill" VerticalAlignment="Bottom" Width="40" />
<Label Content="Back" MouseEnter="ExtremeRightLabel_MouseEnter" MouseLeave="ExtremeRightLabel_MouseLeave" MouseDown="ExtremeRightLabel_MouseDown" MouseUp="ExtremeRightLabel_MouseUp" Visibility="Hidden" Height="64" HorizontalAlignment="Center" Margin="471,0,31,61" HorizontalContentAlignment="Center" VerticalContentAlignment="Bottom" Opacity=".5" Foreground="White" FontWeight="Bold" Name="ExtremeRightLabel" VerticalAlignment="Bottom" Width="125" />
<Image Height="64" Source="buttonImg/button.png" Opacity=".7" HorizontalAlignment="Center" Margin="362,0,141,39" Name="RightImg" Stretch="Fill" VerticalAlignment="Bottom" Width="125" >
<Image.Effect>
<DropShadowEffect Direction="270" BlurRadius="15" ShadowDepth="7" />
</Image.Effect>
</Image>
<Image Height="35" Source="buttonIcons/NewSale.png" Opacity=".6" HorizontalAlignment="Center" Margin="405,0,183,68" Name="image3" Stretch="Fill" VerticalAlignment="Bottom" Width="40" />
<Label Content="New Sale" MouseDown="RightLabel_MouseDown" MouseUp="RightLabel_MouseUp" Height="64" MouseEnter="RightLabel_MouseEnter" MouseLeave="RightLabel_MouseLeave" HorizontalAlignment="Center" Margin="361,0,141,39" HorizontalContentAlignment="Center" VerticalContentAlignment="Bottom" Opacity=".5" Foreground="White" FontWeight="Bold" Name="RightLabel" VerticalAlignment="Bottom" Width="125" />
<Image Height="64" Visibility="Hidden" Source="buttonImg/button.png" Opacity=".7" HorizontalAlignment="Center" Margin="363,0,141,39" Name="RightImg1" Stretch="Fill" VerticalAlignment="Bottom" Width="125" >
<Image.Effect>
<DropShadowEffect Direction="270" BlurRadius="15" ShadowDepth="7" />
</Image.Effect>
</Image>
<Image Visibility="Hidden" Height="35" Source="buttonIcons/Delete.png" Opacity=".6" HorizontalAlignment="Center" Margin="405,0,183,68" Name="image31" Stretch="Fill" VerticalAlignment="Bottom" Width="40" />
<Label Visibility="Hidden" Content="Delete" Height="64" MouseEnter="RightLabel1_MouseEnter" MouseLeave="RightLabel1_MouseLeave" MouseDown="RightLabel1_MouseDown" MouseUp="RightLabel1_MouseUp" HorizontalAlignment="Center" Margin="361,0,141,39" HorizontalContentAlignment="Center" VerticalContentAlignment="Bottom" Opacity=".5" Foreground="White" FontWeight="Bold" Name="RightLabel1" VerticalAlignment="Bottom" Width="125" />
<Image Height="64" Visibility="Hidden" Source="buttonImg/button.png" Opacity=".7" HorizontalAlignment="Center" Margin="28,0,476,61" Name="ExtremeLeftImg" Stretch="Fill" VerticalAlignment="Bottom" Width="125" >
<Image.Effect>
<DropShadowEffect Direction="270" BlurRadius="15" ShadowDepth="7" />
</Image.Effect>
</Image>
<Image Height="35" Source="buttonIcons/Update.png" Visibility="Hidden" Opacity=".6" HorizontalAlignment="Center" Margin="68,0,520,90" Name="Extremeimage1" Stretch="Fill" VerticalAlignment="Bottom" Width="40" />
<Label Content="Update" Visibility="Hidden" MouseEnter="ExtremeLeftLabel_MouseEnter" MouseLeave="ExtremeLeftLabel_MouseLeave" MouseDown="ExtremeLeftLabel_MouseDown" MouseUp="ExtremeLeftLabel_MouseUp" Height="64" HorizontalAlignment="Center" FontWeight="Bold" Margin="28,0,476,61" Foreground="White" Opacity=".5" HorizontalContentAlignment="Center" VerticalContentAlignment="Bottom" Name="ExtremeLeftLabel" VerticalAlignment="Bottom" Width="125" />
<Image Height="64" Visibility="Hidden" Source="buttonImg/button.png" Opacity=".7" HorizontalAlignment="Center" Margin="140,0,364,39" Name="LeftImg1" Stretch="Fill" VerticalAlignment="Bottom" Width="125" >
<Image.Effect>
<DropShadowEffect Direction="270" BlurRadius="15" ShadowDepth="7" />
</Image.Effect>
</Image>
<Image Height="35" Visibility="Hidden" Source="buttonIcons/ViewSale.png" Opacity=".6" HorizontalAlignment="Center" Margin="177,0,411,68" Name="image112" Stretch="Fill" VerticalAlignment="Bottom" Width="40" />
<Label Visibility="Hidden" MouseEnter="LeftLabel1_MouseEnter" MouseLeave="LeftLabel1_MouseLeave" MouseDown="LeftLabel1_MouseDown" MouseUp="LeftLabel1_MouseUp" Content="View Report" Height="64" HorizontalAlignment="Center" FontWeight="Bold" Margin="140,0,364,39" Foreground="White" Opacity=".5" HorizontalContentAlignment="Center" VerticalContentAlignment="Bottom" Name="LeftLabel1" VerticalAlignment="Bottom" Width="125" />
<Image Height="64" Source="buttonImg/button.png" Opacity=".7" HorizontalAlignment="Center" Margin="140,0,364,39" Name="LeftImg" Stretch="Fill" VerticalAlignment="Bottom" Width="125" >
<Image.Effect>
<DropShadowEffect Direction="270" BlurRadius="15" ShadowDepth="7" />
</Image.Effect>
</Image>
<Image Height="35" Source="buttonIcons/display.png" Opacity=".6" HorizontalAlignment="Center" Margin="177,0,411,68" Name="image1" Stretch="Fill" VerticalAlignment="Bottom" Width="40" />
<Label Content="Dislay" MouseEnter="LeftLabel_MouseEnter" MouseUp="LeftLabel_MouseUp" MouseDown="LeftLabel_MouseDown" MouseLeave="LeftLabel_MouseLeave" Height="64" HorizontalAlignment="Center" FontWeight="Bold" Margin="140,0,364,39" Foreground="White" Opacity=".5" HorizontalContentAlignment="Center" VerticalContentAlignment="Bottom" Name="LeftLabel" VerticalAlignment="Bottom" Width="125" />
<Image Height="64" HorizontalAlignment="Center" Margin="191,0,188,20" Opacity=".7" Name="CenterImg" Source="buttonImg/button.png" Stretch="Fill" VerticalAlignment="Bottom" Width="125" >
<Image.Effect>
<DropShadowEffect Direction="270" BlurRadius="15" ShadowDepth="7" />
</Image.Effect>
</Image>
<Image Height="35" Source="buttonIcons/inventoryManage.png" Opacity=".6" HorizontalAlignment="Center" Margin="233,0,230,49" Name="image2" Stretch="Fill" VerticalAlignment="Bottom" Width="40" />
<Label Content="Inventory Manage" MouseDown="CenterLabel_MouseDown" MouseUp="CenterLabel_MouseUp" MouseEnter="CenterLabel_MouseEnter" MouseLeave="CenterLabel_MouseLeave" Opacity=".5" Foreground="White" FontWeight="Black" Height="64" HorizontalAlignment="Center" Margin="190,0,188,20" HorizontalContentAlignment="Center" VerticalContentAlignment="Bottom" Name="CenterLabel" VerticalAlignment="Bottom" Width="125" />
<Image Height="64" Visibility="Hidden" HorizontalAlignment="Center" Margin="191,0,188,20" Opacity=".7" Name="CenterImg1" Source="buttonImg/button.png" Stretch="Fill" VerticalAlignment="Bottom" Width="125" >
<Image.Effect>
<DropShadowEffect Direction="270" BlurRadius="15" ShadowDepth="7" />
</Image.Effect>
</Image>
<Image Visibility="Hidden" Height="35" Source="buttonIcons/NewSale.png" Opacity=".6" HorizontalAlignment="Center" Margin="233,0,230,49" Name="image21" Stretch="Fill" VerticalAlignment="Bottom" Width="40" />
<Label Visibility="Hidden" MouseEnter="CenterLabel1_MouseEnter" MouseLeave="CenterLabel1_MouseLeave" MouseDown="CenterLabel1_MouseDown" MouseUp="CenterLabel1_MouseUp" Content="Add Stock" Opacity=".5" Foreground="White" FontWeight="Black" Height="64" HorizontalAlignment="Center" Margin="228,0,226,20" HorizontalContentAlignment="Center" VerticalContentAlignment="Bottom" Name="CenterLabel1" VerticalAlignment="Bottom" Width="125" />
<Image Height="150" HorizontalAlignment="Center" Margin="265,76,243,165" Name="ButtonIcons" Stretch="Fill" VerticalAlignment="Center" Width="150" />
<Ellipse Height="238" HorizontalAlignment="Center" Margin="103,42,101,131" Name="ellipse1" VerticalAlignment="Center" Width="524" StrokeThickness="10" Opacity="0" Fill="{x:Null}">
<Ellipse.Stroke>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="#1700C7B8" Offset="0" />
<GradientStop Color="#1700C7B8" Offset="1" />
<GradientStop Color="Transparent" Offset="0.512" />
</LinearGradientBrush>
</Ellipse.Stroke>
<Ellipse.Effect x:Uid="Effects">
<BlurEffect Radius="5" />
</Ellipse.Effect>
</Ellipse>
<Label Content="Choose From Menu" FontFamily="Chiller" FontSize="24" FontWeight="Bold" Height="35" HorizontalAlignment="Center" Margin="300,12,267,0" Name="label1" VerticalAlignment="Top" Width="161">
<Label.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF00A8C7" Offset="1" />
</LinearGradientBrush>
</Label.Foreground>
<Label.Effect>
<DropShadowEffect />
</Label.Effect>
</Label>
</Grid>
</Window>
C# Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Effects;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void LeftLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/Display.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void LeftLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void CenterLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/inventoryManage.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void CenterLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void RightLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/NewSale.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void RightLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void LeftLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
LeftImg.Effect = null;
}
private void LeftLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
LeftImg.Effect = effectsImg;
}
private void CenterLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 0.7;
CenterImg.BeginAnimation(OpacityProperty, img);
CenterLabel.BeginAnimation(OpacityProperty, img);
image2.BeginAnimation(OpacityProperty, img);
RightImg.BeginAnimation(OpacityProperty, img);
RightLabel.BeginAnimation(OpacityProperty, img);
image3.BeginAnimation(OpacityProperty, img);
LeftImg.BeginAnimation(OpacityProperty, img);
LeftLabel.BeginAnimation(OpacityProperty, img);
image1.BeginAnimation(OpacityProperty, img);
//Hide Items
CenterImg.Visibility = System.Windows.Visibility.Hidden;
CenterLabel.Visibility = System.Windows.Visibility.Hidden;
image2.Visibility = System.Windows.Visibility.Hidden;
RightImg.Visibility = System.Windows.Visibility.Hidden;
RightLabel.Visibility = System.Windows.Visibility.Hidden;
image3.Visibility = System.Windows.Visibility.Hidden;
LeftImg.Visibility = System.Windows.Visibility.Hidden;
LeftLabel.Visibility = System.Windows.Visibility.Hidden;
image1.Visibility = System.Windows.Visibility.Hidden;
//ends
DoubleAnimation img1 = new DoubleAnimation();
img1.To = 0.7;
img1.From = 0;
CenterImg1.BeginAnimation(OpacityProperty, img1);
CenterLabel1.BeginAnimation(OpacityProperty, img1);
image21.BeginAnimation(OpacityProperty, img1);
RightImg1.BeginAnimation(OpacityProperty, img1);
RightLabel1.BeginAnimation(OpacityProperty, img1);
image31.BeginAnimation(OpacityProperty, img1);
ExtremeRightImg.BeginAnimation(OpacityProperty, img1);
ExtremeRightLabel.BeginAnimation(OpacityProperty, img1);
image32.BeginAnimation(OpacityProperty, img1);
Extremeimage1.BeginAnimation(OpacityProperty, img1);
ExtremeLeftImg.BeginAnimation(OpacityProperty, img1);
ExtremeLeftLabel.BeginAnimation(OpacityProperty, img1);
LeftImg1.BeginAnimation(OpacityProperty, img1);
LeftLabel1.BeginAnimation(OpacityProperty, img1);
image112.BeginAnimation(OpacityProperty, img1);
//Visible Items
CenterImg1.Visibility = System.Windows.Visibility.Visible;
CenterLabel1.Visibility = System.Windows.Visibility.Visible;
image21.Visibility = System.Windows.Visibility.Visible;
RightImg1.Visibility = System.Windows.Visibility.Visible;
RightLabel1.Visibility = System.Windows.Visibility.Visible;
image31.Visibility = System.Windows.Visibility.Visible;
image32.Visibility = System.Windows.Visibility.Visible;
ExtremeRightImg.Visibility = System.Windows.Visibility.Visible;
ExtremeRightLabel.Visibility = System.Windows.Visibility.Visible;
Extremeimage1.Visibility = System.Windows.Visibility.Visible;
ExtremeLeftImg.Visibility = System.Windows.Visibility.Visible;
ExtremeLeftLabel.Visibility = System.Windows.Visibility.Visible;
LeftImg1.Visibility = System.Windows.Visibility.Visible;
LeftLabel1.Visibility = System.Windows.Visibility.Visible;
image112.Visibility = System.Windows.Visibility.Visible;
//Ends
}
private void CenterLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
CenterImg.Effect = effectsImg;
}
private void RightLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
RightImg.Effect = null;
}
private void RightLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
RightImg.Effect = effectsImg;
}
private void CenterLabel1_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/NewSale.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void CenterLabel1_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void CenterLabel1_MouseDown(object sender, MouseButtonEventArgs e)
{
CenterImg1.Effect = null;
}
private void CenterLabel1_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
CenterImg1.Effect = effectsImg;
}
private void RightLabel1_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/Delete.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void RightLabel1_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void RightLabel1_MouseDown(object sender, MouseButtonEventArgs e)
{
RightImg1.Effect = null;
}
private void RightLabel1_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
RightImg1.Effect = effectsImg;
}
private void ExtremeLeftLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/Update.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void ExtremeLeftLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void ExtremeLeftLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
ExtremeLeftImg.Effect = null;
}
private void ExtremeLeftLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
ExtremeLeftImg.Effect = effectsImg;
}
private void LeftLabel1_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/ViewSale.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void LeftLabel1_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void LeftLabel1_MouseDown(object sender, MouseButtonEventArgs e)
{
LeftImg1.Effect = null;
}
private void LeftLabel1_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
LeftImg1.Effect = effectsImg;
}
private void ExtremeRightLabel_MouseEnter(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 1;
img.From = 0;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
BitmapImage imgIcon = new BitmapImage(new Uri("ButtonIcons/BackIcon.png", UriKind.Relative));
ButtonIcons.Source = imgIcon;
}
private void ExtremeRightLabel_MouseLeave(object sender, MouseEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = 0;
img.From = 1;
ButtonIcons.BeginAnimation(OpacityProperty, img);
ellipse1.BeginAnimation(OpacityProperty, img);
}
private void ExtremeRightLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
DoubleAnimation img = new DoubleAnimation();
img.To = .7;
img.From = 0;
CenterImg.BeginAnimation(OpacityProperty, img);
CenterLabel.BeginAnimation(OpacityProperty, img);
image2.BeginAnimation(OpacityProperty, img);
RightImg.BeginAnimation(OpacityProperty, img);
RightLabel.BeginAnimation(OpacityProperty, img);
image3.BeginAnimation(OpacityProperty, img);
LeftImg.BeginAnimation(OpacityProperty, img);
LeftLabel.BeginAnimation(OpacityProperty, img);
image1.BeginAnimation(OpacityProperty, img);
//Visible Items
CenterImg.Visibility = System.Windows.Visibility.Visible;
CenterLabel.Visibility = System.Windows.Visibility.Visible;
image2.Visibility = System.Windows.Visibility.Visible;
RightImg.Visibility = System.Windows.Visibility.Visible;
RightLabel.Visibility = System.Windows.Visibility.Visible;
image3.Visibility = System.Windows.Visibility.Visible;
LeftImg.Visibility = System.Windows.Visibility.Visible;
LeftLabel.Visibility = System.Windows.Visibility.Visible;
image1.Visibility = System.Windows.Visibility.Visible;
//ends
//Hidden Items
DoubleAnimation img1 = new DoubleAnimation();
img.To = 0;
img.From = 0.7;
CenterImg1.BeginAnimation(OpacityProperty, img1);
CenterLabel1.BeginAnimation(OpacityProperty, img1);
image21.BeginAnimation(OpacityProperty, img1);
RightImg1.BeginAnimation(OpacityProperty, img1);
RightLabel1.BeginAnimation(OpacityProperty, img1);
image31.BeginAnimation(OpacityProperty, img1);
ExtremeRightImg.BeginAnimation(OpacityProperty, img1);
ExtremeRightLabel.BeginAnimation(OpacityProperty, img1);
image32.BeginAnimation(OpacityProperty, img1);
Extremeimage1.BeginAnimation(OpacityProperty, img1);
ExtremeLeftImg.BeginAnimation(OpacityProperty, img1);
ExtremeLeftLabel.BeginAnimation(OpacityProperty, img1);
LeftImg1.BeginAnimation(OpacityProperty, img1);
LeftLabel1.BeginAnimation(OpacityProperty, img1);
image112.BeginAnimation(OpacityProperty, img1);
CenterImg1.Visibility = System.Windows.Visibility.Hidden;
CenterLabel1.Visibility = System.Windows.Visibility.Hidden;
image21.Visibility = System.Windows.Visibility.Hidden;
RightImg1.Visibility = System.Windows.Visibility.Hidden;
RightLabel1.Visibility = System.Windows.Visibility.Hidden;
image31.Visibility = System.Windows.Visibility.Hidden;
image32.Visibility = System.Windows.Visibility.Hidden;
ExtremeRightImg.Visibility = System.Windows.Visibility.Hidden;
ExtremeRightLabel.Visibility = System.Windows.Visibility.Hidden;
Extremeimage1.Visibility = System.Windows.Visibility.Hidden;
ExtremeLeftImg.Visibility = System.Windows.Visibility.Hidden;
ExtremeLeftLabel.Visibility = System.Windows.Visibility.Hidden;
LeftImg1.Visibility = System.Windows.Visibility.Hidden;
LeftLabel1.Visibility = System.Windows.Visibility.Hidden;
image112.Visibility = System.Windows.Visibility.Hidden;
}
private void ExtremeRightLabel_MouseUp(object sender, MouseButtonEventArgs e)
{
DropShadowEffect effectsImg = new DropShadowEffect();
effectsImg.BlurRadius = 15;
effectsImg.Direction = 270;
effectsImg.ShadowDepth = 7;
ExtremeRightImg.Effect = effectsImg;
}
}
}
Subscribe to:
Posts (Atom)