Ejemplo n.º 1
0
        public TestForm()
        {
            tf = this;
            //m_panel是乐谱页面
            m_panel = new NotationPanel();
            //m_canvas.Dock = DockStyle.Fill;
            m_panel.Location = new System.Drawing.Point(188,8);//设置乐谱在整个页面中的位置
            m_panel.Anchor = AnchorStyles.Top;


            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
            //以上为InitializeComponent();
            this.ribbon1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
            DoRecover();

            //panel1为界面底层灰色部分
            //以上为DoRecover();
            panel1.Controls.Add(m_panel);
            panel1.BackColor = Color.Gray;
            //statusStrip1.BackColor = Color.Red;

            //界面底部页码栏
            toolStripStatusLabel1.Text = "  页码:" + page_now + " 页 " + page_now + "/" + page_sum + " ";//wyy
            toolStripStatusLabel1.BorderSides = ToolStripStatusLabelBorderSides.Right;

            InitLists();
            Initsymbol_list();
            //StartPosition = FormStartPosition.WindowsDefaultBounds;
            WindowState = FormWindowState.Maximized;
            

        }
Ejemplo n.º 2
0
        public TestForm()
        {
            tf = this;
            //m_panel是乐谱页面
            m_panel = new NotationPanel();
            //m_canvas.Dock = DockStyle.Fill;
            m_panel.Location = new System.Drawing.Point(188, 8);//设置乐谱在整个页面中的位置
            m_panel.Anchor   = AnchorStyles.Top;


            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
            //以上为InitializeComponent();
            this.ribbon1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
            DoRecover();

            //panel1为界面底层灰色部分
            //以上为DoRecover();
            panel1.Controls.Add(m_panel);
            panel1.BackColor = Color.Gray;
            //statusStrip1.BackColor = Color.Red;

            //界面底部页码栏
            toolStripStatusLabel1.Text        = "  页码:" + page_now + " 页 " + page_now + "/" + page_sum + " ";//wyy
            toolStripStatusLabel1.BorderSides = ToolStripStatusLabelBorderSides.Right;

            InitLists();
            Initsymbol_list();
            //StartPosition = FormStartPosition.WindowsDefaultBounds;
            WindowState = FormWindowState.Maximized;
        }
Ejemplo n.º 3
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            m_mousedownPoint = new PointF(e.X, e.Y); // used when panning
            m_dragOffset     = new PointF(0, 0);

            //移动音符放下
            if (moving)
            {
                moving = false;
                lines.AddRange(mr.getLines());
            }
            if (ispaste)
            {
                ispaste = false;
                List <Line> l = pr.getLines();
                for (int i = 0; i < l.Count; i++)
                {
                    Line l1 = new Line(l[i].P1, l[i].P2, l[i].S, l[i].isRed, l[i].Color);
                    lines.Add(l1);
                }
            }
            if (m_drawObjectId.Equals("StartPoint"))
            {
                TestForm.setStartPoint(e.X, e.Y);
            }
            UnitPoint mousepoint = ToUnit(m_mousedownPoint);

            if (m_snappoint != null)
            {
                mousepoint = m_snappoint.SnapPoint;
            }

            if (m_commandType == eCommandType.select)
            {
                bool handled = false;
                if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled))
                {
                    m_commandType = eCommandType.editNode;
                    m_snappoint   = null;
                    base.OnMouseDown(e);
                    return;
                }
                m_selection = new SelectionRectangle(m_mousedownPoint);
            }

            /*
             * if (m_commandType == eCommandType.move)
             * {
             *  m_moveHelper.HandleMouseDownForMove(mousepoint, m_snappoint);
             * }
             * */
            if (m_commandType == eCommandType.draw)
            {
                HandleMouseDownWhenDrawing(mousepoint, null);
                DoInvalidate(true);
            }

            else if (m_commandType == eCommandType.symbol)
            {
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestForm));
                CanvasWrapper canvastest = new CanvasWrapper(this, Graphics.FromImage(m_staticImage), ClientRectangle);
                canvastest.Graphics.SmoothingMode = m_smoothingMode;
                if (m_drawObjectId == "clef1" || m_drawObjectId == "clef2" || m_drawObjectId == "clef3" || m_drawObjectId == "clef4" || m_drawObjectId == "clef6" || m_drawObjectId == "N2" ||
                    m_drawObjectId == "N3" || m_drawObjectId == "N4" || m_drawObjectId == "N5" || m_drawObjectId == "N6" || m_drawObjectId == "N7" || m_drawObjectId == "N8" || m_drawObjectId == "N9" ||
                    m_drawObjectId == "N10" || m_drawObjectId == "N11" || m_drawObjectId == "N12" || m_drawObjectId == "s10" || m_drawObjectId == "s11" || m_drawObjectId == "s12" ||
                    m_drawObjectId == "N12" || m_drawObjectId == "N13")
                {
                    //  MessageBox.Show("test  test " + m_drawObjectId);

                    DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 1);
                }
                else if (m_drawObjectId == "bm1" || m_drawObjectId == "bm2" || m_drawObjectId == "bm3" || m_drawObjectId == "bm4" ||
                         m_drawObjectId == "bm5" || m_drawObjectId == "bm6" || m_drawObjectId == "bm7" || m_drawObjectId == "bm8" ||
                         m_drawObjectId == "bm18" || m_drawObjectId == "o11")
                {
                    DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 0.7);
                }
                else
                {
                    //  MessageBox.Show("test  test " + m_drawObjectId);
                    DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 0.4);
                }
                canvastest.CanvasCtrl.Refresh();
            }

            /*
             * if (m_commandType == eCommandType.edit)
             * {
             *  if (m_editTool == null)
             *      m_editTool = m_model.GetEditTool(m_editToolId);
             *  if (m_editTool != null)
             *  {
             *      if (m_editTool.SupportSelection)
             *          m_selection = new SelectionRectangle(m_mousedownPoint);
             *
             *      eDrawObjectMouseDown mouseresult = m_editTool.OnMouseDown(m_canvaswrapper, mousepoint, m_snappoint);
             * //                    /*
             * //                    if (mouseresult == eDrawObjectMouseDown.Continue)
             * //                    {
             * //                        if (m_editTool.SupportSelection)
             * //                            m_selection = new SelectionRectangle(m_mousedownPoint);
             * //                    }
             * //                     * * /
             * //
             *      if (mouseresult == eDrawObjectMouseDown.Done)
             *      {
             *          m_editTool.Finished();
             *          m_editTool = m_model.GetEditTool(m_editToolId); // continue with new tool
             *          //m_editTool = null;
             *
             *          if (m_editTool.SupportSelection)
             *              m_selection = new SelectionRectangle(m_mousedownPoint);
             *      }
             *  }
             *  DoInvalidate(true);
             *  UpdateCursor();
             * }
             */
            base.OnMouseDown(e);
        }