15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CPropertySheet in DAORecordView

Patrik Ekholm -- raven@ludd.luth.se
Wednesday, August 21, 1996

Environment: VC++ 4.1, Win95

Hi all,

I saw some time ago a thread about PropertySheets as views.

The original question was about how to use a CPropertySheet
as a CFormView.

One of the conclusions was that it can be done if the
PropertySheetView is derived from CScrollView.

But I want to use PropertySheets with CDAORecordViews.
So my question(s) is:

  *  What would be the easiest way to accomplish this?
     (PropertySheets in a DAORecordView)

  *  Can it be done in the same way as with CScrollView?
  
In the thread an 4.2 example was mentioned (snapvw), but
since I just got 4.1 I'm kinda stuck there...

Is it possible to get the example somwhere on the net? 
(www.microsoft.com)
Is it legal for someone of you to mail it to me?
If so, I would appreciate it greatly...

Thanks in advance.

--
Patrik Ekholm
raven@ludd.luth.se
+46 (0)920 22 22 12

Rdev DataKonsult / MECAD
Karhusvagen 4:215
S-977 54 Lulea
Sweden



Andi Giri -- agiri@ctiis.com
Wednesday, August 28, 1996

>>Environment: VC++ 4.1, Win95
>>I saw some time ago a thread about PropertySheets as views.
>>The original question was about how to use a CPropertySheet
>>as a CFormView.

>>But I want to use PropertySheets with CDAORecordViews.
>>So my question(s) is:

>>  *  What would be the easiest way to accomplish this?
>>     (PropertySheets in a DAORecordView)

Yes.  Create ur own CPropSheetView class derived from CDAORecordView
class.
Override OnCreate() and OnInitialUpdate() as follows.

int CPropSheetView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   TRACE("[%s - %d] - CPropSheetView::OnCreate().....\n", __FILE__,
__LINE__);
   if (CFormView::OnCreate(lpCreateStruct) == -1)
      return -1;

   // Create the modeless property sheet. You should add the
   // property pages before creating the property sheet
   ASSERT(m_pPSExample1View);
   m_pPSExample1View->AddPage(&m_ViewGeneralPage);
   m_pPSExample1View->AddPage(&m_ViewDebugPage);
   m_pPSExample1View->AddPage(&m_ViewCplusPage);
   if (!m_pPSExample1View->Create(this, WS_SYSMENU | WS_CHILD |
WS_VISIBLE, 0))
   {
      return -1;
   }

   m_pPSExample1View->SetImageList(IDB_TVBMPIMG, 16, 1, RGB(255,0,0));

   CRect rectSheet, rectWindow;
   m_pPSExample1View->GetWindowRect(rectSheet);
   rectWindow = rectSheet;
   CalcWindowRect(rectWindow);

   // Adjust the positions of the frame and property sheet
   SetWindowPos(NULL, rectWindow.left,rectWindow.top, rectWindow.Width()
+ 10,
                rectWindow.Height(), SWP_NOZORDER | SWP_NOACTIVATE);

   m_pPSExample1View->SetWindowPos(NULL, 0, 0 ,rectSheet.Width(),
                rectSheet.Height(), SWP_NOZORDER | SWP_NOACTIVATE);

   return 0;
}

//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
void CPropSheetView::OnInitialUpdate()
{
   TRACE("[%s - %d] - CPropSheetView::OnInitialUpdate().....\n",
__FILE__, __LINE__);
   CFormView::OnInitialUpdate();
   GetParentFrame()->RecalcLayout();
   ResizeParentToFit(FALSE);
   ResizeParentToFit(TRUE);
}


For further details, refer to page 420 of the book "Visual C++
MasterClass"
by WROX Press.

Andi Giri




| Вернуться в корень Архива |