public void ConstructorTest() { INuGenServiceProvider serviceProvider = new NuGenControlServiceProvider(); try { _sketchCanvas = new NuGenSketchCanvas((IntPtr)(-1), serviceProvider); Assert.Fail(); } catch (ArgumentException) { } Button button = new Button(); button.CreateControl(); Assert.IsTrue(button.IsHandleCreated); try { _sketchCanvas = new NuGenSketchCanvas(button.Handle, serviceProvider); } catch { Assert.Fail(); } }
/// <summary> /// Initializes a new instance of the <see cref="NuGenPresenterForm"/> class. /// </summary> /// <param name="serviceProvider"><para>Requires:</para> /// <para><see cref="INuGenButtonStateService"/></para> /// <para><see cref="INuGenControlStateService"/></para> /// <para><see cref="INuGenButtonLayoutManager"/></para> /// <para><see cref="INuGenButtonRenderer"/></para> /// <para><see cref="INuGenComboBoxRenderer"/></para> /// <para><see cref="INuGenDirectorySelectorRenderer"/></para> /// <para><see cref="INuGenImageListService"/></para> /// <para><see cref="INuGenPanelRenderer"/></para> /// <para><see cref="INuGenProgressBarLayoutManager"/></para> /// <para><see cref="INuGenProgressBarRenderer"/></para> /// <para><see cref="INuGenScrollBarRenderer"/></para> /// <para><see cref="INuGenSwitchButtonLayoutManager"/></para> /// <para><see cref="INuGenSwitchButtonRenderer"/></para> /// <para><see cref="INuGenTempImageService"/></para> /// <para><see cref="INuGenTextBoxRenderer"/></para> /// <para><see cref="INuGenTrackBarRenderer"/></para> /// <para><see cref="INuGenThumbnailLayoutManager"/></para> /// <para><see cref="INuGenThumbnailRenderer"/></para> /// <para><see cref="INuGenToolStripRenderer"/></para> /// <para><see cref="INuGenValueTrackerService"/></para> /// </param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="serviceProvider"/> is <see langword="null"/>.</para> /// </exception> public NuGenPresenterForm(INuGenServiceProvider serviceProvider) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } _serviceProvider = serviceProvider; _hotKeys = new NuGenHotKeys(); _hotKeys.Operations.Add(this.ClearOperation); _hotKeys.Operations.Add(this.EscapeOperation); _hotKeys.Operations.Add(this.SaveOperation); _hotKeys.Operations.Add(this.LockTransformOperation); _hotKeys.Operations.Add(this.ShowPointerOperation); _hotKeys.Operations.Add(this.ZoomInOperation); _hotKeys.Operations.Add(this.ZoomOutOperation); Point centerScreen = new Point(this.PrimaryScreenWidth / 2, this.PrimaryScreenHeight / 2); _spotGrab = new NuGenSpotGrab(centerScreen, this.PrimaryScreenWidth, this.PrimaryScreenHeight); _timer = new Timer(); _timer.Interval = 50; _timer.Tick += _timer_Tick; this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.Opaque, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.UserPaint, true); this.FormBorderStyle = FormBorderStyle.None; this.ShowIcon = false; this.ShowInTaskbar = false; this.WindowState = FormWindowState.Maximized; _sketchCanvas = new NuGenSketchCanvas(this.Handle, serviceProvider); }