BOOL CReportEntityPicture::FromString( const CString& str ) /* ============================================================ Function : CReportEntityPicture::FromString Description : Sets the data of the object from "str". Access : Public Return : BOOL - "TRUE" if the string represents an object of this type. Parameters : const CString& str - String to parse Usage : Call to load objects from a file. ============================================================*/ { BOOL result = FALSE; CString data( str ); if( LoadFromString( data ) ) { CTokenizer tok( data ); double borderthickness; unsigned int borderstyle; unsigned int bordercolor; CString filename; int count = 0; tok.GetAt( count++, borderthickness ); int aaa; tok.GetAt( count++, aaa ); borderstyle=aaa; tok.GetAt( count++, aaa ); bordercolor=aaa; tok.GetAt( count++, filename ); int bt = CUnitConversion::InchesToPixels( borderthickness ); SetBorderThickness( bt ); SetBorderStyle( borderstyle ); SetBorderColor( bordercolor ); UnmakeSaveString( filename ); SetFilename( filename ); int left = CUnitConversion::InchesToPixels( GetLeft() ); int right = CUnitConversion::InchesToPixels( GetRight() ); int top = CUnitConversion::InchesToPixels( GetTop() ); int bottom = CUnitConversion::InchesToPixels( GetBottom() ); CRect rect( left, top, right, bottom ); SetRect( rect ); result = TRUE; } return result; }
void CReportEntityBox::Copy( CDiagramEntity * obj ) /* ============================================================ Function : CReportEntityBox::Copy Description : Copies the data from "obj" to this object. Access : Public Return : void Parameters : CDiagramEntity * obj - Object to copy from Usage : Call to copy data from "obj" ============================================================*/ { CDiagramEntity::Copy( obj ); CReportEntityBox* copy = static_cast< CReportEntityBox* >( obj ); SetBorderThickness( copy->GetBorderThickness() ); SetBorderStyle( copy->GetBorderStyle() ); SetBorderColor( copy->GetBorderColor() ); SetFill( copy->GetFill() ); SetFillColor( copy->GetFillColor() ); }
FX_BOOL CPWL_Note_CloseBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) { m_bMouseDown = FALSE; SetBorderStyle(PBS_BEVELED); InvalidateRect(NULL); return CPWL_Button::OnLButtonUp(point,nFlag); }
FX_BOOL CPWL_Note_CloseBox::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) { SetBorderStyle(PBS_INSET); InvalidateRect(NULL); m_bMouseDown = TRUE; return CPWL_Button::OnLButtonDown(point,nFlag); }
void CReportEntityBox::Serialize(CArchive& ar) { typedef struct { int a_f; int b_f; } BOX_RESERVE_FIELDS; BOX_RESERVE_FIELDS box_reserve; memset(&box_reserve,0,sizeof(BOX_RESERVE_FIELDS)); CDiagramEntity::Serialize(ar); if (ar.IsStoring()) { // —охран¤ем double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() ); ar.Write(&thickness,sizeof(double)); unsigned int bst = GetBorderStyle( ); ar.Write(&bst,sizeof(unsigned int)); unsigned int brC = GetBorderColor( ); ar.Write(&brC,sizeof(unsigned int)); BOOL gf = GetFill(); ar.Write(&gf, sizeof(BOOL)); brC = GetFillColor(); ar.Write(&brC,sizeof(unsigned int)); ar.Write(&box_reserve,sizeof(BOX_RESERVE_FIELDS)); } else { // „итаем double bordhickness; ar.Read(&bordhickness,sizeof(double)); unsigned int bordst; ar.Read(&bordst,sizeof(unsigned int)); unsigned int linecolor; ar.Read(&linecolor,sizeof(unsigned int)); BOOL fil; ar.Read(&fil,sizeof(BOOL)); unsigned int filcolor; ar.Read(&filcolor,sizeof(unsigned int)); ar.Read(&box_reserve,sizeof(BOX_RESERVE_FIELDS)); int bt = CUnitConversion::InchesToPixels( bordhickness ); SetBorderThickness( bt ); SetBorderStyle( bordst ); SetBorderColor( linecolor ); SetFill( fil ); SetFillColor( filcolor ); } }
void CReportEntityPicture::Copy( CDiagramEntity * obj ) /* ============================================================ Function : CReportEntityPicture::Copy Description : Copies data from "obj" to this object. Access : Public Return : void Parameters : CDiagramEntity * obj - Object to copy from Usage : Call to copy data from "obj" to this object. ============================================================*/ { CDiagramEntity::Copy( obj ); CReportEntityPicture* copy = static_cast< CReportEntityPicture* >( obj ); SetBorderThickness( copy->GetBorderThickness() ); SetBorderStyle( copy->GetBorderStyle() ); SetBorderColor( copy->GetBorderColor() ); SetFilename( copy->GetFilename() ); if( m_bitmap ) delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; if (m_image_bits) delete[] m_image_bits; m_image_bits = NULL; if (copy->m_image_size>0 && copy->m_image_bits) { m_image_type = copy->m_image_type; m_image_size = copy->m_image_size; m_image_bits = new BYTE[m_image_size]; memcpy(m_image_bits,copy->m_image_bits,m_image_size); m_bitmap = new CxImage(m_image_bits,m_image_size,m_image_type); if (!m_bitmap->IsValid()) { AfxMessageBox(m_bitmap->GetLastError()); delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; delete[] m_image_bits; m_image_bits = NULL; ASSERT(0); return; } } }
void CTesthelpCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& /*rcInvalid*/) { // Drawing code, mostly plagiarized from the Circ MFC sample. // The only thing done here is setting the border and drawing text // specified by our name properties in the control's client area. if(!GetBorderStyle()) //Control will always have a border. SetBorderStyle(TRUE); // Set up variables to use for drawing text background. // Use our current BackColor for the background color. CBrush* pOldBrush; CBrush bkBrush(TranslateColor(GetBackColor())); CPen* pOldPen; CRect rc = rcBounds; CFont* pOldFont; // Set up background mode and text color. Use the // current ForeColor for the text color. pdc->SetTextColor(TranslateColor(GetForeColor())); pdc->SetBkMode(TRANSPARENT); // Fill our window with the current BackColor pdc->FillRect(rcBounds, &bkBrush); // Save off the existing brush and pen so they // can be restored when we're done. pOldBrush = pdc->SelectObject(&bkBrush); pOldPen = (CPen*)pdc->SelectStockObject(BLACK_PEN); // Save off the current font so we can restore it and // select our current stock font into this DC pOldFont = SelectStockFont(pdc); // Draw the text on our window pdc->ExtTextOut(rc.left+10, rc.top +2, ETO_CLIPPED, rc, m_szName1, m_szName1.GetLength(), NULL); pdc->ExtTextOut(rc.left+10, rc.top +22, ETO_CLIPPED, rc, m_szName2, m_szName2.GetLength(), NULL); pdc->ExtTextOut(rc.left+10, rc.top +42, ETO_CLIPPED, rc, m_szName3, m_szName3.GetLength(), NULL); // Restore our DC to it's original state. pdc->SelectObject(pOldFont); pdc->SelectObject(pOldPen); pdc->SelectObject(pOldBrush); }
void QGraph::LoadSettings(QSettings *pSettings) { int k; QString FontName; QFont lgft; bool bs, ba; int s,w; int r,g,b; double f; pSettings->beginGroup(m_GraphName); { //read variables r = pSettings->value("AxisColorRed",255).toInt(); g = pSettings->value("AxisColorGreen",255).toInt(); b = pSettings->value("AxisColorBlue",255).toInt(); SetAxisColor(QColor(r,g,b)); k = pSettings->value("AxisStyle",0).toInt(); SetAxisStyle(k); k = pSettings->value("AxisWidth",1).toInt(); SetAxisWidth(k); r = pSettings->value("TitleColorRed",255).toInt(); g = pSettings->value("TitleColorGreen",255).toInt(); b = pSettings->value("TitleColorBlue",255).toInt(); SetTitleColor(QColor(r,g,b)); r = pSettings->value("LabelColorRed",255).toInt(); g = pSettings->value("LabelColorGreen",255).toInt(); b = pSettings->value("LabelColorBlue",255).toInt(); SetLabelColor(QColor(r,g,b)); FontName = pSettings->value("TitleFontName","Comic Sans MS").toString(); lgft.setFamily(FontName); lgft.setPointSize(pSettings->value("TitleFontSize",8).toInt()); SetTitleLogFont(&lgft); FontName = pSettings->value("LabelFontName","Comic Sans MS").toString(); lgft.setFamily(FontName); lgft.setPointSize(pSettings->value("LabelFontSize",8).toInt()); SetLabelLogFont(&lgft); r = pSettings->value("XMajGridColorRed",90).toInt(); g = pSettings->value("XMajGridColorGreen",90).toInt(); b = pSettings->value("XMajGridColorBlue",90).toInt(); bs = pSettings->value("XMajGridShow",true).toBool(); s = pSettings->value("XMajGridStyle",1).toInt(); w = pSettings->value("XMajGridWidth",1).toInt(); SetXMajGrid(bs,QColor(r,g,b),s,w); r = pSettings->value("YMajGridColorRed",90).toInt(); g = pSettings->value("YMajGridColorGreen",90).toInt(); b = pSettings->value("YMajGridColorBlue",90).toInt(); bs = pSettings->value("YMajGridShow",true).toBool(); s = pSettings->value("YMajGridStyle",1).toInt(); w = pSettings->value("YMajGridWidth",1).toInt(); SetYMajGrid(bs,QColor(r,g,b),s,w); r = pSettings->value("XMinGridColorRed",50).toInt(); g = pSettings->value("XMinGridColorGreen",50).toInt(); b = pSettings->value("XMinGridColorBlue",50).toInt(); ba = pSettings->value("XMinGridAuto",true).toBool(); bs = pSettings->value("XMinGridShow",false).toBool(); s = pSettings->value("XMinGridStyle",2).toInt(); w = pSettings->value("XMinGridWidth",1).toInt(); f = pSettings->value("XMinGridUnit", 0.01).toDouble(); SetXMinGrid(bs,ba,QColor(r,g,b),s,w,f); r = pSettings->value("YMinGridColorRed",50).toInt(); g = pSettings->value("YMinGridColorGreen",50).toInt(); b = pSettings->value("YMinGridColorBlue",50).toInt(); ba = pSettings->value("YMinGridAuto",true).toBool(); bs = pSettings->value("YMinGridShow",false).toBool(); s = pSettings->value("YMinGridStyle",2).toInt(); w = pSettings->value("YMinGridWidth",1).toInt(); f = pSettings->value("YMinGridUnit",0.01).toDouble(); SetYMinGrid(bs,ba,QColor(r,g,b),s,w,f); r = pSettings->value("BorderColorRed",200).toInt(); g = pSettings->value("BorderColorGreen",200).toInt(); b = pSettings->value("BorderColorBlue",200).toInt(); s = pSettings->value("BorderStyle",0).toInt(); w = pSettings->value("BorderWidth",2).toInt(); m_bBorder = pSettings->value("BorderShow", true).toBool(); SetBorderColor(QColor(r,g,b)); SetBorderStyle(s); SetBorderWidth(w); r = pSettings->value("BackColorRed",0).toInt(); g = pSettings->value("BackColorGreen",20).toInt(); b = pSettings->value("BackColorBlue",20).toInt(); SetBkColor(QColor(r,g,b)); m_bYInverted = pSettings->value("Inverted", false).toBool(); m_X = pSettings->value("XVariable",1).toInt(); m_Y = pSettings->value("YVariable",0).toInt(); } pSettings->endGroup(); }
void CControlUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { // ÊÇ·ñÑùʽ±í if(m_pManager != NULL) { LPCTSTR pStyle = m_pManager->GetStyle(pstrValue); if( pStyle != NULL) { ApplyAttributeList(pStyle); return; } } if( _tcsicmp(pstrName, _T("pos")) == 0 ) { RECT rcPos = { 0 }; LPTSTR pstr = NULL; rcPos.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rcPos.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPos.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPos.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SIZE szXY = {rcPos.left >= 0 ? rcPos.left : rcPos.right, rcPos.top >= 0 ? rcPos.top : rcPos.bottom}; SetFixedXY(szXY); SetFixedWidth(rcPos.right - rcPos.left); SetFixedHeight(rcPos.bottom - rcPos.top); } else if( _tcsicmp(pstrName, _T("float")) == 0 ) { CDuiString nValue = pstrValue; // ¶¯Ì¬¼ÆËãÏà¶Ô±ÈÀý if(nValue.Find(',') < 0) { SetFloat(_tcsicmp(pstrValue, _T("true")) == 0); } else { TPercentInfo piFloatPercent = { 0 }; LPTSTR pstr = NULL; piFloatPercent.left = _tcstod(pstrValue, &pstr); ASSERT(pstr); piFloatPercent.top = _tcstod(pstr + 1, &pstr); ASSERT(pstr); piFloatPercent.right = _tcstod(pstr + 1, &pstr); ASSERT(pstr); piFloatPercent.bottom = _tcstod(pstr + 1, &pstr); ASSERT(pstr); SetFloatPercent(piFloatPercent); SetFloat(true); } } else if( _tcsicmp(pstrName, _T("padding")) == 0 ) { RECT rcPadding = { 0 }; LPTSTR pstr = NULL; rcPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rcPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SetPadding(rcPadding); } else if( _tcsicmp(pstrName, _T("bkcolor")) == 0 || _tcsicmp(pstrName, _T("bkcolor1")) == 0 ) { while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue); if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetBkColor(clrColor); } else if( _tcsicmp(pstrName, _T("bkcolor2")) == 0 ) { while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue); if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetBkColor2(clrColor); } else if( _tcsicmp(pstrName, _T("bkcolor3")) == 0 ) { while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue); if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetBkColor3(clrColor); } else if( _tcsicmp(pstrName, _T("forecolor")) == 0 ) { while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue); if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetForeColor(clrColor); } else if( _tcsicmp(pstrName, _T("bordercolor")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetBorderColor(clrColor); } else if( _tcsicmp(pstrName, _T("focusbordercolor")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetFocusBorderColor(clrColor); } else if( _tcsicmp(pstrName, _T("colorhsl")) == 0 ) SetColorHSL(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("bordersize")) == 0 ) { CDuiString nValue = pstrValue; if(nValue.Find(',') < 0) { SetBorderSize(_ttoi(pstrValue)); RECT rcPadding = {0}; SetBorderSize(rcPadding); } else { RECT rcPadding = { 0 }; LPTSTR pstr = NULL; rcPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rcPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SetBorderSize(rcPadding); } } else if( _tcsicmp(pstrName, _T("leftbordersize")) == 0 ) SetLeftBorderSize(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("topbordersize")) == 0 ) SetTopBorderSize(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("rightbordersize")) == 0 ) SetRightBorderSize(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("bottombordersize")) == 0 ) SetBottomBorderSize(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("borderstyle")) == 0 ) SetBorderStyle(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("borderround")) == 0 ) { SIZE cxyRound = { 0 }; LPTSTR pstr = NULL; cxyRound.cx = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); cxyRound.cy = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SetBorderRound(cxyRound); } else if( _tcsicmp(pstrName, _T("bkimage")) == 0 ) SetBkImage(pstrValue); else if( _tcsicmp(pstrName, _T("foreimage")) == 0 ) SetForeImage(pstrValue); else if( _tcsicmp(pstrName, _T("width")) == 0 ) SetFixedWidth(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("height")) == 0 ) SetFixedHeight(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("minwidth")) == 0 ) SetMinWidth(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("minheight")) == 0 ) SetMinHeight(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("maxwidth")) == 0 ) SetMaxWidth(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("maxheight")) == 0 ) SetMaxHeight(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("name")) == 0 ) SetName(pstrValue); else if( _tcsicmp(pstrName, _T("drag")) == 0 ) SetDragEnable(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("drop")) == 0 ) SetDropEnable(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("resourcetext")) == 0 ) SetResourceText(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("text")) == 0 ) SetText(pstrValue); else if( _tcsicmp(pstrName, _T("tooltip")) == 0 ) SetToolTip(pstrValue); else if( _tcsicmp(pstrName, _T("userdata")) == 0 ) SetUserData(pstrValue); else if( _tcsicmp(pstrName, _T("enabled")) == 0 ) SetEnabled(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("mouse")) == 0 ) SetMouseEnabled(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("keyboard")) == 0 ) SetKeyboardEnabled(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("visible")) == 0 ) SetVisible(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("float")) == 0 ) SetFloat(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("shortcut")) == 0 ) SetShortcut(pstrValue[0]); else if( _tcsicmp(pstrName, _T("menu")) == 0 ) SetContextMenuUsed(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("cursor")) == 0 && pstrValue) { if( _tcsicmp(pstrValue, _T("arrow")) == 0 ) SetCursor(DUI_ARROW); else if( _tcsicmp(pstrValue, _T("ibeam")) == 0 ) SetCursor(DUI_IBEAM); else if( _tcsicmp(pstrValue, _T("wait")) == 0 ) SetCursor(DUI_WAIT); else if( _tcsicmp(pstrValue, _T("cross")) == 0 ) SetCursor(DUI_CROSS); else if( _tcsicmp(pstrValue, _T("uparrow")) == 0 ) SetCursor(DUI_UPARROW); else if( _tcsicmp(pstrValue, _T("size")) == 0 ) SetCursor(DUI_SIZE); else if( _tcsicmp(pstrValue, _T("icon")) == 0 ) SetCursor(DUI_ICON); else if( _tcsicmp(pstrValue, _T("sizenwse")) == 0 ) SetCursor(DUI_SIZENWSE); else if( _tcsicmp(pstrValue, _T("sizenesw")) == 0 ) SetCursor(DUI_SIZENESW); else if( _tcsicmp(pstrValue, _T("sizewe")) == 0 ) SetCursor(DUI_SIZEWE); else if( _tcsicmp(pstrValue, _T("sizens")) == 0 ) SetCursor(DUI_SIZENS); else if( _tcsicmp(pstrValue, _T("sizeall")) == 0 ) SetCursor(DUI_SIZEALL); else if( _tcsicmp(pstrValue, _T("no")) == 0 ) SetCursor(DUI_NO); else if( _tcsicmp(pstrValue, _T("hand")) == 0 ) SetCursor(DUI_HAND); } else if( _tcsicmp(pstrName, _T("virtualwnd")) == 0 ) SetVirtualWnd(pstrValue); else if( _tcsicmp(pstrName, _T("innerstyle")) == 0 ) { CDuiString sXmlData = pstrValue; sXmlData.Replace(_T("""), _T("\"")); LPCTSTR pstrList = sXmlData.GetData(); CDuiString sItem; CDuiString sValue; while( *pstrList != _T('\0') ) { sItem.Empty(); sValue.Empty(); while( *pstrList != _T('\0') && *pstrList != _T('=') ) { LPTSTR pstrTemp = ::CharNext(pstrList); while( pstrList < pstrTemp) { sItem += *pstrList++; } } ASSERT( *pstrList == _T('=') ); if( *pstrList++ != _T('=') ) return; ASSERT( *pstrList == _T('\"') ); if( *pstrList++ != _T('\"') ) return; while( *pstrList != _T('\0') && *pstrList != _T('\"') ) { LPTSTR pstrTemp = ::CharNext(pstrList); while( pstrList < pstrTemp) { sValue += *pstrList++; } } ASSERT( *pstrList == _T('\"') ); if( *pstrList++ != _T('\"') ) return; SetAttribute(sItem, sValue); if( *pstrList++ != _T(' ') && *pstrList++ != _T(',') ) return; } } }
void CReportEntityPicture::Serialize(CArchive& ar) { typedef struct { int a_f; int b_f; int c_f; int d_f; } PIC_RESERVE_FIELDS; PIC_RESERVE_FIELDS pic_reserve; memset(&pic_reserve,0,sizeof(PIC_RESERVE_FIELDS)); CDiagramEntity::Serialize(ar); if (ar.IsStoring()) { // —охран¤ем double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() ); ar.Write(&thickness,sizeof(double)); unsigned int bst = GetBorderStyle( ); ar.Write(&bst,sizeof(unsigned int)); unsigned int brC = GetBorderColor( ); ar.Write(&brC,sizeof(unsigned int )); ar.Write(&pic_reserve,sizeof(PIC_RESERVE_FIELDS)); if (m_image_size>0 && m_image_bits) { ar.Write(&m_image_type,sizeof(int)); ar.Write(&m_image_size,sizeof(unsigned int)); ar.Write(m_image_bits,sizeof(BYTE)*m_image_size); } } else { // „итаем double bordhickness; ar.Read(&bordhickness,sizeof(double)); unsigned int bordst; ar.Read(&bordst,sizeof(unsigned int )); unsigned int linecolor; ar.Read(&linecolor,sizeof(unsigned int )); ar.Read(&pic_reserve,sizeof(PIC_RESERVE_FIELDS)); int bt = CUnitConversion::InchesToPixels( bordhickness ); SetBorderThickness( bt ); SetBorderStyle( bordst ); SetBorderColor( linecolor ); if( m_bitmap ) delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; if (m_image_bits) delete[] m_image_bits; m_image_bits = NULL; ar.Read(&m_image_type,sizeof(int)); ar.Read(&m_image_size,sizeof(unsigned int)); if (m_image_size==0) return; try { m_image_bits = new BYTE[m_image_size]; } catch (std::bad_alloc) { AfxMessageBox("bad_alloc exception in Serialize function"); ASSERT(0); return; } if (ar.Read(m_image_bits,m_image_size*sizeof(BYTE))!=m_image_size*sizeof(BYTE)) { delete[] m_image_bits; m_image_bits=NULL; m_image_type = -1; m_image_size = 0; ASSERT(0); return; } m_bitmap = new CxImage(m_image_bits, m_image_size, m_image_type); if (!m_bitmap->IsValid()) { AfxMessageBox(m_bitmap->GetLastError()); delete m_bitmap; m_bitmap = NULL; delete[] m_image_bits; m_image_bits=NULL; m_image_type = -1; m_image_size = 0; ASSERT(0); return; } } }