合并单元格 cxgrid能不能横向合并单元格,各位帮忙一下! 如把A1.B1两个单元格合并 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1)cxGridDBTableViewColumn1.Options.CellMerging:=true 2)编写代码procedure TfrmYFCOPR01A.cxGrid1DBBandedTableView1PAB01CompareRowValuesForCellMerging( Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);begin inherited; if (ARow1.Values[0] = ARow2.Values[0]) AND (ARow1.Values[1] = ARow2.Values[1]) then AAreEqual := True else AAreEqual := False;end; void __fastcall TSheetOutput::MultiTitleMerge(TdxSpreadSheetTableView * AView, TRect ARect){ do { if (ARect.Top < ARect.Bottom) { String S = AView->CreateCell(ARect.Top, ARect.Left)->AsString; if (AView->CreateCell(ARect.Top + 1, ARect.Left)->IsEmpty) { // 如果下一行是空, 则将该列合并到底行 AView->MergedCells->Add(TRect(ARect.Left, ARect.Top, ARect.Left, ARect.Bottom)); } else if (ARect.Left < ARect.Right) // 如果是多列 { int LCount = 0; // 合并列数 while (ARect.Left + LCount < ARect.Right) if (SameText(S, AView->CreateCell(ARect.Top, ARect.Left + LCount + 1)->AsString)) LCount++; else break; if (LCount) { AView->ClearCells(TRect(ARect.Left + 1, ARect.Top, ARect.Left + LCount, ARect.Top), false, false); AView->MergedCells->Add(TRect(ARect.Left, ARect.Top, ARect.Left + LCount, ARect.Top)); if (ARect.Top < ARect.Bottom) MultiTitleMerge(AView, TRect(ARect.Left, ARect.Top+1, ARect.Left + LCount, ARect.Bottom)); ARect.Left += LCount; } else MultiTitleMerge(AView, TRect(ARect.Left, ARect.Top + 1, ARect.Left, ARect.Bottom)); } else MultiTitleMerge(AView, TRect(ARect.Left, ARect.Top + 1, ARect.Left, ARect.Bottom)); } ARect.Left++; } while (ARect.Left <= ARect.Right);}这个是 BCB 的, 有纵向和横向的 请教软件源码买卖问题 delphi 获取 cpu 核心,内存型号和内存大小等硬件信息。 关于C/S模式数据库系统的问题 跟帖者有分,给出解决方案者再加100分!!! Win2000下写的程序,在Win98下运行时界面变得惨不忍睹,请问有何办法? 是程序员或想成为程序员的请进? 关于tcombobox取数据库记录的简单问题。 DELPHIER,正转向PYTHON了,大家怎么看? 完全控制WAV的播发,比如播发的次数等,该怎么做呢? 请问如何获取BDE返回的错误号? BYTE 类型转换为string类型 用SQL实现阶乘
2)编写代码
procedure TfrmYFCOPR01A.cxGrid1DBBandedTableView1PAB01CompareRowValuesForCellMerging(
Sender: TcxGridColumn; ARow1: TcxGridDataRow;
AProperties1: TcxCustomEditProperties; const AValue1: Variant;
ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties;
const AValue2: Variant; var AAreEqual: Boolean);
begin
inherited;
if (ARow1.Values[0] = ARow2.Values[0]) AND (ARow1.Values[1] = ARow2.Values[1]) then
AAreEqual := True
else
AAreEqual := False;
end;
{
do
{
if (ARect.Top < ARect.Bottom)
{
String S = AView->CreateCell(ARect.Top, ARect.Left)->AsString;
if (AView->CreateCell(ARect.Top + 1, ARect.Left)->IsEmpty)
{ // 如果下一行是空, 则将该列合并到底行
AView->MergedCells->Add(TRect(ARect.Left, ARect.Top, ARect.Left, ARect.Bottom));
}
else if (ARect.Left < ARect.Right) // 如果是多列
{
int LCount = 0; // 合并列数 while (ARect.Left + LCount < ARect.Right)
if (SameText(S, AView->CreateCell(ARect.Top, ARect.Left + LCount + 1)->AsString))
LCount++;
else break; if (LCount)
{
AView->ClearCells(TRect(ARect.Left + 1,
ARect.Top, ARect.Left + LCount, ARect.Top), false, false); AView->MergedCells->Add(TRect(ARect.Left, ARect.Top,
ARect.Left + LCount, ARect.Top)); if (ARect.Top < ARect.Bottom)
MultiTitleMerge(AView, TRect(ARect.Left,
ARect.Top+1, ARect.Left + LCount, ARect.Bottom));
ARect.Left += LCount;
}
else MultiTitleMerge(AView, TRect(ARect.Left,
ARect.Top + 1, ARect.Left, ARect.Bottom));
}
else MultiTitleMerge(AView, TRect(ARect.Left,
ARect.Top + 1, ARect.Left, ARect.Bottom));
}
ARect.Left++;
} while (ARect.Left <= ARect.Right);
}
这个是 BCB 的, 有纵向和横向的