Example #1
0
        VncClient vnc; // The Client object handling all protocol-level interaction

        #endregion Fields

        #region Constructors

        public VncDesktop()
            : base()
        {
            // 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(typeof(RemoteDesktop)).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);
        }
Example #2
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();
        }