1
我想繪製一個使用Alpha的玻璃效果的圓。我通過使用下面的XAML成功地創建了這個項目。光標變爲橢圓的手形,但不影響路徑。基本上,我想在鼠標出現在圓上的地方顯示「手形」光標。我希望這不是一個已知的問題,我缺少一些小東西。任何幫助真的很感激。光標上的路徑不會出現在SilverLight
<Ellipse Cursor="Hand"
Width="200"
Height="200"
Fill="#C42222" Canvas.Left="0" Canvas.Top="0" />
<Ellipse Cursor="Hand" Width="200" Height="200" Canvas.Left="0" Canvas.Top="0">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.3,0.7">
<GradientStop
Offset="0"
Color="#00000000" />
<GradientStop
Offset="1"
Color="#66000000" />
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Path Cursor="Hand" Stretch="Fill" Height="114.598" Width="198.696" Data="M98.388435,-1.3301961 C98.388435,-1.3301961 117.1151,-3.094949 141.69321,8.1370029 C156.42262,14.868201 167.67375,23.694145 175.66234,33.657074 C183.67349,43.648144 181.90166,37.8708 191.90166,58.8708 C201.90166,79.870796 199.16658,89.212738 199.13568,92.90377 C198.77556,135.92146 175.45959,97.59124 156.75465,81.024025 C140.98892,67.060104 117.41241,64.357407 114.41241,64.357407 C111.4124,64.357407 83.061241,60.114159 63.061195,71.114143 C43.061146,82.114136 39.637829,86.429352 22.999804,100.99996 C6.5005584,115.44904 2.9997537,112.99996 2.9997537,112.99996 C2.9997537,112.99996 -1.1832786,97.194221 1.9997513,81.999893 C7.2054667,57.150185 13.999762,47.999939 17.999771,42.999943 C21.999781,37.99995 29.935833,23.400871 54.053131,10.21261 C78.91642,-3.3835876 98.388435,-1.3301961 98.388435,-1.3301961 z">
<Path.Fill>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#55FFFFFF" Offset="0"/>
<GradientStop Color="#11FFFFFF" Offset="0.5"/>
<GradientStop Color="#00FFFFFF" Offset="1"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
嗨安東尼,感謝您的意見。事實上,我使用了Stroke =「Black」StrokeThickness =「10」,並證實它甚至不能在邊界上工作。由於這是一個封閉的路徑,我假定光標將在此工作。不幸的是,它不是:( – 2010-05-06 09:37:25
@Rahul:爲了說清楚我已經說過了什麼,我可以證實它至少在一個孤立的測試中工作(在UserControl中沒有其他任何東西)。我建議你做同樣的測試,以確認它仍然不能爲你工作,甚至是孤立的,這會證明你的機器上發生了一些非常奇怪的事情,我懷疑你會發現它確實有效, – AnthonyWJones 2010-05-06 13:02:07
謝謝安東尼!你是對的,我單獨檢查了我自己的代碼,發現你懷疑是正確的,我有一個沒有手的重複路徑,因爲座標是相同的。它重疊了我有光標的路徑,再次感謝......標記爲答案。 – 2010-05-07 06:02:00