/// <summary> /// Construct a canvas with the basic scene graph consisting of a root, camera, /// and layer. Event handlers for zooming and panning are automatically /// installed. /// </summary> public PCanvas() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); CURRENT_PCANVAS = this; cursorStack = new Stack(); Camera = CreateBasicScenegraph(); DefaultRenderQuality = RenderQuality.HighQuality; AnimatingRenderQuality = RenderQuality.LowQuality; InteractingRenderQuality = RenderQuality.LowQuality; PanEventHandler = new PPanEventHandler(); ZoomEventHandler = new PZoomEventHandler(); BackColor = Color.White; #if (!WEB_DEPLOY) AllowDrop = true; #endif RegionManagement = true; SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.Selectable, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); }
private void toolStripButton4_Click(object sender, EventArgs e) { if (drag != null) { pCanvas1.RemoveInputEventListener(drag); } pan = new PPanEventHandler(); pCanvas1.AddInputEventListener(pan); }
private void InitFrame() { if (ViewModel.Frame == null) { ProfileType p = Storage.GetAll <ProfileType>().Find(i => i.Shape == ProfileShape.L); if (p == null) { MessageBox.Show("There is no profile type defined.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Frame = new PVCFrame(ViewModel.Width, ViewModel.Height, Storage.GetAll <ProfileType>()[0]); ViewModel.Modified = true; Frame.FontSize = (float)FrameFontSize.SelectedItem; } else { Frame = (PVCFrame)ViewModel.Frame.ToFrame(); FrameFontSize.SelectedValue = Frame.FontSize; } Frame.Click += Frame_Click; Frame.Model.Code = ViewModel.Code; ShowCodesCheckBox.IsChecked = Frame.ShowCodes; Canvas.Layer.AddChild(Frame); SelectionEventHandler = new SelectionEventHandler(Frame); DivisionEventHandler = new DivisionEventHandler(Frame.Surface); SashCreationEventHandler = new SashCreationEventHandler(Frame.Surface); FillingCreationEventHandler = new FillingCreationEventHandler(Frame.Surface); DragEventHandler = new MullionDragEventHandler(Canvas, Frame); PanEventHandler = new PPanEventHandler(); Decorator = new FrameDecorator(Frame, Canvas.Layer); Decorator.EnableFrameDecorator(); SelectionEventHandler.SelectionChanged += SelectionEventHandler_SelectionChanged; LProfileComboBox.SelectedItem = Frame.Model.ProfileType; UProfileComboBox.SelectedItem = Frame.Model.UProfileType; OnPropertyChanged("UnitWidth"); OnPropertyChanged("UnitHeight"); Frame.DimensionChanged += Frame_DimensionChanged; }