示例#1
0
        /// <summary>
        /// Construct a choice form with a preview area.
        /// </summary>
        /// <param name="ccToolbar"></param>
        /// <param name="previewEnabled"></param>
        public ChoiceForm(CCToolbar ccToolbar, int numChoices, bool previewEnabled, bool hasPreviewImage)
            : this(ccToolbar, numChoices)
        {
            //enable the preview panel
            if (previewEnabled == true)
            {
                previewPanel              = new Panel();
                previewPanel.AutoSize     = true;
                previewPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                previewPanel.Dock         = DockStyle.Fill;
                previewPanel.BackColor    = Color.White;

                //preview is in the middle of the form
                this.buttonTableLayout.Controls.Add(previewPanel, 1, 1);

                //create a label for the preview w/ same settings as form label
                Label previewLabel = new Label();
                previewLabel.AutoSize  = true;
                previewLabel.BackColor = this.label.BackColor;
                previewLabel.Font      = this.label.Font;
                previewLabel.Text      = "Preview:";
                this.previewPanel.Controls.Add(previewLabel);
            }

            //enable the picture box in the preview panel
            if (hasPreviewImage == true)
            {
                previewPicBox           = new PictureBox();
                previewPicBox.BackColor = Color.DarkGray;
                previewPicBox.Width     = previewPicBoxWidth;
                previewPicBox.Height    = previewPicBoxHeight;
                previewPicBox.SizeMode  = PictureBoxSizeMode.Zoom;
                this.previewPanel.Controls.Add(previewPicBox);
            }
        }
示例#2
0
        public MovementForm(CCToolbar ccToolbar)
            : this()
        {
            this.ccToolbar = ccToolbar;
            //this.orientation = orientation;

            this.orientation = ccToolbar.Orientation;

            prevBtn      = new PrevCCButton(this.ccToolbar);
            nextBtn      = new NextCCButton(this.ccToolbar);
            selectionBtn = new SelectionCCButton(this.ccToolbar);

            if (orientation == CCToolbar.ToolbarOrientation.HorizontalTop ||
                orientation == CCToolbar.ToolbarOrientation.HorizontalBottom)
            {
                tableLayoutPanel.Controls.Add(prevBtn, 0, 1);
                tableLayoutPanel.Controls.Add(selectionBtn, 1, 1);
                tableLayoutPanel.Controls.Add(nextBtn, 2, 1);
            }
            else if (orientation == CCToolbar.ToolbarOrientation.VerticalLeft ||
                     orientation == CCToolbar.ToolbarOrientation.VerticalRight)
            {
                tableLayoutPanel.Controls.Add(prevBtn, 1, 0);
                tableLayoutPanel.Controls.Add(selectionBtn, 1, 1);
                tableLayoutPanel.Controls.Add(nextBtn, 1, 2);
            }
        }
示例#3
0
        /// <summary>
        /// Move toolbar to a new location
        /// </summary>
        /// <param name="newLocation"></param>
        private void moveToolbarTo(Point newLocation)
        {
            //create toolbar if not created yet
            if (this.toolbar == null || this.toolbar.IsDisposed == true)
            {
                this.toolbar = new CCToolbar(this, CCToolbar.ToolbarOrientation.HorizontalTop);
            }

            //offset the new location so that toolbar is centered over the dwell circle
            newLocation.X = newLocation.X - toolbar.Width / 2;

            //update toolbar location
            this.toolbar.Location = newLocation;
            this.toolbar.Show();
            //this.toolbar.Activate();
            this.toolbar.Focus();
        }
示例#4
0
        public TestForm()
        {
            InitializeComponent();

            

            //use built in double buffering in .NET 2
            //TODO: implement own double buffering
            this.SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.OptimizedDoubleBuffer, true);
            this.UpdateStyles();

            #region Initialization for Sliding Toolbar

            //TODO DELETE
            this.toolbar = new CCToolbar(this, CCToolbar.ToolbarOrientation.HorizontalTop);
            this.toolbar.Location = new Point(250, 50);
            this.Controls.Add(this.toolbar);
            this.toolbar.Show();
            

            #endregion

            #region Initialization for Mouse Dwell Clicking

            //check every second if a mouse dwell click has occurred
            secondsLeftUntilDwell = this.MOUSE_DWELL_MIN_TIME;
            mouseDwellTimer = new Timer();
            mouseDwellTimer.Interval = 1000;
            mouseDwellTimer.Tick += new EventHandler(mouseDwellTimer_Tick);

            mouseDwellPen = new Pen(Color.AntiqueWhite);
            mouseDwellBrushStartOpacity = 64;
            mouseDwellBrushEndOpacity = 128;
            mouseDwellBrushBaseColor = Color.GreenYellow;
            mouseDwellBrush = new SolidBrush(Color.FromArgb(mouseDwellBrushStartOpacity,mouseDwellBrushBaseColor));
            mouseDwellGraphics = mouseDwellPanel.CreateGraphics();

            
            ////mouseDwellGraphics.DrawImage(System.Drawing.Image.FromFile("Icons/undo.png"), new Point(0, 0));

            #endregion
        }
