fix(legacy): remove WPF splitter width workaround
This commit is contained in:
+11
-105
@@ -91,9 +91,6 @@ namespace Lskj.PubBill
|
|||||||
private DataTable _detailColumns;
|
private DataTable _detailColumns;
|
||||||
private bool IsCopying = false;
|
private bool IsCopying = false;
|
||||||
private bool _moduleResourcesReleased;
|
private bool _moduleResourcesReleased;
|
||||||
private int _preferredSourcePanelWidth;
|
|
||||||
private bool _sourcePanelWidthRestorePending;
|
|
||||||
private bool _restoringSourcePanelWidth;
|
|
||||||
|
|
||||||
|
|
||||||
protected DataRow BillRowItem;
|
protected DataRow BillRowItem;
|
||||||
@@ -269,7 +266,6 @@ namespace Lskj.PubBill
|
|||||||
public BillModule()
|
public BillModule()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.ssc_main_top.SizeChanged += OnTopSplitterSizeChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -354,7 +350,6 @@ namespace Lskj.PubBill
|
|||||||
splitContainer.SplitterMoved -= OnDetailsSplitterMoved;
|
splitContainer.SplitterMoved -= OnDetailsSplitterMoved;
|
||||||
splitContainer.SplitterMoved -= OnSpecialMainSplitterMoved;
|
splitContainer.SplitterMoved -= OnSpecialMainSplitterMoved;
|
||||||
splitContainer.SplitterMoved -= OnSpecialLeftSplitterMoved;
|
splitContainer.SplitterMoved -= OnSpecialLeftSplitterMoved;
|
||||||
splitContainer.SizeChanged -= OnTopSplitterSizeChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleButton commonButton = control as SimpleButton;
|
SimpleButton commonButton = control as SimpleButton;
|
||||||
@@ -1197,24 +1192,14 @@ namespace Lskj.PubBill
|
|||||||
// 设置单据来源左侧宽度
|
// 设置单据来源左侧宽度
|
||||||
if (this.BillModel.PanelWidth == 0)
|
if (this.BillModel.PanelWidth == 0)
|
||||||
{
|
{
|
||||||
this._preferredSourcePanelWidth = 0;
|
|
||||||
this._sourcePanelWidthRestorePending = false;
|
|
||||||
// 隐藏来源
|
// 隐藏来源
|
||||||
this.ssc_main_top.PanelVisibility = SplitPanelVisibility.Panel2;
|
this.ssc_main_top.PanelVisibility = SplitPanelVisibility.Panel2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string width = IniHelper.Read(string.Format("bill_width_{0}", this.SysModel.ModuleCode));
|
string width = IniHelper.Read(string.Format("bill_width_{0}", this.SysModel.ModuleCode));
|
||||||
int savedWidth;
|
if (!string.IsNullOrEmpty(width))
|
||||||
this._preferredSourcePanelWidth =
|
this.ssc_main_top.SplitterPosition = Convert.ToInt32(width);
|
||||||
!string.IsNullOrEmpty(width) &&
|
|
||||||
int.TryParse(width, out savedWidth) &&
|
|
||||||
savedWidth > 0
|
|
||||||
? savedWidth
|
|
||||||
: this.BillModel.PanelWidth;
|
|
||||||
this._sourcePanelWidthRestorePending =
|
|
||||||
this._preferredSourcePanelWidth > 0;
|
|
||||||
TryRestoreSourcePanelWidth();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置单据来源底部高度
|
// 设置单据来源底部高度
|
||||||
@@ -1236,82 +1221,6 @@ namespace Lskj.PubBill
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTopSplitterSizeChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!ReferenceEquals(sender, this.ssc_main_top) ||
|
|
||||||
this._moduleResourcesReleased ||
|
|
||||||
this.BillModel == null ||
|
|
||||||
this.BillModel.PanelWidth <= 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.ssc_main_top.ClientSize.Width <= 1)
|
|
||||||
{
|
|
||||||
if (this._preferredSourcePanelWidth > 0)
|
|
||||||
{
|
|
||||||
// WindowsFormsHost temporarily measures a projected page at
|
|
||||||
// zero while moving it between WPF content presenters. Keep
|
|
||||||
// the last valid position and restore it after reattachment.
|
|
||||||
this._sourcePanelWidthRestorePending = true;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._isInitFinish &&
|
|
||||||
this._sourcePanelWidthRestorePending &&
|
|
||||||
!this.ssc_main_top.Collapsed)
|
|
||||||
{
|
|
||||||
TryRestoreSourcePanelWidth();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TryRestoreSourcePanelWidth()
|
|
||||||
{
|
|
||||||
if (this._restoringSourcePanelWidth ||
|
|
||||||
this._preferredSourcePanelWidth <= 0 ||
|
|
||||||
this.ssc_main_top == null ||
|
|
||||||
this.ssc_main_top.IsDisposed ||
|
|
||||||
this.ssc_main_top.Collapsed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int availableWidth = this.ssc_main_top.ClientSize.Width;
|
|
||||||
if (availableWidth <= 1)
|
|
||||||
{
|
|
||||||
this._sourcePanelWidthRestorePending = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int targetWidth = Math.Min(
|
|
||||||
this._preferredSourcePanelWidth,
|
|
||||||
availableWidth - 1);
|
|
||||||
if (targetWidth <= 0)
|
|
||||||
{
|
|
||||||
this._sourcePanelWidthRestorePending = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._restoringSourcePanelWidth = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.ssc_main_top.SplitterPosition = targetWidth;
|
|
||||||
this._sourcePanelWidthRestorePending =
|
|
||||||
targetWidth < this._preferredSourcePanelWidth;
|
|
||||||
}
|
|
||||||
catch (ArgumentOutOfRangeException)
|
|
||||||
{
|
|
||||||
// The DevExpress panels may not have completed their minimum-size
|
|
||||||
// layout yet. The next SizeChanged event retries this instance.
|
|
||||||
this._sourcePanelWidthRestorePending = true;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
this._restoringSourcePanelWidth = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>说明:初始化系统配置</para>
|
/// <para>说明:初始化系统配置</para>
|
||||||
/// <para>创建人:龚宇超</para>
|
/// <para>创建人:龚宇超</para>
|
||||||
@@ -4613,6 +4522,14 @@ namespace Lskj.PubBill
|
|||||||
UpdateDynamicColumns();
|
UpdateDynamicColumns();
|
||||||
UpdateSummaryData();
|
UpdateSummaryData();
|
||||||
|
|
||||||
|
// ✅ 新增:开启横向滚动(避免列宽自适应吃掉滚动条)
|
||||||
|
var gv = gcMain.GridView as DevExpress.XtraGrid.Views.Grid.GridView;
|
||||||
|
if (gv != null)
|
||||||
|
{
|
||||||
|
gv.OptionsView.ColumnAutoWidth = false;
|
||||||
|
gv.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always;
|
||||||
|
}
|
||||||
|
|
||||||
// 你原来的手动刷新——保持
|
// 你原来的手动刷新——保持
|
||||||
OnGcMainDataSourceChanged(gcMain.GridView, null);
|
OnGcMainDataSourceChanged(gcMain.GridView, null);
|
||||||
}
|
}
|
||||||
@@ -8463,19 +8380,8 @@ namespace Lskj.PubBill
|
|||||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||||
private void OnTopSplitterMoved(object sender, EventArgs e)
|
private void OnTopSplitterMoved(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (this._restoringSourcePanelWidth)
|
if (this._isInitFinish)// 是否为初始化创建
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._isInitFinish &&
|
|
||||||
this.SysModel != null &&
|
|
||||||
this.ssc_main_top.ClientSize.Width > 1 &&
|
|
||||||
this.ssc_main_top.SplitterPosition > 0)// 是否为初始化创建
|
|
||||||
{
|
|
||||||
this._preferredSourcePanelWidth =
|
|
||||||
this.ssc_main_top.SplitterPosition;
|
|
||||||
this._sourcePanelWidthRestorePending = false;
|
|
||||||
IniHelper.Write(string.Format("bill_width_{0}", this.SysModel.ModuleCode), this.ssc_main_top.SplitterPosition + "");
|
IniHelper.Write(string.Format("bill_width_{0}", this.SysModel.ModuleCode), this.ssc_main_top.SplitterPosition + "");
|
||||||
}
|
}
|
||||||
if (this.gcMain != null && this.gcMain.gridControl != null)
|
if (this.gcMain != null && this.gcMain.gridControl != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user