<local:sc x:Name="sc1" Height="263" HorizontalAlignment="Left" Margin="51,34,0,0" VerticalAlignment="Top" Width="477" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Grid.ColumnSpan="2"> <Canvas Name="canvas2" Height="337" Width="632" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Canvas.Background> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="White" Offset="1" /> </LinearGradientBrush> </Canvas.Background> <Canvas.RenderTransform> <TransformGroup> <ScaleTransform ScaleY="-1"/> <TranslateTransform Y="{Binding ElementName=canvas2,Path=Height}"/> </TransformGroup> </Canvas.RenderTransform> <Label Content="duancong" Foreground="White" Canvas.Top="200"> <Label.RenderTransform> <ScaleTransform ScaleY="-1"/> </Label.RenderTransform> </Label> </Canvas> </local:sc>
void canvas2_MouseWheel(object sender, MouseWheelEventArgs e) { if (e.Delta > 0) this.scale *= 1.1; if (e.Delta < 0) this.scale *= 0.9; label2.Content = scale; scaler(); } void scaler() { canvas2.Width = sc1.Width * scale; canvas2.Height = sc1.Height * scale; l1.Scale = scale; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)