6

私は WPF を使い始め、フォームにカラー ホイールを描画したいと考えました。

最初に、次のように ArcSegment で LinearGradientBrush を使用しようとしました。

<Path StrokeThickness="35" Height="150" Width="150">
    <Path.Stroke>
        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
            <GradientStop Color="Red" Offset="0.15" />
            <GradientStop Color="Orange" Offset="0.2" />
            <GradientStop Color="Yellow" Offset="0.35" />
            <GradientStop Color="Green" Offset="0.5" />
            <GradientStop Color="Blue" Offset="0.65" />
            <GradientStop Color="Indigo" Offset="0.75" />
            <GradientStop Color="Violet" Offset="0.9" />
        </LinearGradientBrush>
    </Path.Stroke>
    <Path.Data>
        <PathGeometry >
            <PathFigure IsClosed="True" StartPoint="25,70">
                <ArcSegment Point="25,71" IsLargeArc="True"
                    Size="50,50" SweepDirection="Clockwise" />
            </PathFigure>
        </PathGeometry>
    </Path.Data>
</Path>

グラデーションがまだ水平だったため、失敗しました。

別のアイデアは、グラデーションを適用した後に何らかの方法で線を曲げる必要があることです。しかし、適切な変換が見つかりません。

標準のトランスフォームがない場合、カスタム トランスフォームを作成できますか? または、ピクセル単位でカラー ホイールを描画する必要がありますか?

アイデアをお願いします。

4

3 に答える 3

3

Silverlight の別の例を次に示します: http://asyrovprog.host22.com/colorwheel.html。ソース コードは、bsd ライセンスの下で、timeline.codeplex.com にあります。

于 2011-11-26T01:11:32.950 に答える