{"id":448,"date":"2007-08-08T09:08:20","date_gmt":"2007-08-08T01:08:20","guid":{"rendered":"http:\/\/fdream.net\/blog\/article\/448.aspx"},"modified":"2007-08-08T13:08:41","modified_gmt":"2007-08-08T05:08:41","slug":"WPF%e4%b8%adStoryboard%e7%9a%84%e5%a5%87%e6%80%aa%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/fdream.net\/blog\/article\/448","title":{"rendered":"WPF\u4e2dStoryboard\u7684\u5947\u602a\u95ee\u9898"},"content":{"rendered":"<p>\u5728\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u5bf9\u8c61\u7684Opacity\u52a8\u753b\u4e4b\u540e\uff0c\u518d\u4e3a\u8be5\u5bf9\u8c61\u8bbe\u7f6e\u4e00\u4e2aOpacity\u503c\u5c06\u4f1a\u65e0\u6548\uff0c\u5947\u602a\u7684\u662f\u4e5f\u6ca1\u6709\u5f02\u5e38\u629b\u51fa\uff0c\u800c\u4e14\u5728\u8be5\u8bed\u53e5\u4e4b\u540e\u7684\u8bed\u53e5\u4e5f\u90fd\u4e0d\u6267\u884c\u4e86\u3002\u4f8b\u5982\uff1a<\/p>\n<blockquote>\n<p>DoubleAnimation myDA = new DoubleAnimation(0.8, 0.0, new Duration(TimeSpan.FromMilliseconds(800)));<\/p>\n<p>Storyboard.SetTargetName(myDA, &#8220;myObj&#8221;);<br \/>Storyboard.SetTargetProperty(myDA, new PropertyPath(Canvas.OpacityProperty));<\/p>\n<p>Storyboard mySB = new Storyboard();<br \/>mySB.Children.Add(myDA);<br \/>mySB.Begin(myObj);<\/p>\n<\/blockquote>\n<p>\u82e5\u5728\u6b64\u540e\u518d\u8bbe\u7f6e\u8be5\u5bf9\u8c61\u7684Opacity\u503c\u5c06\u4f1a\u65e0\u6548\uff0c\u4f8b\u5982\uff1a<\/p>\n<blockquote>\n<p>myObj.Opacity = 1.0;<\/p>\n<\/blockquote>\n<p>\u4e14\u8be5\u53e5\u4e4b\u540e\u7684\u8bed\u53e5\u90fd\u4e0d\u4f1a\u6267\u884c\u3002\u60f3\u60f3\u53ef\u80fd\u662f\u56e0\u4e3a\u52a8\u753b\u628a\u8be5\u503c\u7ed9\u9501\u5b9a\u4e86\uff0c\u4e8e\u662f\u5c1d\u8bd5\u5728\u52a8\u753b\u5b8c\u6210\u4e4b\u540eremove\u6389\u8be5\u52a8\u753b\uff0c\u4e8e\u662f\u628a\u4ee3\u7801\u6539\u6210\u5982\u4e0b\u7684\u6837\u5b50\uff1a<\/p>\n<blockquote>\n<p>DoubleAnimation myDA = new DoubleAnimation(0.8, 0.0, new Duration(TimeSpan.FromMilliseconds(800)));<\/p>\n<p>Storyboard.SetTargetName(myDA, &#8220;myObj&#8221;);<br \/>Storyboard.SetTargetProperty(myDA, new PropertyPath(Canvas.OpacityProperty));<\/p>\n<p>Storyboard mySB = new Storyboard();<br \/>mySB.Children.Add(myDA);<br \/>mySB.Completed += new EventHandler(mySB_Completed);<br \/>mySB.Begin(myObj);<\/p>\n<p>void mySB_Completed(object sender, EventArgs e)<br \/>{<br \/>\tmySB.Remove(myObj);<br \/>}<\/p>\n<\/blockquote>\n<p>\u53ef\u60dc\u8fd8\u662f\u6ca1\u6709\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u540e\u6765\u641c\u7d22\u4e86\u4e00\u4e0bstoryboard\uff0c\u5728<a href=\"http:\/\/allan.flashempire.net\/blog\/\" target=\"_blank\" title=\"Allan\u7684blog\">Allan\u7684blog<\/a>\u4e0a\u53d1\u73b0\u539f\u6765\u5728Begin\u7684\u65f6\u5019\u8981\u52a0\u4e0a\u4e00\u4e2a\u53c2\u6570true\u624d\u80fdremove\u6389storyboard\uff0c\u5373\u6539\u6210\u5982\u4e0b\u7684\u6837\u5b50\uff1a<\/p>\n<blockquote>\n<p>mySB.Begin(myObj, true);<\/p>\n<\/blockquote>\n<p>\u67e5\u67e5MSDN\uff0c\u4e0a\u9762Begin\u6709\u5341\u4e8c\u4e2aoverload\uff0c\u5176\u4e2d\u6709\u4e24\u4e2a\u7b2c\u4e8c\u53c2\u6570\u4e3aboolean\u7c7b\u578b\u7684\u91cd\u8f7d\uff0c\u5bf9\u5176\u8bf4\u660e\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<blockquote>\n<p>true if the storyboard should be interactively controllable; otherwise, false.<\/p>\n<\/blockquote>\n<p>\u5982\u679cstoryboard\u662f\u53ef\u63a7\u5236\u7684\uff0c\u5219\u5fc5\u987b\u8bbe\u7f6e\u4e3atrue\uff0c\u5426\u5219\u53ef\u4e0d\u8981\u8be5\u53c2\u6570\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u5bf9\u8c61\u7684Opacity\u52a8\u753b\u4e4b\u540e\uff0c\u518d\u4e3a\u8be5\u5bf9\u8c61\u8bbe\u7f6e\u4e00\u4e2aOpacity\u503c\u5c06\u4f1a\u65e0\u6548\uff0c\u5947\u602a\u7684\u662f\u4e5f\u6ca1\u6709\u5f02\u5e38\u629b\u51fa\uff0c\u800c\u4e14\u5728\u8be5\u8bed\u53e5\u4e4b\u540e\u7684\u8bed\u53e5\u4e5f\u90fd\u4e0d\u6267\u884c\u4e86\u3002\u4f8b\u5982\uff1a DoubleAnimation myDA = new DoubleAnimation(0.8, 0.0, new Duration(TimeSpan.FromMilliseconds(800))); Storyboard.SetTargetName(myDA, &#8220;myObj&#8221;);Storyboard.SetTargetProperty(myDA, new PropertyPath(Canvas.OpacityProperty)); Storyboard mySB = new Storyboard();mySB.Children.Add(myDA);mySB.Begin(myObj); \u82e5\u5728\u6b64\u540e\u518d\u8bbe\u7f6e\u8be5\u5bf9\u8c61\u7684Opacity\u503c\u5c06\u4f1a\u65e0\u6548\uff0c\u4f8b\u5982\uff1a myObj.Opacity = 1.0; \u4e14\u8be5\u53e5\u4e4b\u540e\u7684\u8bed\u53e5\u90fd\u4e0d\u4f1a\u6267\u884c\u3002\u60f3\u60f3\u53ef\u80fd\u662f\u56e0\u4e3a\u52a8\u753b\u628a\u8be5\u503c\u7ed9\u9501\u5b9a\u4e86\uff0c\u4e8e\u662f\u5c1d\u8bd5\u5728\u52a8\u753b\u5b8c\u6210\u4e4b\u540eremove\u6389\u8be5\u52a8\u753b\uff0c\u4e8e\u662f\u628a\u4ee3\u7801\u6539\u6210\u5982\u4e0b\u7684\u6837\u5b50\uff1a DoubleAnimation myDA = new DoubleAnimation(0.8, 0.0, new Duration(TimeSpan.FromMilliseconds(800))); Storyboard.SetTargetName(myDA, &#8220;myObj&#8221;);Storyboard.SetTargetProperty(myDA, new PropertyPath(Canvas.OpacityProperty)); Storyboard mySB = new Storyboard();mySB.Children.Add(myDA);mySB.Completed += new EventHandler(mySB_Completed);mySB.Begin(myObj); void mySB_Completed(object sender, EventArgs e){ mySB.Remove(myObj);} \u53ef\u60dc\u8fd8\u662f\u6ca1\u6709\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u540e\u6765\u641c\u7d22\u4e86\u4e00\u4e0bstoryboard\uff0c\u5728Allan\u7684blog\u4e0a\u53d1\u73b0\u539f\u6765\u5728Begin\u7684\u65f6\u5019\u8981\u52a0\u4e0a\u4e00\u4e2a\u53c2\u6570true\u624d\u80fdremove\u6389storyboard\uff0c\u5373\u6539\u6210\u5982\u4e0b\u7684\u6837\u5b50\uff1a mySB.Begin(myObj, true); \u67e5\u67e5MSDN\uff0c\u4e0a\u9762Begin\u6709\u5341\u4e8c\u4e2aoverload\uff0c\u5176\u4e2d\u6709\u4e24\u4e2a\u7b2c\u4e8c\u53c2\u6570\u4e3aboolean\u7c7b\u578b\u7684\u91cd\u8f7d\uff0c\u5bf9\u5176\u8bf4\u660e\u662f\u8fd9\u6837\u7684\uff1a true if &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[293],"class_list":["post-448","post","type-post","status-publish","format-standard","hentry","category-coding","tag-WPF"],"views":20948,"_links":{"self":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/comments?post=448"}],"version-history":[{"count":0,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/448\/revisions"}],"wp:attachment":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/media?parent=448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/categories?post=448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/tags?post=448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}