日期:2014-05-18  浏览次数:20696 次

关于动态按钮的问题
想在win窗体上实现一个效果,大概是在一个圆盘(或者是圆形的图片?)上安置些按钮,鼠标指在一定区域按钮可以随圆盘

转动,各位高手指点下哈,不知道从哪里入手,还是需要借助其他什么工具实现呢?

------解决方案--------------------
这个很复杂 如果用winform 只能使用api
幸好我们现在与wpf了
XML code

<Window x:Class="CaseAnalysis_WPF_.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <Style TargetType="FrameworkElement" x:Key="CircleGrid">
            <Setter Property="RenderTransform">
                <Setter.Value>
                    <RotateTransform />
                </Setter.Value>
            </Setter>
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
         </Style>
         <EventTrigger x:Key="CircleButtons"  RoutedEvent="MouseEnter">
            <BeginStoryboard>
                <Storyboard Name="Circle">
                    <DoubleAnimation From="0" To="3600" Duration="0:0:30" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(RotateTransform.Angle)"/>
                </Storyboard>                
            </BeginStoryboard>
        </EventTrigger>
    </Window.Resources>
    <Grid Style="{StaticResource CircleGrid}">
        <Grid.Triggers>
            <StaticResource ResourceKey="CircleButtons"/>
        </Grid.Triggers>
         
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="104,47,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="33,119,0,0" Name="button2" VerticalAlignment="Top" Width="75" />
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="180,119,0,0" Name="button3" VerticalAlignment="Top" Width="75" />
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="104,200,0,0" Name="button4" VerticalAlignment="Top" Width="75" />
    </Grid>
</Window>

------解决方案--------------------
探讨
学习了,多谢
那么WPF在framework2.0下支持么?

------解决方案--------------------
前年写过一个桌面转盘,仿国外的CirceDock,不过源码不知道放哪里了....
------解决方案--------------------
查看