Ejemplo n.º 1
0
        private void MoveTestForm_MouseMove(object sender, MouseEventArgs e)
        {
            if (this.isMouseDown)
            {
                EntityBezier entity = this.entityList[this.entIndex];

                entity.setFloatAtListX(pointIndex, e.X, e.Y);

                this.Invalidate();
                this.UpdateForm();
            }
        }
Ejemplo n.º 2
0
        private void MoveTestForm_MouseUp(object sender, MouseEventArgs e)
        {
            if (this.isMouseDown)
            {
                EntityBezier entity = this.entityList[this.entIndex];

                float step = 100 / lineCount;
                entity.mList[2 * pointIndex]     = (short)(Math.Round(entity.mList[2 * pointIndex] / step) * step);
                entity.mList[2 * pointIndex + 1] = (short)(Math.Round(entity.mList[2 * pointIndex + 1] / step) * step);

                this.UpdateForm();
                this.timer.Start();

                this.isMouseDown = false;
            }
        }
Ejemplo n.º 3
0
        private void MoveTestForm_MouseDown(object sender, MouseEventArgs e)
        {
            bool isFind = false;

            for (int i = 0; i < this.entityList.Count && !isFind; i++)
            {
                EntityBezier entity = this.entityList[i];
                for (int j = 0; j < entity.mListCount && !isFind; j++)
                {
                    float x = entity.getFloatAtListX(j) - e.X;
                    float y = entity.getFloatAtListY(j) - e.Y;
                    if (Math.Sqrt(x * x + y * y) < this.pointRadius)
                    {
                        isFind           = true;
                        this.isMouseDown = true;
                        this.entIndex    = i;
                        this.pointIndex  = j;
                        this.UpdateForm();
                        this.timer.Stop();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void onManagedDraw(Graphics graphics)
        {
            graphics.Clear(Color.White);
            graphics.SmoothingMode = SmoothingMode.AntiAlias;

            graphics.FillRectangle(this.unsableAreaBrush, Options.CameraX, Options.CameraY, Options.CameraWidth, Options.MenuHeight);
            graphics.FillRectangle(this.unsableAreaBrush, Options.CameraX, Options.CameraY + Options.CameraHeight - Options.TouchHeight, Options.CameraWidth, Options.TouchHeight);

            #region Draw lines.

            float linesStep;
            float linesBegin;

            linesStep  = Options.CameraWidth / lineCount;
            linesBegin = Options.CameraX;
            while (0 < linesBegin)
            {
                linesBegin -= linesStep;
                graphics.DrawLine(Pens.Silver, linesBegin, 0, linesBegin, this.ClientSize.Height);
            }
            linesBegin = Options.CameraX;
            while (linesBegin < this.ClientSize.Width)
            {
                graphics.DrawLine(Pens.Silver, linesBegin, 0, linesBegin, this.ClientSize.Height);
                linesBegin += linesStep;
            }

            linesStep  = Options.CameraHeight / lineCount;
            linesBegin = Options.CameraY;
            while (0 < linesBegin)
            {
                linesBegin -= linesStep;
                graphics.DrawLine(Pens.Silver, 0, linesBegin, this.ClientSize.Width, linesBegin);
            }
            linesBegin = Options.CameraY;
            while (linesBegin < this.ClientSize.Width)
            {
                graphics.DrawLine(Pens.Silver, 0, linesBegin, this.ClientSize.Width, linesBegin);
                linesBegin += linesStep;
            }
            #endregion Draw lines.

            graphics.DrawRectangle(Pens.Gray, Options.CameraX, Options.CameraY, Options.CameraWidth, Options.MenuHeight);
            graphics.DrawRectangle(Pens.Gray, Options.CameraX, Options.CameraY + Options.CameraHeight - Options.TouchHeight, Options.CameraWidth, Options.TouchHeight);
            graphics.DrawRectangle(Pens.Gray, Options.CameraX, Options.CameraY, Options.CameraWidth, Options.CameraHeight);

            #region Draw dots.
            if (this.checkBoxIsShowDots.Checked)
            {
                foreach (EntityBezier entity in this.entityList)
                {
                    for (int j = 0; j < entity.dots.Length; j++)
                    {
                        graphics.FillEllipse(Brushes.Silver, Options.CameraX + entity.dots[j].X - this.dotRadius, Options.CameraY + entity.dots[j].Y - this.dotRadius, 2 * this.dotRadius, 2 * this.dotRadius);
                    }
                }
            }
            #endregion Draw dots.

            #region Draw points.
            if (this.checkBoxIsShowPoints.Checked)
            {
                foreach (EntityBezier entity in this.entityList)
                {
                    for (int j = 0; j < entity.mListCount; j++)
                    {
                        float x = entity.getFloatAtListX(j);
                        float y = entity.getFloatAtListY(j);
                        graphics.FillEllipse(Brushes.Silver, x - this.pointRadius, y - this.pointRadius, 2 * this.pointRadius, 2 * this.pointRadius);
                        graphics.DrawString(j.ToString(), this.Font, Brushes.Black, x + this.pointRadius, y + this.pointRadius);
                    }
                }
            }
            #endregion Draw points.

            #region Draw entity.
            foreach (EntityBezier entity in this.entityList)
            {
                graphics.FillEllipse(Brushes.Red, Options.CameraX + entity.getX(), Options.CameraY + entity.getY(), entity.getWidth(), entity.getHeight());
            }
            #endregion Draw entity.

            if (this.checkBoxIsShowPoints.Checked)
            {
                EntityBezier entity = this.entityList[this.entIndex];

                graphics.FillEllipse(Brushes.Green, entity.getFloatAtListX(this.pointIndex) - this.pointRadius, entity.getFloatAtListY(this.pointIndex) - this.pointRadius, 2 * this.pointRadius, 2 * this.pointRadius);
            }
        }