本文整理汇总了C#中System.Windows.Controls.Button.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# Button.BeginAnimation方法的具体用法?C# Button.BeginAnimation怎么用?C# Button.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Button
的用法示例。
在下文中一共展示了Button.BeginAnimation方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: blinkSearchButton_Stop
public static void blinkSearchButton_Stop(SearchWindow searchWindow0, Button button0)
{
if (searchWindow0 == BlackoutWindow.unvisibleSearchWindow) {
BlackoutWindow.unvisibleSearchWindow = null;
//
button0.BeginAnimation(Button.OpacityProperty, null);
button0.Opacity = 1;
button0.Effect = null;
}
}
示例2: blinkSearchButton_Start
/// <summary>
/// Hide()した検索ウィンドウがあることを知らせるため、検索ボタンを点滅させる
/// </summary>
/// <param name="button0"></param>
/// <param name="isBlink0"></param>
public static void blinkSearchButton_Start(SearchWindow searchWindow0, Button button0)
{
BlackoutWindow.unvisibleSearchWindow = searchWindow0;
//
button0.Effect = new System.Windows.Media.Effects.DropShadowEffect();
var animation = new System.Windows.Media.Animation.DoubleAnimation {
From = 1.0,
To = 0.7,
RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever,
AutoReverse = true
};
button0.BeginAnimation(Button.OpacityProperty, animation);
}
示例3: LocalAnimationExample
public LocalAnimationExample()
{
WindowTitle = "Local Animation Example";
var myStackPanel = new StackPanel {Margin = new Thickness(20)};
// Create and set the Button.
var aButton = new Button {Content = "A Button"};
// Animate the Button's Width.
var myDoubleAnimation = new DoubleAnimation
{
From = 75,
To = 300,
Duration = new Duration(TimeSpan.FromSeconds(5)),
AutoReverse = true,
RepeatBehavior = RepeatBehavior.Forever
};
// Apply the animation to the button's Width property.
aButton.BeginAnimation(WidthProperty, myDoubleAnimation);
// Create and animate a Brush to set the button's Background.
var myBrush = new SolidColorBrush {Color = Colors.Blue};
var myColorAnimation = new ColorAnimation
{
From = Colors.Blue,
To = Colors.Red,
Duration = new Duration(TimeSpan.FromMilliseconds(7000)),
AutoReverse = true,
RepeatBehavior = RepeatBehavior.Forever
};
// Apply the animation to the brush's Color property.
myBrush.BeginAnimation(SolidColorBrush.ColorProperty, myColorAnimation);
aButton.Background = myBrush;
// Add the Button to the panel.
myStackPanel.Children.Add(aButton);
Content = myStackPanel;
}
示例4: Icon_Animation1
//图标的height动画效果,1个重载,true表示出现,false表示消失动画
//height表示图标的高度,time表示动画时间
//此处为button的方法
private void Icon_Animation1(Button sender, bool appear , double height ,double time)
{
double distanceFrom,distanceTo;
if (appear == true)
{
distanceFrom = 0;
distanceTo = height;
}
else
{
distanceFrom = height;
distanceTo = 0;
}
DoubleAnimation heighAnimation = new DoubleAnimation();
heighAnimation.From = distanceFrom;
heighAnimation.To = distanceTo;
//线性差值需规定起点终点
heighAnimation.Duration = TimeSpan.FromSeconds(time);
//实现动画的时间
sender.BeginAnimation(Button.HeightProperty, heighAnimation);
}
示例5: btn_ToSmall
private void btn_ToSmall(Button btn)
{
Launcher launcher = (Launcher)btn.Tag;
DoubleAnimation anim = AnimButtonSize(btn.Width, launcher.Width);
btn.BeginAnimation(Button.WidthProperty, anim);
btn.BeginAnimation(Button.HeightProperty, anim);
}
示例6: btn_ToLarge
private void btn_ToLarge(Button btn)
{
btn.Focus();
Launcher launcher = (Launcher)btn.Tag;
DoubleAnimation anim = AnimButtonSize(btn.Width, launcher.Width * 1.2);
btn.BeginAnimation(Button.WidthProperty, anim);
btn.BeginAnimation(Button.HeightProperty, anim);
}
示例7: FindDiagnosis
//.........这里部分代码省略.........
var procedure1 = procedure;
labelprocedure.MouseDoubleClick += (o, args) =>
{
var form = new WorkerInfo(procedure1.IdWorker);
form.ShowDialog();
};
}
if (intProcedure != 0)
{
var gradient = new LinearGradientBrush {StartPoint = new Point(0, 0), EndPoint = new Point(1, 1)};
var buttonopenprocedure = new Button
{
Background = gradient,
Foreground = Brushes.MediumBlue,
FontWeight = FontWeights.Bold,
Content = "Переглянути процедури",
Height = 20,
Width = 450
};
gradient.GradientStops.Add(new GradientStop
{
Color = Color.FromArgb(255, 249, 249, 200),
Offset = 0
});
gradient.GradientStops.Add(new GradientStop
{
Color = Color.FromArgb(255, 251, 228, 0),
Offset = 1
});
DockPanel.SetDock(buttonopenprocedure, Dock.Bottom);
paneldiagnosis1.Children.Add(buttonopenprocedure);
panelallprocedure.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
panelallprocedure.Arrange(new Rect(new Point(0, 0), panelallprocedure.DesiredSize));
var panelHeight = panelallprocedure.ActualHeight;
panelallprocedure.Height = 0;
var isToggle = new bool();
buttonopenprocedure.Click += (o, args) =>
{
var da = new DoubleAnimation();
if (!isToggle)
{
da.From = 450;
da.To = 800;
da.Duration = TimeSpan.FromSeconds(0.5);
buttonopenprocedure.BeginAnimation(WidthProperty, da);
da.From = 0;
da.To = panelHeight;
da.Duration = TimeSpan.FromSeconds(0.5);
panelallprocedure.BeginAnimation(HeightProperty, da);
isToggle = true;
buttonopenprocedure.Content = "Закрити";
}
else
{
da.From = 800;
da.To = 450;
da.Duration = TimeSpan.FromSeconds(0.5);
buttonopenprocedure.BeginAnimation(WidthProperty, da);
da.From = panelHeight;
da.To = 0;
da.Duration = TimeSpan.FromSeconds(0.5);
panelallprocedure.BeginAnimation(HeightProperty, da);
isToggle = false;
buttonopenprocedure.Content = "Переглянути процедури";
}
};
}
DockPanel.SetDock(paneldiagnosis1, Dock.Top);
DockPanel.SetDock(panelallprocedure, Dock.Top);
DockPanel.SetDock(paneldiagnosis, Dock.Top);
photoDiagnosisScrollViewer.Content = paneldiagnosisphoto;
photoDiagnosisScrollViewer.PreviewMouseWheel += (o, args) =>
{
if (args.Delta > 0)
{
ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset - 48);
}
else
{
ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset + 48);
}
};
DockPanel.SetDock(paneldiagnosisphoto, Dock.Top);
DockPanel.SetDock(labeldiagnosis, Dock.Top);
paneldiagnosis.Children.Add(labeldiagnosis);
paneldiagnosis.Children.Add(photoDiagnosisScrollViewer);
paneldiagnosis1.Children.Add(paneldiagnosis);
paneldiagnosis1.Children.Add(panelallprocedure);
panelAllDiagnosis.Children.Add(paneldiagnosis1);
var disease1 = disease;
labeldiagnosis.MouseDoubleClick += (o, args) =>
{
var form = new WorkerInfo(disease1.IdWorker);
form.ShowDialog();
};
PatientPanel.Visibility = Visibility.Visible;
}
}
示例8: FindVisit
//.........这里部分代码省略.........
labelanalysis.MouseDoubleClick += (o, args) =>
{
var form = new WorkerInfo(analysis1.IdWorker);
form.ShowDialog();
};
}
if (intAnalysis != 0)
{
var gradient = new LinearGradientBrush {StartPoint = new Point(0, 0), EndPoint = new Point(1, 1)};
var buttonopenanalisis = new Button
{
Background = gradient,
Foreground = Brushes.MediumBlue,
FontWeight = FontWeights.Bold,
Content = "Переглянути аналізи",
Height = 20,
Width = 450
};
gradient.GradientStops.Add(new GradientStop
{
Color = Color.FromArgb(255, 249, 249, 200),
Offset = 0
});
gradient.GradientStops.Add(new GradientStop
{
Color = Color.FromArgb(255, 251, 228, 0),
Offset = 1
});
DockPanel.SetDock(buttonopenanalisis, Dock.Bottom);
panelvisit1.Children.Add(buttonopenanalisis);
panelallanalysis.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
panelallanalysis.Arrange(new Rect(new Point(0, 0), panelallanalysis.DesiredSize));
var panelHeight = panelallanalysis.ActualHeight;
panelallanalysis.Height = 0;
var isToggle = new bool();
buttonopenanalisis.Click += (o, args) =>
{
var da = new DoubleAnimation();
if (!isToggle)
{
da.From = 450;
da.To = 800;
da.Duration = TimeSpan.FromSeconds(0.5);
buttonopenanalisis.BeginAnimation(WidthProperty, da);
da.From = 0;
da.To = panelHeight;
da.Duration = TimeSpan.FromSeconds(0.5);
panelallanalysis.BeginAnimation(HeightProperty, da);
isToggle = true;
buttonopenanalisis.Content = "Закрити";
}
else
{
da.From = 800;
da.To = 450;
da.Duration = TimeSpan.FromSeconds(0.5);
buttonopenanalisis.BeginAnimation(WidthProperty, da);
da.From = panelHeight;
da.To = 0;
da.Duration = TimeSpan.FromSeconds(0.5);
panelallanalysis.BeginAnimation(HeightProperty, da);
isToggle = false;
buttonopenanalisis.Content = "Переглянути аналізи";
}
};
}
DockPanel.SetDock(panelvisit1, Dock.Top);
DockPanel.SetDock(panelallanalysis, Dock.Top);
DockPanel.SetDock(panelvisit, Dock.Top);
photoVisitsScrollViewer.Content = panelvisitphoto;
photoVisitsScrollViewer.PreviewMouseWheel += (o, args) =>
{
if (args.Delta > 0)
{
ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset - 48);
}
else
{
ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset + 48);
}
};
DockPanel.SetDock(panelvisitphoto, Dock.Top);
DockPanel.SetDock(labelvisit, Dock.Top);
panelvisit.Children.Add(labelvisit);
panelvisit.Children.Add(photoVisitsScrollViewer);
panelvisit1.Children.Add(panelvisit);
panelvisit1.Children.Add(panelallanalysis);
panelAllVisit.Children.Add(panelvisit1);
var visit1 = visit;
labelvisit.MouseDoubleClick += (o, args) =>
{
var form = new WorkerInfo(visit1.IdWorker);
form.ShowDialog();
};
PatientPanel.Visibility = Visibility.Visible;
}
}
示例9: animationFade
private void animationFade(Button btn, double from, double to, int duration)
{
DoubleAnimation animationFade = new DoubleAnimation();
animationFade.From = from;
animationFade.To = to;
animationFade.Duration = new Duration(TimeSpan.FromMilliseconds(duration));
btn.BeginAnimation(Button.OpacityProperty, animationFade);
}
示例10: FindVisit
//.........这里部分代码省略.........
analysis.AnalysisDateOnset,
analysis.Snp),
Margin = new Thickness(10, 10, 10, 10),
};
intAnalysis = intAnalysis + 1;
DockPanel.SetDock(panelanalysis1, Dock.Top);
DockPanel.SetDock(panelanalysis, Dock.Top);
DockPanel.SetDock(labelanalysis, Dock.Top);
panelanalysis.Children.Add(labelanalysis);
panelanalysis1.Children.Add(panelanalysis);
panelallanalysis.Children.Add(panelanalysis1);
var analysis1 = analysis;
labelanalysis.MouseDoubleClick += (o, args) =>
{
PatientInfo form = new PatientInfo(analysis1.IdPatient);
form.ShowDialog();
};
}
}
if (intAnalysis != 0)
{
LinearGradientBrush gradient = new LinearGradientBrush();
gradient.StartPoint = new Point(0, 0);
gradient.EndPoint = new Point(1, 1);
Button buttonopenanalisis = new Button
{
Background = gradient,
Foreground = Brushes.MediumBlue,
FontWeight = FontWeights.Bold,
Content = "Переглянути аналізи",
Height = 20,
Width = 450
};
gradient.GradientStops.Add(new GradientStop()
{
Color = Color.FromArgb(255, 249, 249, 200),
Offset = 0
});
gradient.GradientStops.Add(new GradientStop()
{
Color = Color.FromArgb(255, 251, 228, 0),
Offset = 1
});
DockPanel.SetDock(buttonopenanalisis, Dock.Bottom);
panelvisit1.Children.Add(buttonopenanalisis);
panelallanalysis.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
panelallanalysis.Arrange(new Rect(new Point(0, 0), panelallanalysis.DesiredSize));
double panelHeight = panelallanalysis.ActualHeight;
panelallanalysis.Height = 0;
bool isToggle = new bool();
buttonopenanalisis.Click += (o, args) =>
{
DoubleAnimation da = new DoubleAnimation();
if (!isToggle)
{
da.From = 450;
da.To = 800;
da.Duration = TimeSpan.FromSeconds(1);
buttonopenanalisis.BeginAnimation(WidthProperty, da);
da.From = 0;
da.To = panelHeight;
da.Duration = TimeSpan.FromSeconds(1);
panelallanalysis.BeginAnimation(HeightProperty, da);
isToggle = true;
buttonopenanalisis.Content = "Закрити";
}
else
{
da.From = 800;
da.To = 450;
da.Duration = TimeSpan.FromSeconds(1);
buttonopenanalisis.BeginAnimation(WidthProperty, da);
da.From = panelHeight;
da.To = 0;
da.Duration = TimeSpan.FromSeconds(1);
panelallanalysis.BeginAnimation(HeightProperty, da);
isToggle = false;
buttonopenanalisis.Content = "Переглянути процедури";
}
};
}
DockPanel.SetDock(panelvisit1, Dock.Top);
DockPanel.SetDock(panelallanalysis, Dock.Top);
DockPanel.SetDock(panelvisit, Dock.Top);
DockPanel.SetDock(labelvisit, Dock.Top);
panelvisit.Children.Add(labelvisit);
panelvisit1.Children.Add(panelvisit);
panelvisit1.Children.Add(panelallanalysis);
panelAllVisit.Children.Add(panelvisit1);
var visit1 = visit;
labelvisit.MouseDoubleClick += (o, args) =>
{
PatientInfo form = new PatientInfo(visit1.IdPatient);
form.ShowDialog();
};
PatientsPanel.Visibility = Visibility.Visible;
}
}
示例11: FindDiagnosis
//.........这里部分代码省略.........
procedure.DateOnset,
procedure.Snp),
Margin = new Thickness(10, 10, 10, 10),
};
intProcedure = intProcedure + 1;
DockPanel.SetDock(panelprocedure1, Dock.Top);
DockPanel.SetDock(panelprocedure, Dock.Top);
DockPanel.SetDock(labelprocedure, Dock.Top);
panelprocedure.Children.Add(labelprocedure);
panelprocedure1.Children.Add(panelprocedure);
panelallprocedure.Children.Add(panelprocedure1);
var procedure1 = procedure;
labelprocedure.MouseDoubleClick += (o, args) =>
{
PatientInfo form = new PatientInfo(procedure1.IdPatient);
form.ShowDialog();
};
}
}
if (intProcedure != 0)
{
LinearGradientBrush gradient = new LinearGradientBrush();
gradient.StartPoint = new Point(0, 0);
gradient.EndPoint = new Point(1, 1);
Button buttonopenprocedure = new Button
{
Background = gradient,
Foreground = Brushes.MediumBlue,
FontWeight = FontWeights.Bold,
Content = "Переглянути процедури",
Height = 20,
Width = 450
};
gradient.GradientStops.Add(new GradientStop()
{
Color = Color.FromArgb(255, 249, 249, 200),
Offset = 0
});
gradient.GradientStops.Add(new GradientStop()
{
Color = Color.FromArgb(255, 251, 228, 0),
Offset = 1
});
DockPanel.SetDock(buttonopenprocedure, Dock.Bottom);
paneldiagnosis1.Children.Add(buttonopenprocedure);
panelallprocedure.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
panelallprocedure.Arrange(new Rect(new Point(0, 0), panelallprocedure.DesiredSize));
double panelHeight = panelallprocedure.ActualHeight;
panelallprocedure.Height = 0;
bool isToggle = new bool();
buttonopenprocedure.Click += (o, args) =>
{
DoubleAnimation da = new DoubleAnimation();
if (!isToggle)
{
da.From = 450;
da.To = 800;
da.Duration = TimeSpan.FromSeconds(1);
buttonopenprocedure.BeginAnimation(WidthProperty, da);
da.From = 0;
da.To = panelHeight;
da.Duration = TimeSpan.FromSeconds(1);
panelallprocedure.BeginAnimation(HeightProperty, da);
isToggle = true;
buttonopenprocedure.Content = "Закрити";
}
else
{
da.From = 800;
da.To = 450;
da.Duration = TimeSpan.FromSeconds(1);
buttonopenprocedure.BeginAnimation(WidthProperty, da);
da.From = panelHeight;
da.To = 0;
da.Duration = TimeSpan.FromSeconds(1);
panelallprocedure.BeginAnimation(HeightProperty, da);
isToggle = false;
buttonopenprocedure.Content = "Переглянути процедури";
}
};
}
DockPanel.SetDock(paneldiagnosis1, Dock.Top);
DockPanel.SetDock(panelallprocedure, Dock.Top);
DockPanel.SetDock(paneldiagnosis, Dock.Top);
DockPanel.SetDock(labeldiagnosis, Dock.Top);
paneldiagnosis.Children.Add(labeldiagnosis);
paneldiagnosis1.Children.Add(paneldiagnosis);
paneldiagnosis1.Children.Add(panelallprocedure);
panelAllDiagnosis.Children.Add(paneldiagnosis1);
var disease1 = disease;
labeldiagnosis.MouseDoubleClick += (o, args) =>
{
PatientInfo form = new PatientInfo(disease1.IdPatient);
form.ShowDialog();
};
PatientsPanel.Visibility = Visibility.Visible;
}
}