Example #1
0
        public void ShowIconsOnTabPage(JCBase.UI.TapPageTrans tabPage, Rectangle redoIconRect, Rectangle undoIconRect)
        {
            RedoIconRect = redoIconRect;
            UndoIconRect = undoIconRect;

            tabPage.OnDrawControl += new PaintEventHandler(DrawIcons);

            RefreshButtonStatusEventHandler += delegate()
            {
                tabPage.Invalidate();
            };
            _trace.RefreshStatus(this);

            Form frm = tabPage.FindForm();

            frm.MouseClick += delegate(object sender, MouseEventArgs e)
            {
                if (ReachedBegin == false && UndoIconRect.Contains(e.Location))
                {
                    Undo();
                }
                if (ReachedEnd == false && RedoIconRect.Contains(e.Location))
                {
                    Redo();
                }
            };

            frm.MouseMove += delegate(object sender, MouseEventArgs e)
            {
                if (ReachedBegin == false && UndoIconRect.Contains(e.Location))
                {
                    frm.Cursor = Cursors.Hand;
                }
                else if (ReachedEnd == false && RedoIconRect.Contains(e.Location))
                {
                    frm.Cursor = Cursors.Hand;
                }
                else
                {
                    frm.Cursor = Cursors.Default;
                }
            };
        }
Example #2
0
        private void DrawIcons(object sender, PaintEventArgs e)
        {
            JCBase.UI.TapPageTrans hostControl = sender as JCBase.UI.TapPageTrans;
            ////绘制撤销 20161227 add by axj
            //if (ShowUndoRedo)
            //{
            Bitmap picUndo = Properties.Resources.undo;
            Bitmap picRedo = Properties.Resources.redo;

            if (!ReachedBegin)
            {
                picUndo = Properties.Resources.undohov;
            }
            if (!ReachedEnd)
            {
                picRedo = Properties.Resources.redohov;
            }
            int w   = 2;
            int h   = 2;
            int wid = 0;

            if (hostControl.TitleLogo != null)
            {
                wid = hostControl.TitleLogo.Width;
            }
            Rectangle clientArea = hostControl.ClientRectangle;
            Graphics  g          = e.Graphics;
            Point     _picArea_1 = new Point(clientArea.Width - picUndo.Width - picRedo.Width - wid - 10 - 20, clientArea.Top + 6);

            g.DrawImage(picUndo, _picArea_1.X, _picArea_1.Y, picUndo.Width - w, picUndo.Height - h);
            Point _picArea_2 = new Point(clientArea.Width - picRedo.Width - wid - 10 - 10, clientArea.Top + 6);

            g.DrawImage(picRedo, _picArea_2.X, _picArea_2.Y, picRedo.Width - w, picRedo.Height - h);
            UndoIconRect = new Rectangle(new Point(hostControl.Location.X + _picArea_1.X, hostControl.Location.Y + _picArea_1.Y), new Size(picUndo.Width - w, picUndo.Height - h));
            RedoIconRect = new Rectangle(new Point(hostControl.Location.X + _picArea_2.X, hostControl.Location.Y + _picArea_2.Y), new Size(picRedo.Width - w, picRedo.Height - h));
            //}
        }