/// <summary> /// Constructor. /// </summary> public PrintTileController(PrintViewTile tile, IViewerShortcutManager shortcutManager) { Platform.CheckForNullReference(tile, "tile"); Platform.CheckForNullReference(shortcutManager, "shortcutManager"); _tile = tile; _tile.ContextMenuRequested += ProcessExplicitContextMenuRequest; _selectedOnThisClick = false; _capturedOnThisClick = false; _shortcutManager = shortcutManager; _delayedContextMenuRequestPublisher = new DelayedEventPublisher(ProcessDelayedContextMenuRequest, 300); }
private void AddTileControl(PrintViewTile tile) { PrintTileView view = ViewFactory.CreateAssociatedView(typeof(PrintViewTile)) as PrintTileView; view.Tile = tile; view.ParentRectangle = this.AvailableClientRectangle; view.ParentImageBoxInsetWidth = PrintViewImageBox.InsetWidth; PrintTileControl control = view.GuiElement as PrintTileControl; control.Tile.SelectionChanged += OnTileSelectionChanged; control.MouseMove += OnTileMouseMove; control.Drawing += OnTileControlDrawing; control.SuspendLayout(); this.Controls.Add(control); control.ResumeLayout(false); }
/// <summary> /// Constructor /// </summary> public PrintTileControl(PrintViewTile tile, Rectangle parentRectangle, int parentImageBoxInsetWidth) { _tile = tile; _tileController = new PrintTileController(_tile, (_tile.ImageViewer as PrintImageViewerComponent).ShortcutManager); _inputTranslator = new PrintTileInputTranslator(this); SetParentImageBoxRectangle(parentRectangle, parentImageBoxInsetWidth, true); InitializeComponent(); this.BackColor = Color.Black; this.Dock = DockStyle.None; this.Anchor = AnchorStyles.None; this.AllowDrop = true; _tile.Drawing += new EventHandler(OnTileDrawing); _tile.RendererChanged += new EventHandler(OnRendererChanged); _tile.InformationBoxChanged += new EventHandler <InformationBoxChangedEventArgs>(OnInformationBoxChanged); _tile.EditBoxChanged += new EventHandler(OnEditBoxChanged); _tile.SelectionChanged += new EventHandler <ItemEventArgs <ITile> >(OnTileSelectionChanged); _contextMenuStrip.ImageScalingSize = new Size(24, 24); _contextMenuStrip.Opening += new CancelEventHandler(OnContextMenuStripOpening); _tileController.CursorTokenChanged += new EventHandler(OnCursorTokenChanged); _tileController.ContextMenuRequested += new EventHandler <ItemEventArgs <Point> >(OnContextMenuRequested); _tileController.CaptureChanging += new EventHandler <ItemEventArgs <IMouseButtonHandler> >(OnCaptureChanging); _editBoxControl = new EditBoxControl(); this.Controls.Add(_editBoxControl); this.DoubleBuffered = false; this.SetStyle(ControlStyles.DoubleBuffer, false); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false); this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); this.Margin = new Padding(0); this.Padding = new Padding(0); }