コード例 #1
0
        /// <summary>
        /// Constructor(构造函数)
        /// </summary>
        /// <param name="tbItem">设置的Table对象</param>
        public AojTableProperties(AojTable tbItem)
        {
            InitializeComponent();

            #region 初始化
            DataTable dtAlignmentFormatData = AojCommonFnc.GetAlignmentFormatData();
            this.cmbCellAlignment.DisplayMember = "formatname";
            this.cmbCellAlignment.ValueMember = "formatvalue";
            this.cmbCellAlignment.DataSource = dtAlignmentFormatData;
            DataTable dtLineAlignmentFormatData = AojCommonFnc.GetLineAlignmentFormatData();
            this.cmbCellLineAlignment.DisplayMember = "formatname";
            this.cmbCellLineAlignment.ValueMember = "formatvalue";
            this.cmbCellLineAlignment.DataSource = dtLineAlignmentFormatData;
            #endregion

            this.SetDefaultPropertyValue(tbItem);
        }
コード例 #2
0
        /// <summary>
        /// 获得要设置的Table对象的默认属性
        /// </summary>
        /// <param name="tbItem">Table对象</param>
        private void SetDefaultPropertyValue(AojTable tbItem)
        {
            this.tbObject = tbItem;
            this.CopyObject(tbItem, this.tbTempObject);

            #region 表格
            this.txtTableName.Text = tbTempObject.Name;
            this.txtTableWidth.Text = tbTempObject.Width.ToString();
            this.txtTableHeight.Text = tbTempObject.Height.ToString();
            #endregion

            #region 表格列
            this.lisBoxColumn.DataSource = this.GetColumnData(tbTempObject);
            #endregion

            #region 表格行
            this.listBoxRow.DataSource = this.GetRowData(tbTempObject);
            #endregion
        }
コード例 #3
0
        /// <summary>
        /// 将Table对象复制一份
        /// </summary>
        private void CopyObject(AojTable tbObjectFrom, AojTable tbObjectTo)
        {
            #region 表格
            tbObjectTo.Name = tbObjectFrom.Name;
            tbObjectTo.Left = tbObjectFrom.Left;
            tbObjectTo.Top = tbObjectFrom.Top;
            tbObjectTo.Width = tbObjectFrom.Width;
            tbObjectTo.Height = tbObjectFrom.Height;
            tbObjectTo.MyDocument = new CellDocument(true);
            #endregion

            #region 表格列
            Column colItem;
            Column colNewItem;
            foreach (string strColId in tbObjectFrom.MyDocument.ColumnCollection.Keys)
            {
                colItem = tbObjectFrom.MyDocument.ColumnCollection[strColId];
                colNewItem = new Column();
                colNewItem.ColumnID = colItem.ColumnID;
                colNewItem.ColumnRatio = colItem.ColumnRatio;
                colNewItem.ColumnWidth = colItem.ColumnWidth;
                tbObjectTo.MyDocument.ColumnCollection.Add(strColId, colNewItem);
            }
            #endregion

            #region 表格行
            Row rowItem;
            Row rowNewItem;
            Cell cellNewItem;
            foreach (string strRowId in tbObjectFrom.MyDocument.RowCollection.Keys)
            {
                rowItem = tbObjectFrom.MyDocument.RowCollection[strRowId];
                rowNewItem = new Row();
                rowNewItem.RowID = rowItem.RowID;
                rowNewItem.RowHeight = rowItem.RowHeight;
                rowNewItem.RowRatio = rowItem.RowRatio;
                tbObjectTo.MyDocument.RowCollection.Add(strRowId, rowNewItem);

                #region 单元格
                int index = 0;
                foreach (string strColId in tbObjectFrom.MyDocument.ColumnCollection.Keys)
                {
                    colItem = tbObjectFrom.MyDocument.ColumnCollection[strColId];
                    cellNewItem = new Cell();
                    cellNewItem.ColumnID = colItem.ColumnID;
                    cellNewItem.RowID = rowItem[index].RowID;
                    cellNewItem.Text = rowItem[index].Text;
                    cellNewItem.TextFamilyName = rowItem[index].TextFamilyName;
                    cellNewItem.TextFontSize = rowItem[index].TextFontSize;
                    cellNewItem.TextFontStyle = rowItem[index].TextFontStyle;
                    cellNewItem.TextColor = rowItem[index].TextColor;
                    cellNewItem.ObjectAlignment = rowItem[index].ObjectAlignment;
                    cellNewItem.ObjectLineAlignment = rowItem[index].ObjectLineAlignment;
                    rowNewItem.Add(cellNewItem);
                    ++index;
                }
                #endregion
            }
            #endregion
        }
