Esempio n. 1
0
        private void showInfo(DataTable dt, IPoint location)
        {
            if (tableLabel != null)
            {
                this.axRenderControl1.ObjectManager.DeleteObject(tableLabel.Guid);
            }
            if (dt != null && dt.Rows.Count == 1)
            {
                int            row        = dt.Columns.Count;
                IObjectManager objManager = this.axRenderControl1.ObjectManager;
                //创建一个TableLabel 指定 row ,column
                tableLabel = objManager.CreateTableLabel(row, 2, rootId);

                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    string columnName = dt.Columns[i].ColumnName;
                    tableLabel.SetRecord(i, 0, columnName);
                    tableLabel.SetRecord(i, 1, dt.Rows[0][columnName].ToString());
                }

                // 设定表位置
                tableLabel.Position = location;

                //表头
                tableLabel.TitleText = "拾取模型信息";
                //表头背景色
                tableLabel.TitleBackgroundColor = System.Drawing.Color.FromArgb(255, 255, 255, 200);

                tableLabel.SetColumnWidth(0, 80);

                tableLabel.SetColumnWidth(1, 200);

                //表的边框颜色
                tableLabel.BorderColor = System.Drawing.Color.Red;
                //表的边框的宽度
                tableLabel.BorderWidth = 2;
                //表的背景色
                tableLabel.TableBackgroundColor = System.Drawing.Color.FromArgb(200, 255, 255, 200);

                // 表头样式
                TextAttribute headerTextAttribute = new TextAttribute();
                headerTextAttribute.TextColor              = System.Drawing.Color.FromArgb(255, 0, 0, 0);
                headerTextAttribute.OutlineColor           = System.Drawing.Color.Blue;
                headerTextAttribute.Font                   = "宋体";
                headerTextAttribute.TextSize               = 12;
                headerTextAttribute.Bold                   = false;
                headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
                tableLabel.SetColumnTextAttribute(0, headerTextAttribute);

                // 内容样式  列的内容 样式
                TextAttribute contentTextAttribute = new TextAttribute();
                contentTextAttribute.TextColor              = System.Drawing.Color.FromArgb(255, 0, 0, 0);;
                contentTextAttribute.OutlineColor           = System.Drawing.Color.Blue;
                contentTextAttribute.Font                   = "宋体";
                contentTextAttribute.Bold                   = false;
                contentTextAttribute.TextSize               = 12;
                contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
                tableLabel.SetColumnTextAttribute(1, contentTextAttribute);

                // 标题样式
                TextAttribute capitalTextAttribute = new TextAttribute();
                capitalTextAttribute.TextColor              = System.Drawing.Color.White;
                capitalTextAttribute.OutlineColor           = System.Drawing.Color.Green;
                capitalTextAttribute.Font                   = "华文新魏";
                capitalTextAttribute.TextSize               = 15;
                capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
                capitalTextAttribute.Bold                   = true;
                tableLabel.TitleTextAttribute               = capitalTextAttribute;

                tableLabel.MouseSelectMask = 0;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 绘制标签
        /// </summary>
        /// <param name="x">标签X坐标</param>
        /// <param name="y">标签Y坐标</param>
        /// <param name="z">标签Z坐标</param>
        protected void DrawTableLabel(double x, double y, double z)
        {
            int            rowCount = 3, columnCount = 2;
            IObjectManager objManager = _AxRenderControl.ObjectManager;

            if (_TableLabel == null)
            {
                _TableLabel = objManager.CreateTableLabel(rowCount, columnCount, rootId);

                _TableLabel.TitleText = "最高点";

                _TableLabel.SetRecord(0, 0, "x:");
                _TableLabel.SetRecord(1, 0, "y:");
                _TableLabel.SetRecord(2, 0, "z:");

                _TableLabel.BorderColor          = System.Drawing.Color.Yellow;
                _TableLabel.BorderWidth          = 2;
                _TableLabel.TableBackgroundColor = System.Drawing.Color.Gray;

                // 内容标题样式
                TextAttribute columeCapitalTextAttribute = new TextAttribute()
                {
                    TextColor              = System.Drawing.Color.Black,
                    OutlineColor           = System.Drawing.Color.Gray,
                    Font                   = "Calibri",
                    TextSize               = 15,
                    Bold                   = true,
                    MultilineJustification = gviMultilineJustification.gviMultilineCenter
                };
                _TableLabel.SetColumnTextAttribute(0, columeCapitalTextAttribute);

                // 内容值样式
                TextAttribute columeValueTextAttribute = new TextAttribute()
                {
                    TextColor              = System.Drawing.Color.Black,
                    OutlineColor           = System.Drawing.Color.Blue,
                    Font                   = "Calibri",
                    TextSize               = 13,
                    Bold                   = true,
                    MultilineJustification = gviMultilineJustification.gviMultilineLeft
                };
                _TableLabel.SetColumnTextAttribute(1, columeValueTextAttribute);

                // 标题样式
                _TableLabel.TitleBackgroundColor = System.Drawing.Color.Yellow;
                TextAttribute titleTextAttribute = new TextAttribute()
                {
                    TextColor = System.Drawing.Color.Black, OutlineColor = System.Drawing.Color.Green, Font = "宋体", TextSize = 15, MultilineJustification = gviMultilineJustification.gviMultilineCenter, Bold = true, BackgroundColor = System.Drawing.Color.Gray
                };
                _TableLabel.TitleTextAttribute = titleTextAttribute;
            }

            IPoint poi = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ) as IPoint;

            poi.SetCoords(x, y, z, 0, 0);
            _TableLabel.Position = poi;

            _TableLabel.SetRecord(0, 1, x.ToString());
            _TableLabel.SetRecord(1, 1, y.ToString());
            _TableLabel.SetRecord(2, 1, z.ToString());

            _TableLabel.VisibleMask = gviViewportMask.gviViewAllNormalView;
        }