|
Can't the same instructions be followed in 2.25?
Andrew
|
|
|
|
|
Hi,
If i have text in cell (1,1) and i merged cells (1,1,1,7)
and when my text is too big for cell (1,1) AutoSize function resizes my (1,1) cells, but my text isn't too big for merged cells (1,1,1,7) (i mean there is a lot of place in whole row which is merged as one cells)$;
Better for me would be AutoSize also for merge cells.
Hmm, i will try to draw mky problem;
I have :
|______|_____|
|MyBigText___| <-this one is merged
After using AutoSize i have
|_________|_____|
|MyBigText______|
Column number 0 shouldn't be resized
// ___ means spacebar
Somebody helps me?
Thanks a lot.
//I hope i will be understood
df
|
|
|
|
|
Using the grid control to print, you may see that the last line of the grid can't be show. After several hours of debuging, I found it will be OK only if you chang "white_rect.top=range.bottom + 1;" to "white_rect.top=range.bottom + 2;" in function--void CGridCtrl::OnPrint(CDC *pDC, CPrintInfo *pInfo), good lucky!
|
|
|
|
|
Hi,
can anyone send me the zip file.
I cannot download it.
Thanks & Regards
Manju
|
|
|
|
|
When I use the virtual mode and merge some cells, it seems that the callback-funktion never called again!?
|
|
|
|
|
What about simple word wrapping support for the grid control?
|
|
|
|
|
m_pGridCtrl->SetItemFormat(2,0, DT_WORDBREAK);
|
|
|
|
|
I will have to try this. But my other concern is for when the grid is printed out. The widths of the columns need to be proportional to the printer so that what I see on screen is the same as the printer. I don't want it the other way round where the printer does what teh screen shows. This way I ensure it will fit on the printer one page wide.
Not sure how to accomplish that with a grid in a doc/view framework...
|
|
|
|
|
Please if anyone knows how to make tree cells and merged cells works on the same grid tell me how.
Thanks in advance,
Rafael Melo
|
|
|
|
|
Firstly,thank Huang Wei for this usefull Merge Cells GridControl!
Now I use several GridControls in a Document/View application, how can I print it? The gridCpntrol seems can only print one of them.
|
|
|
|
|
who can send me one?
thanks!
liuxing2001@hotmail.com
|
|
|
|
|
I aplly your modification to 2.25Version,It seem not work.
|
|
|
|
|
Well it works for me. I added fix by shawkins (no border lines during selection). If somebody wants the code send me an email.
Gezo
|
|
|
|
|
I am looking for a 2.25 with any bugs fixed that include merge cells support. Can you email this to me please?
|
|
|
|
|
I am looking for a 2.25 with any bugs fixed that include merge cells support. Can you email this to me please?
|
|
|
|
|
I am looking for a 2.25 with any bugs fixed that include merge cells support. Can you email this to me please?
homerhuang
|
|
|
|
|
I have modified it in 2.25 version as you doing in 2.24,and it works very well. Thank you very much for your working!
|
|
|
|
|
Use the Sample Application providd with the Grid View with Merge Cell Support.
Scroll to the right so that part of the merged cell is only viewable. Then minimize and maximise the girdview(Gridvi1). The merged cell is shown in the background . What may be the problem Help?
|
|
|
|
|
I had the same problem when I scrolled verticaly. The two bugs are identical so what I have done for my problem can be easily adapted for yours.
In the GridCtrl.cpp file, search for the OnDraw function. Then inside of this function, we have a part commented as :
// draw rest of non-fixed cells"
Inside this block of code, begining with
<br />
rect.bottom = nFixedRowHeight-1;<br />
for (row = minVisibleRow; row <= maxVisibleRow; row++)<br />
You will find the following line :
<br />
if(!pCell->IsMergeWithOthers())<br />
Replace it by :
<br />
if(!pCell->IsMergeWithOthers() || row == minVisibleRow )<br />
One of the next lines is :
<br />
pCell->Draw(pDC, row, col, rect, FALSE);<br />
Replace it by :
<br />
if( row == minVisibleRow && pCell->IsMergeWithOthers())<br />
pCell->KLDraw(pDC, row, col, rect, FALSE);<br />
else<br />
pCell->Draw(pDC, row, col, rect, FALSE);<br />
Where KLDraw is exactly the same as the Draw function but without the lines :
<br />
if(m_Hide && !IsMerged())<br />
{<br />
return TRUE;<br />
}<br />
That works for me and solve my problem with the vertical scroll and the resize of the grid.
Minimum changes should be made to solve the same problem with the horizontal croll.
|
|
|
|
|
This is only informtation for those who have the same problem.
I solve it by small changing function
void CGridCtrl::PrintColumnHeadings(CDC *pDC, CPrintInfo* /*pInfo*/)
Main loop I change from:
for (int row = 0; row < GetFixedRowCount(); row++)
to:
for (int row = 0; row < GetRowCount(); row++)
Maybe it isn't "neat" and it is worth to fix it in next version.
Wojtek
|
|
|
|
|
the upper method has bug on printing more pages!!
I solved the problem accurately by changing function
void CGridCtrl::PrintRowButtons(CDC *pDC, CPrintInfo* /*pInfo*/)
removed this code:
<br />
replace by these codes:
<br />
if (pCell)<br />
{<br />
if(!pCell->IsMerged())<br />
{<br />
if(!pCell->IsMergeWithOthers())<br />
{<br />
pCell->PrintCell(pDC, iRow, iCol, rect);<br />
}<br />
}<br />
else<br />
{<br />
CRect mergerect=rect;<br />
if(GetCellRangeRect(pCell->m_MergeRange,&mergerect))<br />
{<br />
mergerect.OffsetRect(rect.TopLeft()-mergerect.TopLeft());<br />
pCell->PrintCell(pDC, iRow, iCol, mergerect);<br />
}<br />
}<br />
}<br />
yuhonggang
|
|
|
|
|
I tried your solution, but the problem is still there.
void CGridCtrl::PrintRowButtons(CDC *pDC, CPrintInfo* /*pInfo*/)
{
CFont *pOldFont = pDC->SelectObject(&m_PrinterFont);
CRect rect;
rect.right = -1;
BOOL bFirst = TRUE;
for( int iCol = 0; iCol < GetFixedColumnCount(); iCol++)
{
rect.left = rect.right+1;
rect.right = rect.left
+ GetColumnWidth( iCol)
- 1;
rect.bottom = -1;
for( int iRow = m_nCurrPrintRow; iRow < GetRowCount(); iRow++)
{
rect.top = rect.bottom+1;
rect.bottom = rect.top + GetRowHeight( iRow) - 1;
if( rect.bottom > m_nPageHeight)
break;
CGridCellBase* pCell = GetCell(iRow, iCol);
if (pCell)
{
//Used for merge cells
if(!pCell->IsMerged())
{
if(!pCell->IsMergeWithOthers())
{
pCell->PrintCell(pDC, iRow, iCol, rect);
}
}
else
{
CRect mergerect=rect;
if(GetCellRangeRect(pCell->m_MergeRange,&mergerect))
{
mergerect.OffsetRect(rect.TopLeft()-mergerect.TopLeft());
pCell->PrintCell(pDC, iRow, iCol, mergerect);
}
}
}
}
}
pDC->SelectObject(pOldFont);
}
Cui Sheng
|
|
|
|
|
When a new color is applied to a cell, the new color covers the bottom and right grid lines around the cell which looks very ugly. I tried Chris Maunder's original version and this did not happen on his version but I need the merge features. Any ideas on how to fix this problem?
Cheers.
|
|
|
|
|
Here is my fix to the problem not showing grid lines when changing cell colors:
In the function CGridCtrl::OnDraw:
1. I removed the following lines:
if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT)
{
int x = nFixedColWidth;
for (col = minVisibleCol; col <= maxVisibleCol; col++)
{
if (GetColumnWidth(col) <= 0) continue;
x += GetColumnWidth(col);
pDC->MoveTo(x-1, nFixedRowHeight);
pDC->LineTo(x-1, VisRect.bottom);
}
}
if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ)
{
int y = nFixedRowHeight;
for (row = minVisibleRow; row <= maxVisibleRow; row++)
{
if (GetRowHeight(row) <= 0) continue;
y += GetRowHeight(row);
pDC->MoveTo(nFixedColWidth, y-1);
pDC->LineTo(VisRect.right, y-1);
}
}
pDC->SelectStockObject(NULL_PEN);
2. I added lines in the following block marked by a <==Add:
if(!pCell->IsMerged())
{
if(!pCell->IsMergeWithOthers())
{
CRect rtNonMerge = rect; <==Add
rtNonMerge.DeflateRect(0,0,1,1); <==Add
pCell->SetCoords(row,col);
pCell->Draw(pDC, row, col, rect, FALSE);
if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT) <==Add
{ <==Add
pDC->MoveTo(rtNonMerge.right+1, rtNonMerge.top); <==Add
pDC->LineTo(rtNonMerge.right+1, rtNonMerge.bottom+1); <==Add
} <==Add
if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ) <==Add
{ <==Add
pDC->MoveTo(rtNonMerge.left, rtNonMerge.bottom+1); <==Add
pDC->LineTo(rtNonMerge.right+1, rtNonMerge.bottom+1); <==Add
} <==Add
}
else
{
CGridCellBase* pMergedCell=GetCell(pCell->GetMergeCellID());
CRect mergerect=rect;
if(GetCellRangeRect(pMergedCell->m_MergeRange,&mergerect))
{
mergerect.DeflateRect(0,0,1,1);
pMergedCell->SetCoords(pCell->GetMergeCellID().row,pCell->GetMergeCellID().col);
pMergedCell->Draw(pDC, pCell->GetMergeCellID().row,pCell->GetMergeCellID().col, mergerect, TRUE);
if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT) <==Add
{ <==Add
pDC->MoveTo(mergerect.right+1, mergerect.top); <==Add
pDC->LineTo(mergerect.right+1, mergerect.bottom+1); <==Add
} <==Add
if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ) <==Add
{ <==Add
pDC->MoveTo(mergerect.left, mergerect.bottom+1); <==Add
pDC->LineTo(mergerect.right+1, mergerect.bottom+1); <==Add
} <==Add
}
}
}
else
{
CRect mergerect=rect;
if(GetCellRangeRect(pCell->m_MergeRange,&mergerect))
{
mergerect.DeflateRect(0,0,1,1);
pCell->SetCoords(row,col);
pCell->Draw(pDC, row, col, mergerect, TRUE);
if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT) <==Add
{ <==Add
pDC->MoveTo(mergerect.right+1, mergerect.top); <==Add
pDC->LineTo(mergerect.right+1, mergerect.bottom+1); <==Add
} <==Add
if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ) <==Add
{ <==Add
pDC->MoveTo(mergerect.left, mergerect.bottom+1); <==Add
pDC->LineTo(mergerect.right+1, mergerect.bottom+1); <==Add
} <==Add
}
}
3. Finally, I added the following line:
pDC->SelectStockObject(NULL_PEN); before
Hope this helps.
|
|
|
|
|
Great fix! Works really good, thanks a lot!
|
|
|
|
|