示例#1
0
        private void ShowEdit(int nEditPosRow, int nEditPosCol)
        {
            if (m_bEditEnable && 0 <= nEditPosCol && nEditPosCol < m_Grid.m_nCols && 0 <= nEditPosRow && nEditPosRow < m_Grid.m_nRows)
            {
                XCell xCell = m_Grid.GetCell(nEditPosRow, nEditPosCol);
                txtEdit.Text = xCell.Text;;


                txtEdit.Left   = m_Grid.m_pAbsPosX[nEditPosCol] + 1;
                txtEdit.Top    = m_Grid.m_pAbsPosY[nEditPosRow] + 1;
                txtEdit.Width  = m_Grid.m_pAbsPosX[nEditPosCol + 1] - txtEdit.Left;
                txtEdit.Height = m_Grid.m_pAbsPosY[nEditPosRow + 1] - txtEdit.Top;



                Font fFont = new Font(Font.FontFamily, Font.Size * m_fZoom);
                txtEdit.Font = fFont;

                txtEdit.Visible = true;
                txtEdit.Focus();
                txtEdit.SelectAll();
                m_nEditPosRow = nEditPosRow;
                m_nEditPosCol = nEditPosCol;
            }
        }
示例#2
0
 private void UpdateEdit()
 {
     if (txtEdit.Visible == true)
     {
         //Backup(m_nEditPosRow, m_nEditPosCol, 0, 0);
         XCell  xCell = m_Grid.GetCell(m_nEditPosRow, m_nEditPosCol);
         string sText = xCell.Text;
         txtEdit.Visible = false;
         if (sText != txtEdit.Text)
         {
             sText = txtEdit.Text;
             sText = sText.Replace("\n", "");
             if (sText != null && sText != "")
             {
                 sText = sText.Replace("\r", "");
                 if (sText != null && sText != "")
                 {
                     xCell.Text = sText;
                     Focus();
                     if (ChangeText != null)
                     {
                         ChangeText(this, m_nEditPosRow, m_nEditPosCol);
                     }
                 }
             }
         }
     }
 }
示例#3
0
 public void Reset()
 {
     Sub       = null;
     Param     = 0;
     ForeColor = Color.Empty;
     BackColor = Color.Empty;
     ForeImage = null;
     BackImage = null;
     Align     = null;
     Font      = null;
     Text      = "";
 }
示例#4
0
 public void Copy(XCell cItem)
 {
     Sub       = cItem.Sub;
     Param     = cItem.Param;
     ForeColor = cItem.ForeColor;
     BackColor = cItem.BackColor;
     ForeImage = cItem.ForeImage;
     BackImage = cItem.BackImage;
     Align     = cItem.Align;
     Font      = cItem.Font;
     Text      = cItem.Text;
 }
示例#5
0
        public void NewMatrix(int nRows, int nCols, int nDefaultWidth, int nDefaultHeight)
        {
            m_nRows = nRows;
            m_nCols = nCols;

            if (nRows > 0 && nCols > 0)
            {
                m_pHeight = new int[nRows];
                m_pWidth  = new int[nCols];
                m_pCell   = new XCell[nRows, nCols];

                if (nRows > 0 && nCols > 0)
                {
                    for (int nRow = 0; nRow < m_nRows; nRow++)
                    {
                        m_pHeight[nRow] = nDefaultHeight;
                        for (int nCol = 0; nCol < nCols; nCol++)
                        {
                            m_pCell[nRow, nCol] = new XCell();
                        }
                    }

                    for (int nCol = 0; nCol < m_nCols; nCol++)
                    {
                        m_pWidth[nCol] = nDefaultWidth;
                    }

                    m_pAbsPosY = new int[m_nRows + 3];
                    m_pAbsPosX = new int[m_nCols + 3];

                    m_pDrawH = new Point[m_nRows * 2 + 5];
                    m_pDrawV = new Point[m_nCols * 2 + 5];

                    MoveGrid(0, 0, 0, 0, 1);
                }
            }
        }