|
|
@@ -1,5 +1,6 @@
|
|
|
using DevExpress.Utils;
|
|
|
using DevExpress.XtraCharts;
|
|
|
+using DevExpress.XtraRichEdit.Layout;
|
|
|
using OTSIncAReportApp._1_UI.Control_DEVCharts;
|
|
|
using OTSIncAReportApp.OTSRstMgrFunction;
|
|
|
using OTSIncAReportApp.OTSSampleReportInfo;
|
|
|
@@ -320,88 +321,138 @@ namespace OTSIncAReportGrids
|
|
|
/// </summary>
|
|
|
private Point SetDataGridViewStyle(OTSGridView gridView)
|
|
|
{
|
|
|
- //用户不能调整标题的高度
|
|
|
- gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
|
|
|
|
|
- //用户不能调整 行高
|
|
|
- gridView.AllowUserToResizeRows = false;
|
|
|
|
|
|
- //点击选择整行
|
|
|
- gridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
|
+ //// user can't change header height
|
|
|
+ //gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
|
|
|
|
|
- //居中显示
|
|
|
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
|
|
- dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
|
|
- gridView.DefaultCellStyle = dataGridViewCellStyle1;
|
|
|
- gridView.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
+ //// user can't change row height
|
|
|
+ //gridView.AllowUserToResizeRows = false;
|
|
|
|
|
|
- //再次重覆禁用拖动表头高度,居然有效果了
|
|
|
- gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
|
|
+ //gridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
|
|
|
|
- //设置grid可以复制
|
|
|
- gridView.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
|
|
|
+ //var centeredStyle = new DataGridViewCellStyle
|
|
|
+ //{
|
|
|
+ // Alignment = DataGridViewContentAlignment.MiddleCenter
|
|
|
+ //};
|
|
|
+ //gridView.DefaultCellStyle = centeredStyle;
|
|
|
+ //gridView.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
|
|
- //设置每列的宽度
|
|
|
- gridView.Columns[0].Width = 40;//第一列序号的宽度设置一下吧,要不太丑
|
|
|
- gridView.Columns[1].Width = 200;
|
|
|
+ //gridView.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
|
|
|
|
|
|
- //设置序号列不排序
|
|
|
- gridView.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
|
|
|
+ //gridView.Columns[0].Width = 40;
|
|
|
+ //gridView.Columns[1].Width = 200;
|
|
|
|
|
|
- //设置序号列不可以设置宽度
|
|
|
- gridView.Columns[0].Resizable = DataGridViewTriState.False;
|
|
|
- gridView.AllowUserToAddRows = false;
|
|
|
- gridView.AllowUserToDeleteRows = false;
|
|
|
- gridView.AllowUserToResizeRows = false;
|
|
|
- gridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
|
|
- gridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
|
- gridView.ContextMenuStrip = this.contextMenuStrip1;
|
|
|
- gridView.BorderStyle = 0;
|
|
|
+ //gridView.Columns[0].Resizable = DataGridViewTriState.False;
|
|
|
+ //gridView.AllowUserToAddRows = false;
|
|
|
+ //gridView.AllowUserToDeleteRows = false;
|
|
|
+ //gridView.AllowUserToResizeRows = false;
|
|
|
+ //gridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
|
|
+ //gridView.RowHeadersVisible = false;
|
|
|
+ //gridView.RowHeadersWidth = 40;
|
|
|
+ //gridView.RowTemplate.Height = 30;
|
|
|
|
|
|
- gridView.Margin = new System.Windows.Forms.Padding(2);
|
|
|
- gridView.MergeColumnHeaderBackColor = System.Drawing.SystemColors.ButtonHighlight;
|
|
|
+ //int gridView_Width = 0;
|
|
|
|
|
|
- gridView.ReadOnly = true;
|
|
|
- gridView.RowHeadersVisible = false;
|
|
|
- gridView.RowHeadersWidth = 40;
|
|
|
- gridView.RowTemplate.Height = 30;
|
|
|
+ // for (int i = 0; i < gridView.ColumnCount; i++)
|
|
|
+ // {
|
|
|
+ // gridView_Width = gridView_Width + gridView.Columns[i].Width;
|
|
|
|
|
|
- int gridView_Width = 0;
|
|
|
+ // }
|
|
|
|
|
|
- for (int i = 0; i < gridView.ColumnCount; i++)
|
|
|
- {
|
|
|
- gridView_Width = gridView_Width + gridView.Columns[i].Width;
|
|
|
+ // int gridViewHeight = 0;
|
|
|
|
|
|
- }
|
|
|
+ // for (int i = 0; i < gridView.Rows.Count; i++)
|
|
|
+ // {
|
|
|
+ // gridViewHeight = gridViewHeight + gridView.Rows[i].Height;
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
+ // gridView.Size = new System.Drawing.Size(gridView_Width, gridViewHeight);
|
|
|
+
|
|
|
+ // gridheight = gridheight + gridViewHeight;
|
|
|
+ // gridwidth = gridwidth + gridView_Width+20;
|
|
|
+
|
|
|
+ //MessageBox.Show(((gridwidth - (gridView_Width + 20)).ToString())+":"+gridView_Width.ToString()+":"+gridViewHeight.ToString());
|
|
|
|
|
|
- int gridViewHeight = 0;
|
|
|
+ //gridView.TabIndex = 0;
|
|
|
+ // //先设置一下头的高度,否则会太矮不好看
|
|
|
+ // gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
|
|
|
+ // gridView.ColumnHeadersHeight = 40;
|
|
|
+ // gridView.Columns[4].Visible = false;
|
|
|
+ //list_table_size.Add(new Point(gridView_Width, (gridView.RowCount + 2) * 30));
|
|
|
+ // int outpos = gridView.Location.X;
|
|
|
+ // int a_height = gridheight - gridViewHeight;
|
|
|
+
|
|
|
+
|
|
|
+ //gridView.Location = new System.Drawing.Point(gridwidth- (gridView_Width + 20), 0);
|
|
|
+ //return new Point(gridwidth - (gridView_Width + 20), 0);
|
|
|
+
|
|
|
+
|
|
|
+ // user can't change header height
|
|
|
+ gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
|
|
+
|
|
|
+ // user can't change row height
|
|
|
+ gridView.AllowUserToResizeRows = false;
|
|
|
+
|
|
|
+ gridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
|
+
|
|
|
+ var centeredStyle = new DataGridViewCellStyle
|
|
|
+ {
|
|
|
+ Alignment = DataGridViewContentAlignment.MiddleCenter
|
|
|
+ };
|
|
|
+ gridView.DefaultCellStyle = centeredStyle;
|
|
|
+ gridView.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
+
|
|
|
+ gridView.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
|
|
|
+
|
|
|
+ gridView.Columns[0].Width = 40;
|
|
|
+ gridView.Columns[1].Width = 200;
|
|
|
+
|
|
|
+ gridView.Columns[0].Resizable = DataGridViewTriState.False;
|
|
|
+ gridView.AllowUserToAddRows = false;
|
|
|
+ gridView.AllowUserToDeleteRows = false;
|
|
|
+ gridView.AllowUserToResizeRows = false;
|
|
|
+ gridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
|
|
|
+ gridView.RowHeadersVisible = false;
|
|
|
+ gridView.RowHeadersWidth = 40;
|
|
|
+ gridView.RowTemplate.Height = 30;
|
|
|
+
|
|
|
+ int gridViewHeight = 0;
|
|
|
|
|
|
for (int i = 0; i < gridView.Rows.Count; i++)
|
|
|
{
|
|
|
gridViewHeight = gridViewHeight + gridView.Rows[i].Height;
|
|
|
|
|
|
}
|
|
|
+ int gridView_Width = 0;
|
|
|
|
|
|
- gridView.Size = new System.Drawing.Size(gridView_Width, gridViewHeight);
|
|
|
-
|
|
|
- gridheight = gridheight + gridViewHeight;
|
|
|
- gridwidth = gridwidth + gridView_Width+20;
|
|
|
- gridView.TabIndex = 0;
|
|
|
- //先设置一下头的高度,否则会太矮不好看
|
|
|
- gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
|
|
|
- gridView.ColumnHeadersHeight = 40;
|
|
|
+ for (int i = 0; i < gridView.ColumnCount-1; i++)
|
|
|
+ {
|
|
|
+ gridView_Width = gridView_Width + gridView.Columns[i].Width;
|
|
|
|
|
|
- gridView.Columns[4].Visible = false;
|
|
|
+ }
|
|
|
+ gridView.Size = new System.Drawing.Size(gridView_Width, gridViewHeight);
|
|
|
+
|
|
|
+ int gridheight = gridViewHeight + 7;
|
|
|
|
|
|
+ gridheight = gridheight + gridViewHeight + 2;
|
|
|
+ gridwidth = gridwidth + gridView.ColumnCount * 100 + 80;
|
|
|
+ gridView.TabIndex = 0;
|
|
|
+ gridView.ContextMenuStrip = this.contextMenuStrip1;
|
|
|
+ gridView.BorderStyle = 0;
|
|
|
+ gridView.ReadOnly = true;
|
|
|
+ gridView.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(this.Gview_ColumnHeaderMouseClick);
|
|
|
+ gridView.Sorted += new System.EventHandler(this.Gview_gz_Sorted);
|
|
|
+ // set header height a bit taller for aesthetics
|
|
|
+ gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
|
|
|
+ gridView.ColumnHeadersHeight = 40;
|
|
|
list_table_size.Add(new Point(gridView_Width, (gridView.RowCount + 2) * 30));
|
|
|
- int outpos = gridView.Location.X;
|
|
|
- int a_height = gridheight - gridViewHeight;
|
|
|
+ gridView.Location = new System.Drawing.Point(gridwidth - (gridView.ColumnCount * 100 + 80), 0);
|
|
|
|
|
|
+ return new Point(gridwidth - (gridView.ColumnCount * 100 + 80), 0);
|
|
|
|
|
|
- gridView.Location = new System.Drawing.Point(gridwidth- (gridView_Width + 20), 0);
|
|
|
- return new Point(gridwidth - (gridView_Width + 20), 0);
|
|
|
-
|
|
|
- }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 窗体加载及初始化
|
|
|
@@ -507,6 +558,10 @@ namespace OTSIncAReportGrids
|
|
|
chartControl1.Size = new Size(a_size.X, location_hig);
|
|
|
chartControl1.Location = new Point(a_Location.X, location_hig + 20);
|
|
|
|
|
|
+ MessageBox.Show(a_Location.X.ToString() + ":" + a_size.X.ToString() + ":" + location_hig.ToString());
|
|
|
+ MessageBox.Show(chartControl1.Location.X.ToString() + ":" + chartControl1.Width.ToString() + ":" + chartControl1.Height.ToString());
|
|
|
+
|
|
|
+
|
|
|
DataTable dataTable = new DataTable();
|
|
|
dataTable.Columns.Add("name");
|
|
|
dataTable.Columns.Add("size");
|