Esempio n. 1
0
        private void myflex_horizontal_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Shapes.MyFlex myFlex = (sender as Shapes.MyFlex);

                // Moving my shape
                myFlex.Top = e.Y + myFlex.Top - _mousePoint.Y;

                // Destroy my shape
                if (myFlex.Top < txt_horizontal_ruler.Size.Height)
                {
                    this.Controls.Remove(myFlex);
                    myFlex.Dispose();
                }
            }
        }
Esempio n. 2
0
        private void myflex_vertial_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Shapes.MyFlex myFlex = (sender as Shapes.MyFlex);

                // Moving my shape
                myFlex.Left = e.X + myFlex.Left - _mousePoint.X;

                // Destroy my shape
                if (myFlex.Left < txt_vertical_ruler.Size.Width)
                {
                    this.Controls.Remove(myFlex);
                    myFlex.Dispose();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Dynamic Horizontal line
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txt_horizontal_ruler_MouseUp(object sender, MouseEventArgs e)
        {
            bool vertical = false;

            try
            {
                Shapes.MyFlex m = new Shapes.MyFlex(vertical);
                m.Size     = new Size(this.Width, 2);
                m.Location = new Point(0, e.Location.Y);
                m.Margin   = new Padding(0, 0, 0, 0);
                m.Padding  = new Padding(0, 0, 0, 0);
                m.Cursor   = Cursors.Cross;

                m.MouseDown += new MouseEventHandler(myflex_MouseDown);
                m.MouseMove += new MouseEventHandler(myflex_horizontal_MouseMove);

                this.Controls.Add(m);
            } catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }