public RemoteDesktop()
        {
            // Since this control will be updated constantly, and all graphics will be drawn by this class,
            // set the control's painting for best user-drawn performance.
            SetStyle(ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint |
                     ControlStyles.DoubleBuffer |
                     ControlStyles.Selectable | // BUG FIX (Edward Cooke) -- Adding Control.Select() support
                     ControlStyles.ResizeRedraw |
                     ControlStyles.Opaque,
                     true);

            // Show a screenshot of a Windows desktop from the manifest and cache to be used when painting in design mode
            // ReSharper disable once AssignNullToNotNullAttribute
            designModeDesktop =
                Image.FromStream(GetAssembly(GetType()).GetManifestResourceStream("VncSharp.Resources.screenshot.png"));

            // Use a simple desktop policy for design mode.  This will be replaced in Connect()
            desktopPolicy     = new VncDesignModeDesktopPolicy(this);
            AutoScroll        = desktopPolicy.AutoScroll;
            AutoScrollMinSize = desktopPolicy.AutoScrollMinSize;

            // Users of the control can choose to use their own Authentication GetPassword() method via the delegate above.  This is a default only.
            GetPassword = PasswordDialog.GetPassword;
        }
        /// <summary>
        /// Set the remote desktop's scaling mode.
        /// </summary>
        /// <param name="scaled">Determines whether to use desktop scaling or leave it normal and clip.</param>
        public void SetScalingMode(bool scaled)
        {
            if (scaled)
            {
                desktopPolicy = new VncScaledDesktopPolicy(vnc, this);
            }
            else
            {
                desktopPolicy = new VncClippedDesktopPolicy(vnc, this);
            }

            AutoScroll        = desktopPolicy.AutoScroll;
            AutoScrollMinSize = desktopPolicy.AutoScrollMinSize;

            Invalidate();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set the remote desktop's scaling mode.
        /// </summary>
        /// <param name="scaled">Determines whether to use desktop scaling or leave it normal and clip.</param>
        public void SetScalingMode(bool scaled)
        {
            if (scaled) {
                desktopPolicy = new VncScaledDesktopPolicy(vnc, this);
            } else {
                desktopPolicy = new VncClippedDesktopPolicy(vnc, this);
            }

            AutoScroll = desktopPolicy.AutoScroll;
            AutoScrollMinSize = desktopPolicy.AutoScrollMinSize;

            Invalidate();
        }
Ejemplo n.º 4
0
        public RemoteDesktop()
            : base()
        {
            IsShared = false;

            // Since this control will be updated constantly, and all graphics will be drawn by this class,
            // set the control's painting for best user-drawn performance.
            SetStyle(ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint			|
                     ControlStyles.DoubleBuffer			|
                     ControlStyles.Selectable           |   // BUG FIX (Edward Cooke) -- Adding Control.Select() support
                     ControlStyles.ResizeRedraw			|
                     ControlStyles.Opaque,
                     true);

            // Show a screenshot of a Windows desktop from the manifest and cache to be used when painting in design mode
            designModeDesktop = Image.FromStream(Assembly.GetAssembly(GetType()).GetManifestResourceStream("VncSharp.Resources.screenshot.png"));

            // Use a simple desktop policy for design mode.  This will be replaced in Connect()
            desktopPolicy = new VncDesignModeDesktopPolicy(this);
            AutoScroll = desktopPolicy.AutoScroll;
            AutoScrollMinSize = desktopPolicy.AutoScrollMinSize;

            // Users of the control can choose to use their own Authentication GetPassword() method via the delegate above.  This is a default only.
            GetPassword = new AuthenticateDelegate(PasswordDialog.GetPassword);
        }