Files
lserp_cs_6.0/插件库/Lskj.Control/Kuaiji/AmountCellRender.cs
T

308 lines
6.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Drawing;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Base.ViewInfo;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
// Token: 0x02000003 RID: 3
public class AmountCellRender : IDisposable
{
public AmountCellRender(GridView gridView_0)
{
if (gridView_0 == null)
{
throw new ArgumentNullException("gridView_0");
}
Class5.gBkiB4AzUqwkh();
this.colorGray = Color.FromArgb(189, 185, 185);
this.colorGreen = Color.Green;
this.colorRed = Color.Red;
this.string_0 = "万仟佰拾亿仟佰拾万仟佰拾元角分";
this.int_0 = 14;
this.dictionary_0 = new Dictionary<string, Class2>();
this.list_0 = new List<GridColumn>();
this.object_0 = gridView_0;
this.gridControl_0 = this.object_0.GridControl;
this.object_0.CustomDrawCell += this.object_0_CustomDrawCell;
this.object_0.CustomDrawColumnHeader += this.object_0_CustomDrawColumnHeader;
this.object_0.CustomDrawFooterCell += this.object_0_CustomDrawFooterCell;
if (this.gridControl_0 != null)
{
this.gridControl_0.Paint += this.method_0;
}
}
private void method_0(object sender, PaintEventArgs e)
{
if (this.disposed || this.list_0.Count == 0)
{
return;
}
GridControl gridControl = sender as GridControl;
if (gridControl == null || gridControl.IsDisposed || gridControl.Disposing)
{
return;
}
GridView gridView = gridControl.FocusedView as GridView;
if (gridView == null)
{
return;
}
GridViewInfo gridViewInfo = gridView.GetViewInfo() as GridViewInfo;
if (gridViewInfo == null || gridViewInfo.ColumnsInfo == null)
{
return;
}
foreach (GridColumn gridColumn in this.list_0)
{
Class2 @class;
if (gridColumn == null ||
!this.dictionary_0.TryGetValue(gridColumn.Name, out @class) ||
@class == null)
{
continue;
}
if (@class.IsCountinuousCell())
{
GridColumnInfoArgs gridColumnInfoArgs = gridViewInfo.ColumnsInfo[gridColumn];
if (gridColumnInfoArgs == null)
{
continue;
}
int num = 0;
int int_;
if (@class.method_4())
{
int_ = gridColumnInfoArgs.Bounds.Y;
num = gridColumnInfoArgs.Bounds.Height;
}
else
{
int_ = gridColumnInfoArgs.Bounds.Y + gridColumnInfoArgs.Bounds.Height;
}
int num2;
if (@class.method_0())
{
int rowsTotalHeight = gridViewInfo.ViewRects.RowsTotalHeight;
int height = gridViewInfo.ViewRects.Client.Height;
int height2 = gridViewInfo.ViewRects.Rows.Height;
if (@class.method_2())
{
num2 = height2 + gridViewInfo.FooterInfo.Bounds.Height;
}
else
{
num2 = height2;
}
}
else
{
int rowsTotalHeight2 = gridViewInfo.ViewRects.RowsTotalHeight;
int height3 = gridViewInfo.ViewRects.Rows.Height;
num2 = ((rowsTotalHeight2 > height3) ? height3 : rowsTotalHeight2);
}
num2 += num;
@class.method_19(e.Graphics, gridColumnInfoArgs.Bounds, 1, int_, num2);
}
}
}
private void object_0_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
if (this.disposed || e.Column == null)
{
return;
}
Class2 @class;
if (this.dictionary_0.TryGetValue(e.Column.Name, out @class) &&
@class != null)
{
e.DisplayText = "";
Rectangle bounds = e.Bounds;
Rectangle rectangle_ = bounds;
Graphics graphics = e.Graphics;
Font font = e.Appearance.Font;
object cellValue = e.CellValue;
@class.method_17(rectangle_, graphics, font, (cellValue != null) ? cellValue+"" : "");
e.Handled = true;
}
}
private void object_0_CustomDrawFooterCell(object sender, FooterCellCustomDrawEventArgs e)
{
if (this.disposed || e.Column == null)
{
return;
}
Class2 @class;
if (this.dictionary_0.TryGetValue(e.Column.Name, out @class) &&
@class != null)
{
if (@class.method_8())
{
e.Info.DisplayText = "";
Rectangle bounds = e.Bounds;
@class.method_17(bounds, e.Graphics, e.Appearance.Font, Convert.ToString(e.Info.Value));
e.Handled = true;
}
}
}
private void object_0_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
{
if (this.disposed || e.Column == null)
{
return;
}
Class2 @class;
if (this.dictionary_0.TryGetValue(e.Column.Name, out @class) &&
@class != null)
{
if (@class.method_6())
{
e.Column.Caption = "";
Rectangle bounds = e.Bounds;
@class.method_18(bounds, e.Graphics, e.Column.AppearanceHeader.Font);
e.Handled = true;
}
}
}
[CompilerGenerated]
public Color method_1()
{
return this.colorGray;
}
[CompilerGenerated]
public void method_2(Color color_3)
{
this.colorGray = color_3;
}
[CompilerGenerated]
public Color method_3()
{
return this.colorGreen;
}
[CompilerGenerated]
public void method_4(Color color_3)
{
this.colorGreen = color_3;
}
[CompilerGenerated]
public Color method_5()
{
return this.colorRed;
}
[CompilerGenerated]
public void method_6(Color color_3)
{
this.colorRed = color_3;
}
[CompilerGenerated]
public string method_7()
{
return this.string_0;
}
[CompilerGenerated]
public void method_8(string string_1)
{
this.string_0 = string_1;
}
[CompilerGenerated]
public int method_9()
{
return this.int_0;
}
[CompilerGenerated]
public void method_10(int int_1)
{
this.int_0 = int_1;
}
public Class2 AddAmountColumn(GridColumn gridColumn, int jeNum)
{
int num = this.method_9() * jeNum;
gridColumn.Width = num;
gridColumn.MinWidth = num;
gridColumn.MaxWidth = num;
Class2 @class = new Class2(this, jeNum);
this.dictionary_0.Add(gridColumn.Name, @class);
this.list_0.Add(gridColumn);
return @class;
}
public void RemoveAmountColumn(GridColumn gridColumn_0)
{
if (gridColumn_0 != null && this.dictionary_0.ContainsKey(gridColumn_0.Name))
{
this.dictionary_0.Remove(gridColumn_0.Name);
this.list_0.Remove(gridColumn_0);
}
}
public void Dispose()
{
if (this.disposed)
{
return;
}
this.disposed = true;
GridView gridView = this.object_0;
GridControl gridControl = this.gridControl_0;
this.object_0 = null;
this.gridControl_0 = null;
if (gridView != null)
{
gridView.CustomDrawCell -= this.object_0_CustomDrawCell;
gridView.CustomDrawColumnHeader -= this.object_0_CustomDrawColumnHeader;
gridView.CustomDrawFooterCell -= this.object_0_CustomDrawFooterCell;
}
if (gridControl != null)
{
gridControl.Paint -= this.method_0;
}
this.dictionary_0.Clear();
this.list_0.Clear();
}
private GridView object_0;
private GridControl gridControl_0;
private bool disposed;
private Color colorGray;
private Color colorGreen;
private Color colorRed;
private string string_0;
private int int_0;
private Dictionary<string, Class2> dictionary_0;
private List<GridColumn> list_0;
}