优化tableView控件横向拖动滑块的显示
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,9 +1,8 @@
|
||||
build/*
|
||||
build64/*
|
||||
build/
|
||||
demo/
|
||||
_temp/
|
||||
_bin/
|
||||
temp/
|
||||
bin/
|
||||
.vs/
|
||||
demo/
|
||||
*.lib
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
#include "TableView.h"
|
||||
#include "TableView.h"
|
||||
|
||||
namespace ezui {
|
||||
|
||||
@@ -240,6 +240,11 @@ namespace ezui {
|
||||
g.DrawRectangle(RectF(firstColRect));
|
||||
}
|
||||
|
||||
int headerClipWidth = Width() - m_firstColumnWidth;
|
||||
if (headerClipWidth > 0) {
|
||||
g.PushAxisAlignedClip(RectF((float)m_firstColumnWidth, 0.0f, (float)headerClipWidth, (float)m_headerHeight));
|
||||
}
|
||||
|
||||
// 绘制数据列表头
|
||||
int x = m_firstColumnWidth - m_scrollOffsetX;
|
||||
for (int i = 0; i < (int)m_columns.size(); ++i) {
|
||||
@@ -277,9 +282,14 @@ namespace ezui {
|
||||
|
||||
x += col.Width;
|
||||
}
|
||||
|
||||
if (headerClipWidth > 0) {
|
||||
g.PopAxisAlignedClip();
|
||||
}
|
||||
}
|
||||
|
||||
void TableView::DrawCells(PaintEventArgs& args) {
|
||||
auto& g = args.Graphics;
|
||||
int startY = m_headerHeight;
|
||||
|
||||
for (int row = 0; row < (int)m_data.size(); ++row) {
|
||||
@@ -295,6 +305,11 @@ namespace ezui {
|
||||
Rect firstColRect(0, rowY, m_firstColumnWidth, rowHeight);
|
||||
DrawFirstColumn(args, row, firstColRect);
|
||||
|
||||
int rowClipWidth = Width() - m_firstColumnWidth;
|
||||
if (rowClipWidth > 0) {
|
||||
g.PushAxisAlignedClip(RectF((float)m_firstColumnWidth, (float)rowY, (float)rowClipWidth, (float)rowHeight));
|
||||
}
|
||||
|
||||
// 绘制数据列
|
||||
int x = m_firstColumnWidth - m_scrollOffsetX;
|
||||
for (int col = 0; col < (int)m_columns.size(); ++col) {
|
||||
@@ -310,6 +325,10 @@ namespace ezui {
|
||||
DrawCell(args, row, col, cellRect);
|
||||
x += colWidth;
|
||||
}
|
||||
|
||||
if (rowClipWidth > 0) {
|
||||
g.PopAxisAlignedClip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user