Example #1
0
        //---------------------------------------------------------------------------

        //already handled by shape

        /*private void ShapeContext(object sender, HandledMouseEventArgs e)
         * {
         *  Point abspos = ((RectangleShape)sender).PointToScreen(e.Location);
         *  //pmStatColors.SourceControl = ((RectangleShape)sender).Parent;
         *  pmStatColors.Show(((RectangleShape)sender).Parent, abspos.X, abspos.Y);
         * }*/
        //---------------------------------------------------------------------------

        private void ShapeNewCol(object sender, EventArgs e)
        {
            ContextMenuStrip menu      = (ContextMenuStrip)(((ToolStripMenuItem)sender).GetCurrentParent());
            ShapeContainer   container = (ShapeContainer)(menu).SourceControl;
            RectangleShape   pShape    = (RectangleShape)container.GetChildAtPoint(container.PointToClient(menu.Location));

            cdColDialog.Color = pShape.BackColor;
            if (cdColDialog.ShowDialog(this) == DialogResult.OK)
            {
                pShape.BackColor = cdColDialog.Color;
                TMCapView.SetColor(Utils.ConvertTagToInt(pShape.Tag), cdColDialog.Color);
                MCapExample.Refresh();
            }
        }
Example #2
0
        //---------------------------------------------------------------------------

        private void ShapeRestoreCol(object sender, EventArgs e)
        {
            Color[] OldCols = new Color[10] {
                Color.White, Color.Gray, Utils.Int2Color(0x00aa0000), Utils.Int2Color(0x000000cc), Utils.Int2Color(0x0000cc00), Color.Gray,
                Utils.Int2Color(0x006666dd), Utils.Int2Color(0x0066dd66), SystemColors.ControlText, Color.Blue
            };

            ContextMenuStrip menu      = (ContextMenuStrip)(((ToolStripMenuItem)sender).GetCurrentParent());
            ShapeContainer   container = (ShapeContainer)(menu).SourceControl;
            RectangleShape   pShape    = (RectangleShape)container.GetChildAtPoint(container.PointToClient(menu.Location));;

            if (Utils.ConvertTagToInt(pShape.Tag) >= 0 && Utils.ConvertTagToInt(pShape.Tag) < 10)
            {
                pShape.BackColor = OldCols[Utils.ConvertTagToInt(pShape.Tag)];
                TMCapView.SetColor(Utils.ConvertTagToInt(pShape.Tag), OldCols[Utils.ConvertTagToInt(pShape.Tag)]);
                MCapExample.Refresh();
            }
        }