using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfApplication1 { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { bool _leftIsDragging; bool _rightIsDragging; bool _middleIsDragging; Point _leftDragOffset; Point _rightDragOffset; Point _middleDragOffset; TranslateTransform _pan; ScaleTransform _zoom; RotateTransform _turn; public MainWindow() { InitializeComponent(); _pan = new TranslateTransform(); _zoom = new ScaleTransform(); _turn = new RotateTransform(); TransformGroup tGroup = new TransformGroup(); tGroup.Children.Add(_zoom); tGroup.Children.Add(_turn); tGroup.Children.Add(_pan); controlTarget.RenderTransform = tGroup; controlTarget.MouseDown += new MouseButtonEventHandler(controlTarget_MouseDown); controlTarget.MouseMove += new MouseEventHandler(controlTarget_MouseMove); controlTarget.MouseUp += new MouseButtonEventHandler(controlTarget_MouseUp); this.KeyDown += new KeyEventHandler(MainWindow_KeyDown); } void MainWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Escape) { _pan.X = 0; _pan.Y = 0; _zoom.ScaleX = 1; _zoom.ScaleY = 1; _zoom.CenterX = 0; _zoom.CenterY = 0; } } void controlTarget_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { var s = sender as UIElement; s.CaptureMouse(); _leftDragOffset = e.GetPosition(this); _leftIsDragging = true; } if (e.ChangedButton == MouseButton.Right) { var s = sender as UIElement; s.CaptureMouse(); _rightDragOffset = e.GetPosition(this); _rightIsDragging = true; Point center = e.GetPosition(s); _zoom.CenterX = center.X; _zoom.CenterY = center.Y; } } void controlTarget_MouseMove(object sender, MouseEventArgs e) { if (_leftIsDragging) { var s = sender as UIElement; Point p = e.GetPosition(this); _pan.X += p.X - _leftDragOffset.X; _pan.Y += p.Y - _leftDragOffset.Y; _leftDragOffset = p; } if (_rightIsDragging) { var s = sender as UIElement; Point p = e.GetPosition(this); double delta = (_rightDragOffset.Y - p.Y) * 0.01; _zoom.ScaleX += delta; _zoom.ScaleY += delta; _rightDragOffset = p; } } void controlTarget_MouseUp(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { var s = sender as UIElement; s.ReleaseMouseCapture(); _leftIsDragging = false; } if (e.ChangedButton == MouseButton.Right) { var s = sender as UIElement; s.ReleaseMouseCapture(); _rightIsDragging = false; } } } }
Standard input is empty
prog.cpp:1: error: expected nested-name-specifier before ‘System’ prog.cpp:1: error: ‘System’ has not been declared prog.cpp:2: error: expected nested-name-specifier before ‘System’ prog.cpp:2: error: ‘System’ has not been declared prog.cpp:2: error: expected `;' before ‘.’ token prog.cpp:2: error: expected unqualified-id before ‘.’ token prog.cpp:3: error: expected nested-name-specifier before ‘System’ prog.cpp:3: error: ‘System’ has not been declared prog.cpp:3: error: expected `;' before ‘.’ token prog.cpp:3: error: expected unqualified-id before ‘.’ token prog.cpp:4: error: expected nested-name-specifier before ‘System’ prog.cpp:4: error: ‘System’ has not been declared prog.cpp:4: error: expected `;' before ‘.’ token prog.cpp:4: error: expected unqualified-id before ‘.’ token prog.cpp:5: error: expected nested-name-specifier before ‘System’ prog.cpp:5: error: ‘System’ has not been declared prog.cpp:5: error: expected `;' before ‘.’ token prog.cpp:5: error: expected unqualified-id before ‘.’ token prog.cpp:6: error: expected nested-name-specifier before ‘System’ prog.cpp:6: error: ‘System’ has not been declared prog.cpp:6: error: expected `;' before ‘.’ token prog.cpp:6: error: expected unqualified-id before ‘.’ token prog.cpp:7: error: expected nested-name-specifier before ‘System’ prog.cpp:7: error: ‘System’ has not been declared prog.cpp:7: error: expected `;' before ‘.’ token prog.cpp:7: error: expected unqualified-id before ‘.’ token prog.cpp:8: error: expected nested-name-specifier before ‘System’ prog.cpp:8: error: ‘System’ has not been declared prog.cpp:8: error: expected `;' before ‘.’ token prog.cpp:8: error: expected unqualified-id before ‘.’ token prog.cpp:9: error: expected nested-name-specifier before ‘System’ prog.cpp:9: error: ‘System’ has not been declared prog.cpp:9: error: expected `;' before ‘.’ token prog.cpp:9: error: expected unqualified-id before ‘.’ token prog.cpp:10: error: expected nested-name-specifier before ‘System’ prog.cpp:10: error: ‘System’ has not been declared prog.cpp:10: error: expected `;' before ‘.’ token prog.cpp:10: error: expected unqualified-id before ‘.’ token prog.cpp:11: error: expected nested-name-specifier before ‘System’ prog.cpp:11: error: ‘System’ has not been declared prog.cpp:11: error: expected `;' before ‘.’ token prog.cpp:11: error: expected unqualified-id before ‘.’ token prog.cpp:12: error: expected nested-name-specifier before ‘System’ prog.cpp:12: error: ‘System’ has not been declared prog.cpp:12: error: expected `;' before ‘.’ token prog.cpp:12: error: expected unqualified-id before ‘.’ token prog.cpp:13: error: expected nested-name-specifier before ‘System’ prog.cpp:13: error: ‘System’ has not been declared prog.cpp:13: error: expected `;' before ‘.’ token prog.cpp:13: error: expected unqualified-id before ‘.’ token prog.cpp:20: error: expected unqualified-id before ‘public’ prog.cpp:125: error: expected `}' at end of input
Standard output is empty