コード例 #4
0
        /// <summary>
        /// 获得指定表格对象的所有行
        /// </summary>
        /// <param name="tbItem">Table对象</param>
        /// <returns>所有行</returns>
        private DataTable GetRowData(AojTable tbItem)
        {
            DataTable dtRowData = new DataTable();

            #region 列
            DataColumn colName = new DataColumn("columnname", typeof(string));
            dtRowData.Columns.Add(colName);
            colName = new DataColumn("columnvalue", typeof(Row));
            dtRowData.Columns.Add(colName);
            #endregion

            #region 行
            DataRow drNew;
            foreach (string strID in tbItem.MyDocument.RowCollection.Keys)
            {
                drNew = dtRowData.NewRow();
                drNew["columnname"] = strID;
                drNew["columnvalue"] = tbItem.MyDocument.RowCollection[strID];
                dtRowData.Rows.Add(drNew);
            }
            #endregion

            return dtRowData;
        }
コード例 #5
0
ファイル: AojTool.cs プロジェクト: JosonYang/aojreporter
        /// <summary>
        /// 报表设计器区域鼠标的MouseDown操作
        /// </summary>
        /// <param name="drawWorkspace">报表设计器区域</param>
        /// <param name="e">鼠标事件参数</param>
        public void PerFormMouseDown(DrawWorkSpace drawWorkspace, MouseEventArgs e)
        {
            #region 给绘制对象定义相关size信息
            //对象左端位置
            Single objectLeft;
            //对象顶端位置
            Single objectTop;
            #endregion

            switch (drawWorkspace.ActiveTool)
            {
                case AojConst.DrawToolType.Label:
                    int countLabelInfo = drawWorkspace.GraphicsList.GetSpecialObjectCountInfo(AojConst.DrawToolType.Label);
                    //对象左端位置
                    objectLeft = this.GetDrawSizeByGridStyle(drawWorkspace, e.X);
                    //对象顶端位置
                    objectTop = this.GetDrawSizeByGridStyle(drawWorkspace, e.Y);
                    AojLabel lbTool = new AojLabel(AojConst.NamePrefix.Label + countLabelInfo, AojConst.NamePrefix.Label + countLabelInfo, objectLeft, objectTop, 100, 25);
                    lbTool.IsMouseDownFlag = true;
                    lbTool.ObjectCurrentPagesizePercent = drawWorkspace.PagesizePercent;
                    AddNewObject(drawWorkspace, lbTool);
                    break;
                case AojConst.DrawToolType.Table:
                    int countTableInfo = drawWorkspace.GraphicsList.GetSpecialObjectCountInfo(AojConst.DrawToolType.Table);
                    //对象左端位置
                    objectLeft = this.GetDrawSizeByGridStyle(drawWorkspace, e.X);
                    //对象顶端位置
                    objectTop = this.GetDrawSizeByGridStyle(drawWorkspace, e.Y);
                    AojTable tbTool = new AojTable(AojConst.NamePrefix.Table + countTableInfo, AojConst.NamePrefix.Table + countTableInfo, objectLeft, objectTop, 50, 25);
                    tbTool.IsMouseDownFlag = true;
                    tbTool.ObjectCurrentPagesizePercent = drawWorkspace.PagesizePercent;
                    AddNewObject(drawWorkspace, tbTool);
                    break;
                case AojConst.DrawToolType.Image:
                    int countImageInfo = drawWorkspace.GraphicsList.GetSpecialObjectCountInfo(AojConst.DrawToolType.Image);
                    //对象左端位置
                    objectLeft = this.GetDrawSizeByGridStyle(drawWorkspace, e.X);
                    //对象顶端位置
                    objectTop = this.GetDrawSizeByGridStyle(drawWorkspace, e.Y);
                    AojImage imgTool = new AojImage(AojConst.NamePrefix.Image + countImageInfo, AojConst.NamePrefix.Image + countImageInfo, objectLeft, objectTop, 80, 100);
                    imgTool.IsMouseDownFlag = true;
                    imgTool.ObjectCurrentPagesizePercent = drawWorkspace.PagesizePercent;
                    AddNewObject(drawWorkspace, imgTool);
                    break;
                case AojConst.DrawToolType.Pointer:
                    //报表设计器区域没有要绘制的对象时,鼠标的MouseDown操作
                    this.DoPointerMouseDown(drawWorkspace, e);
                    break;
                default:
                    break;
            }
        }