0
我在用下面的代码的动画缩放椭圆:超过按钮鳞甲椭圆,按钮无法点击
ScaleTransform myScTransform = new ScaleTransform();
TransformGroup myTransGroup = new TransformGroup();
myTransGroup.Children.Add(myScTransform);
newPHRadio.RenderTransform = myTransGroup;
newPHRadio.RenderTransformOrigin = new Point(0.5, 0.5);
Storyboard story = new Storyboard();
DoubleAnimation xAnimation = new DoubleAnimation(1, ph.Bereik, new Duration(TimeSpan.FromSeconds(2)));
DoubleAnimation yAnimation = new DoubleAnimation(1, ph.Bereik, new Duration(TimeSpan.FromSeconds(2)));
DoubleAnimation doorzichtig = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(2)));
Storyboard.SetTarget(xAnimation, newPHRadio);
Storyboard.SetTarget(yAnimation, newPHRadio);
Storyboard.SetTarget(doorzichtig, newPHRadio);
DependencyProperty[] propertyChainX = new DependencyProperty[] {
Ellipse.RenderTransformProperty,
TransformGroup.ChildrenProperty,
ScaleTransform.ScaleXProperty
};
DependencyProperty[] propertyChainY = new DependencyProperty[] {
Ellipse.RenderTransformProperty,
TransformGroup.ChildrenProperty,
ScaleTransform.ScaleYProperty
};
string thePath = "(0).(1)[0].(2)";
Storyboard.SetTargetProperty(xAnimation, new PropertyPath(thePath, propertyChainX));
Storyboard.SetTargetProperty(yAnimation, new PropertyPath(thePath, propertyChainY));
Storyboard.SetTargetProperty(doorzichtig, new PropertyPath(Ellipse.OpacityProperty));
story.Children.Add(xAnimation);
story.Children.Add(yAnimation);
story.Children.Add(doorzichtig);
story.Duration = new Duration(TimeSpan.FromSeconds(60/ph.Frequentie));
story.RepeatBehavior = RepeatBehavior.Forever;
story.Begin();
椭圆是用下面的代码构造:
Ellipse newPHRadio = new Ellipse();
newPHRadio.Width = 1;
newPHRadio.Height = 1;
newPHRadio.SetValue(Canvas.LeftProperty, ph.xPositie + 7);
newPHRadio.SetValue(Canvas.TopProperty, ph.yPositie + 7);
newPHRadio.SetValue(Canvas.ZIndexProperty, 3);
newPHRadio.Stroke = new SolidColorBrush(Colors.Black);
newPHRadio.StrokeThickness = 0.03;
现在椭圆缩放在z索引为1的按钮上。使用静态椭圆并且不填充时,该按钮可点击。现在没有填充,但按钮不可点击。有人能告诉我如何解决这个问题吗?
“对于静态椭圆形,没有填充,按钮是点击现在还没有补很好,但按钮无法点击。” ???不明白这一点。你的意思是你的按钮在椭圆填充时不可点击? – Amsakanna 2010-05-10 06:34:10
感谢您的回复。 对不起,如果我不清楚,英语不是我的第一语言。 我有一个z-index为2的按钮。在该按钮的顶部,我有一个没有填充的椭圆和z索引3(图片的左侧部分)。在这种情况下,按钮是可点击的。 现在我有相同的按钮和相同的椭圆。我使用上面的代码缩放椭圆(图片的右侧)。现在该按钮不可点击。 图片可以在这里找到:http://xs.to/image-6A50_4BE86908.jpg 我希望你现在明白我的问题:) – user336720 2010-05-10 20:17:01