15,979
社区成员
发帖
与我相关
我的任务
分享
////add by jg for multi line.
CRect rect = ParentRect;
UINT nFormat = DT_WORDBREAK | DT_CALCRECT;
int nDescrHeight = dc.DrawText(str, rect, nFormat);
//end
if (nDescrHeight > m_Rect.Height())
{
((CGridCtrl*)GetParent())->SetRowHeight(m_nRow, nDescrHeight);
}
m_nFormat = DT_LEFT|DT_VCENTER/*|DT_SINGLELINE*/|DT_NOPREFIX | DT_END_ELLIPSIS; //change by jg for multi line.
CString strCurrentText = GetItemText(nRow, nCol);
if (strCurrentText != str)
{
SetItemText(nRow, nCol, str);
if (ValidateEdit(nRow, nCol, str) &&
SendMessageToParent(nRow, nCol, GVN_ENDLABELEDIT) >= 0)
{
SetModified(TRUE, nRow, nCol);
RedrawCell(nRow, nCol);
RedrawWindow();//add by jg for multi line text.
}
else
{
SetItemText(nRow, nCol, strCurrentText);
}
}
CGridCellBase* pCell = GetCell(nRow, nCol);
if (pCell)
pCell->OnEndEdit();
//add by jg for multi line.
CRect rect;
UINT nFormat = DT_WORDBREAK | DT_CALCRECT;
int nDescrHeight = dc.DrawText(str, rect, nFormat);
//end
。。。。。。。。
if (nDescrHeight > m_Rect.Height())
{
((CGridCtrl*)GetParent())->SetRowHeight(m_nRow, nDescrHeight);
}
CInPlaceEdit::CInPlaceEdit(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
int nRow, int nColumn, CString sInitText,
UINT nFirstChar)
{
m_sInitText = sInitText;
m_nRow = nRow;
m_nColumn = nColumn;
m_nLastChar = 0;
m_bExitOnArrows = (nFirstChar != VK_LBUTTON); // If mouse click brought us here,
// then no exit on arrows
m_Rect = rect; // For bizarre CE bug.
DWORD dwEditStyle = WS_BORDER|WS_CHILD|WS_VISIBLE/*| ES_AUTOHSCROLL*/ | ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL //add by jg for multiline
| dwStyle;
void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == VK_TAB/* || nChar == VK_RETURN*/) //delete by jg for multiline
{
m_nLastChar = nChar;
GetParent()->SetFocus(); // This will destroy this window
return;
}