示例#5
0
 /// <summary>
 /// Construct a CCButton given the CCToolbar, its text,
 /// the path of its icon (when enabled), and path of its icon (when disabled).
 /// </summary>
 /// <param name="ccToolbar"></param>
 /// <param name="text"></param>
 /// <param name="enabledIconPath"></param>
 /// <param name="disabledIconPath"></param>
 public CCButton(CCToolbar ccToolbar, string text, string enabledIconPath, string disabledIconPath)
     : this(ccToolbar, text, enabledIconPath)
 {
     this.disabledIconPath = disabledIconPath;
 }
示例#6
0
 /// <summary>
 /// Construct a CCButton given the CCToolbar, its text,
 /// and the path of its icon.
 /// </summary>
 /// <param name="ccToolbar"></param>
 /// <param name="text"></param>
 /// <param name="enabledIconPath"></param>
 public CCButton(CCToolbar ccToolbar, string text, string enabledIconPath)
     : this(ccToolbar, text)
 {
     this.SetIcon(enabledIconPath);
 }
示例#7
0
 /// <summary>
 /// Construct a CCButton given the CCToolbar and its text.
 /// </summary>
 /// <param name="ccToolbar"></param>
 /// <param name="text"></param>
 public CCButton(CCToolbar ccToolbar, string text)
     : this(ccToolbar)
 {
     SetTextAndTooltip(text);
 }
示例#8
0
        } // end CCButton()

        /// <summary>
        /// Construct a CCButton given the CCToolbar it will go on.
        /// </summary>
        /// <param name="ccToolbar"></param>
        public CCButton(CCToolbar ccToolbar) : this()
        {
            this.ccToolbar  = ccToolbar;
            this.ccMainForm = ccToolbar.CCMainForm; // shortcut
        }
示例#9
0
        /// <summary>
        /// Construct a choice form with button sizes based on the toolbar.
        /// </summary>
        /// <param name="ccToolbar"></param>
        public ChoiceForm(CCToolbar ccToolbar, int numChoices)
            : this()
        {
            this.ccToolbar = ccToolbar;

            //center the choice form on top of the toolbar for easiest access
            this.StartPosition = FormStartPosition.Manual;
            int x = 0;
            int y = 0;

            switch (ccToolbar.Orientation)
            {
            case CCToolbar.ToolbarOrientation.HorizontalTop:
                x = ccToolbar.Width / 2 - this.Width / 2;
                y = Math.Abs(ccToolbar.Height / 2 - this.Height / 2);
                break;

            case CCToolbar.ToolbarOrientation.HorizontalBottom:
                x = ccToolbar.Width / 2 - this.Width / 2;
                y = ccToolbar.Location.Y - this.Height / 2;
                break;

            case CCToolbar.ToolbarOrientation.VerticalLeft:
                x = ccToolbar.Width - this.Width / 2;
                y = ccToolbar.Height / 2 - this.Height / 2;
                break;

            case CCToolbar.ToolbarOrientation.VerticalRight:
                x = ccToolbar.Location.X - this.Width / 2;
                y = ccToolbar.Height / 2 - this.Height / 2;
                break;

            default:
                break;
            }

            //offset choiceform location by main form's location to account for main form moving
            x = this.ccToolbar.CCMainForm.Location.X + x;
            y = this.ccToolbar.CCMainForm.Location.Y + y;

            this.Location = new Point(x, y);

            this.topBtn.Size    = new Size(ccToolbar.ButtonWidth, ccToolbar.ButtonHeight);
            this.leftBtn.Size   = new Size(ccToolbar.ButtonWidth, ccToolbar.ButtonHeight);
            this.rightBtn.Size  = new Size(ccToolbar.ButtonWidth, ccToolbar.ButtonHeight);
            this.bottomBtn.Size = new Size(ccToolbar.ButtonWidth, ccToolbar.ButtonHeight);

            switch (numChoices)
            {
            case 2:
                this.buttonTableLayout.Controls.Remove(topBtn);
                //when only 2 choices, bottom button becomes close button
                this.SetBottomButtonToClose();
                break;

            case 4:
                //do nothing for now
                break;

            default:
                //do nothing for now
                break;
            }
        }