Exemplo n.º 1
0
            public void CreateNewView(PDFXEdit.IPXV_View pParentView, PDFXEdit.IUIX_Obj pParentObj, int nViewID, string sCustomTag, ref PDFXEdit.tagRECT stPos, out PDFXEdit.IPXV_View pNewView)
            {
                pNewView = null;
                if ((pParentView == null) || (pParentObj == null) || (nViewID == 0))
                {
                    throw new System.ArgumentException();
                }
                string sID = Inst.ID2Str(nViewID);

                if (sID.Length == 0)
                {
                    throw new System.ArgumentException();
                }
                PDFXEdit.IPXV_DocumentView docView = pParentView as PDFXEdit.IPXV_DocumentView;
                PDFXEdit.IPXV_MainView     mainView;
                if (docView == null)
                {
                    mainView = pParentView as PDFXEdit.IPXV_MainView;
                }
                if (sID == m_sCustomPaneID)
                {
                    PDFXEdit.IUIX_Inst uiInst = (PDFXEdit.IUIX_Inst)Inst.GetExtension("UIX");

                    CustomView CV = new CustomView(nViewID, m_frm.userControl11);

                    PDFXEdit.UIX_CreateObjParams cp = new PDFXEdit.UIX_CreateObjParams();
                    cp.pImpl        = CV as PDFXEdit.IUIX_ObjImpl;
                    cp.pParent      = pParentObj;
                    cp.nCreateFlags = (int)PDFXEdit.UIX_CreateObjFlags.UIX_CreateObj_Windowed | (int)PDFXEdit.UIX_CreateObjFlags.UIX_CreateObj_TouchWindow;
                    cp.pID          = sID;
                    cp.nStdClass    = (int)PDFXEdit.UIX_StdClasses.UIX_StdClass_Blank;                  //For this sample we will create a Property Pane class View
                    cp.nObjStyle    = uiInst.MakeObjStyle((int)PDFXEdit.UIX_ObjStyleFlags.UIX_ObjStyle_NoBorder);
                    cp.rc           = stPos;
                    // create UI-object
                    PDFXEdit.IUIX_Obj newView = null;
                    uiInst.CreateScrollableObj(cp, (long)PDFXEdit.UIX_ScrollStyleFlags.UIX_ScrollStyle_Vert, out newView);

                    UIX_CreateObjParams cp2 = new PDFXEdit.UIX_CreateObjParams();
                    cp2.nStdClass  = (int)PDFXEdit.UIX_StdClasses.UIX_StdClass_Blank;
                    cp2.hWndParent = CV.Obj.WndHandle;
                    cp2.hWnd       = Convert.ToUInt32(CV.userControl.Handle.ToInt64());
                    cp2.nObjStyle  = uiInst.MakeObjStyle(0, (int)PDFXEdit.UIX_ObjStyleExFlags.UIX_ObjStyleEx_SimpleWndWrapper);
                    cp2.rc         = stPos;
                    IUIX_Obj parentBase = uiInst.CreateObj(ref cp2);

                    pNewView = CV;

                    //long idHwnd = Convert.ToInt64(parentBase.WndHandle);
                    //long idHwnd = Convert.ToInt64(pParentView.Obj.WndHandle);
                    //IntPtr ptr = new IntPtr(idHwnd);
                    //long idTest = ptr.ToInt64();
                    //Control cls1 = Control.FromChildHandle(ptr);
                    //Control cls2 = Control.FromHandle(ptr);
                }
            }
            public void CreateNewView(PDFXEdit.IPXV_View pParentView, PDFXEdit.IUIX_Obj pParentObj, int nViewID, string sCustomTag, ref PDFXEdit.tagRECT stPos, out PDFXEdit.IPXV_View pNewView)
            {
                pNewView = null;
                if ((pParentView == null) || (pParentObj == null) || (nViewID == 0))
                {
                    throw new System.ArgumentException();
                }

                PDFXEdit.IPXV_DocumentView docView  = null;
                PDFXEdit.IPXV_MainView     mainView = null;
                if (nViewID == m_frm.nMY_PANE_ID)
                {
                    mainView = pParentView as PDFXEdit.IPXV_MainView;
                    if (mainView == null)
                    {
                        throw new System.ArgumentException();
                    }
                }
                else if (nViewID == m_frm.nMY_DOC_PANE_ID)
                {
                    docView = pParentView as PDFXEdit.IPXV_DocumentView;
                    if (docView == null)
                    {
                        throw new System.ArgumentException();
                    }
                }
                else
                {
                    throw new System.ArgumentException();
                }

                UserControl1        userCtrl  = new UserControl1();
                CustomPaneContainer container = new CustomPaneContainer(pParentView, nViewID, userCtrl);

                PDFXEdit.IUIX_Inst uiInst = (PDFXEdit.IUIX_Inst)Inst.GetExtension("UIX");

                PDFXEdit.UIX_CreateObjParams cp = new PDFXEdit.UIX_CreateObjParams();
                cp.pImpl        = container as PDFXEdit.IUIX_ObjImpl;
                cp.pParent      = pParentObj;
                cp.nCreateFlags = (int)PDFXEdit.UIX_CreateObjFlags.UIX_CreateObj_Windowed;
                cp.pID          = Inst.ID2Str(nViewID);
                cp.nStdClass    = (int)PDFXEdit.UIX_StdClasses.UIX_StdClass_Blank;
                cp.nObjStyle    = 0;
                cp.nWndStyle    = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
                cp.rc           = stPos;

                // Create the UI-container and put the user-control inside it
                uiInst.CreateObj(cp);
                pNewView = container;
            }
 public CustomPaneContainer(PDFXEdit.IPXV_View parent, int id, UserControl1 userCtrl)
 {
     m_nID      = id;
     m_Parent   = parent;
     m_UserCtrl = userCtrl;
 }