void CXTPPropertyGridItemFont::OnInplaceButtonDown(CXTPPropertyGridInplaceButton* pButton) { if (m_pGrid->SendNotifyMessage(XTP_PGN_INPLACEBUTTONDOWN, (LPARAM)pButton) == TRUE) return; if (!OnRequestEdit()) return; InternalAddRef(); CFontDialog dlg(&m_lfValue, CF_EFFECTS | CF_SCREENFONTS, NULL, m_pGrid); if (m_clrValue == (COLORREF)-1) { dlg.m_cf.lpfnHook = FontDlgProc; } else { dlg.m_cf.rgbColors = m_clrValue; } if (dlg.DoModal() == IDOK) { LOGFONT lf; dlg.GetCurrentFont(&lf); CString strValue = FontToString(lf); if (OnAfterEdit(strValue)) { SetFont(lf); if (m_clrValue != (COLORREF)-1) m_clrValue = dlg.GetColor(); OnValueChanged(strValue); SAFE_INVALIDATE(m_pGrid); } } else { OnCancelEdit(); } InternalRelease(); }
void CThumbEditor::SaveParams() { if(FrameColor.IsWindowEnabled()) thumb_->setColor("FrameColor", COLORREF2RGB(FrameColor.GetColor())); if(Color1.IsWindowEnabled()) thumb_->setColor("GradientColor1", COLORREF2RGB(Color1.GetColor())); if(ThumbTextColor.IsWindowEnabled()) thumb_->setColor("TextColor", COLORREF2RGB(ThumbTextColor.GetColor())); if(StrokeColor.IsWindowEnabled()) thumb_->setColor("StrokeColor", COLORREF2RGB(StrokeColor.GetColor())); if(Color2.IsWindowEnabled()) thumb_->setColor("GradientColor2", COLORREF2RGB(Color2.GetColor())); if(thumb_->existsParam("DrawFrame")) { bool DrawFrame = SendDlgItemMessage(IDC_DRAWFRAME, BM_GETCHECK)!=0; thumb_->setParam("DrawFrame", DrawFrame); } if(thumb_->existsParam("FrameWidth")) thumb_->setParam("FrameWidth", GetDlgItemInt(IDC_FRAMEWIDTH)); CString text = GuiTools::GetWindowText(GetDlgItem(IDC_THUMBTEXT)); bool AddText = SendDlgItemMessage(IDC_ADDFILESIZE, BM_GETCHECK)!=0; thumb_->setParamString("Text", WCstringToUtf8(text)); if(thumb_->existsParam("DrawText")) thumb_->setParam("DrawText", AddText); //if(thumb_->existsParam("Font")) { CString res; FontToString(&ThumbFont, res); thumb_->setParamString("Font", WCstringToUtf8(res)); } }
/* LOGFONT serialization support */ inline std::string myToString(const LOGFONT& value) { CString res; FontToString( &value, res ); return WCstringToUtf8(res); }
void CXTPPropertyGridItemFont::SetFont(LOGFONT& font) { MEMCPY_S(&m_lfValue, &font, sizeof(LOGFONT)); m_strValue = FontToString(m_lfValue); }