Bonjour tout le monde !
J'ai étudié depuis quelques temps le sample mfc du MSDN qui se nomme "DrawCLI" mais il semble compliqué : je me demande comment isoler les éléments importants.
Pourquoi on parle d'ActiveX ??????
Voici ce que j'ai pu en tirer de DrawCLI, désolé, il y a un peu d'anglais car j'ai tiré quelques phrases de l'aide msdn mais c'est quand même facile à comprendre.
C'est un échantillon (sample) ou exemple dans le MSDN qui illustre "Integrating Active Container Support with Application-Specific Features ".
Ce qui suit est une brève explication de comment ce sample sépare le code spécifique de l'application et le code spécifique en tant que conteneur ActiveX.
La classe CDrawObj (dans Drawobj.cpp), is a base class for derived "shape" classes. This base class handles hit testing of shapes, moving of shapes, and resizing of shapes. Using polymorphism, DRAWCLI can interact with objects of different classes through CDrawObj's interface.
Les classes CDrawRect and CDrawPoly qui dérivent de CDrawObj. CDrawRect is used to draw rectangles, rounded rectangles, ellipses, and lines. CDrawPoly is used to draw polygons. These two classes are independent of DRAWCLI's ActiveX container functionality.
La classe CDrawOleObj qui dérive aussi de CDrawObj, and is used to represent embedded objects. CDrawOleObj delegates any ActiveX-specific operation to a contained CDrawItem object (described below). For generic shape operations, embedded objects are treated like other shape objects in DRAWCLI because CDrawOleObj is derived from CDrawObj.
La classe CDrawItem, derived from COleClientItem, handles all the ActiveX-specific behavior for the embedded object. The implementation of CDrawItem is similar to the implementation of the COleClientItem-derived classes in the CONTAINER and OCLIENT samples.
DRAWCLI est selon moi une application MFC comme les autres sauf que
La classe CDrawDoc hérite de COleDocument. The COleDocument object maintains a CObList of CDrawObj objects. CDrawDoc delegates several ActiveX container-specific menu commands, such as Edit Paste, Paste Link, and Links, to the base class COleDocument.
La classe CDrawView hérite de CScrollView. The ActiveX-specific implementation of CDrawView is similar to the implementation of the view classes in the CONTAIN and OCLIENT samples. The bulk of DRAWCLI's drawing-specific user interface is also implemented in CDrawView.