OCX in a OLE container
Shankar Venkataraman -- shankarv@godzilla.informix.com Tuesday, July 16, 1996 Environment : VC 4.1 / NT / Win95 Is there any sample which illustrates how to create a OCX control in a OLE container ? I have looked around and all the samples seem to detail using OCXes in regular applications. Another problem I am encountering is that the OCX does not get painted on my main window when I create one. I traced thru the debugger and found that MyOCX::OnPaint does get called but nothing seems to be visible. Spy++ also reports that the control is there. I know I am not setting something very basic like mapping mode. Shankar ---------------------------------------------------------------------------- -------------- Small things make perfection, but perfection is no small thing. Romance comes and goes, Friendship lasts forever..... Find a friend to be romantic with & it will last for eternity ---------------------------------------------------------------------------- -------------- Shankar Venkataraman Snail Mail : Ph : (415)-926-5963 (Work) 38025, Heritage Common, #160 (510)-794-0624 (Home) Fremont, CA 94536
Vilas Patil -- vilasp@rpsadf.atlantaga.ncr.com Monday, July 22, 1996 [Mini-digest: 3 responses] Hi : The painting problem is due to the fact that your OCX control does not have a window in design mode. So naturally your OnPaint will not get called. Containers handle Painting in design time slightly differently. The container itself issues WM_PAINT rather than asking the control to send one. If you have OnDraw function you will see it being called even in design mode. Beware of cordinates, though. The top-left is not 0,0. So handle your painting properly to nullify effect of non-zero corner. Vilas ---------- From: owner-mfc-l To: mfc-l Subject: OCX in a OLE container Date: Tuesday, July 16, 1996 3:24PM Environment : VC 4.1 / NT / Win95 Is there any sample which illustrates how to create a OCX control in a OLE container ? I have looked around and all the samples seem to detail using OCXes in regular applications. Another problem I am encountering is that the OCX does not get painted on my main window when I create one. I traced thru the debugger and found that MyOCX::OnPaint does get called but nothing seems to be visible. Spy++ also reports that the control is there. I know I am not setting something very basic like mapping mode. Shankar ---------------------------------------------------------------------------- -------------- Small things make perfection, but perfection is no small thing. Romance comes and goes, Friendship lasts forever..... Find a friend to be romantic with & it will last for eternity ---------------------------------------------------------------------------- -------------- Shankar Venkataraman Snail Mail : Ph : (415)-926-5963 (Work) 38025, Heritage Common, #160 (510)-794-0624 (Home) Fremont, CA 94536 -----From: "Alistair Israel"On, Tue, 16 Jul 1996 15:24:55 -0700, Shankar Venkataraman wrote: [snip] >Another problem I am encountering is that the OCX does not >get painted on my main window when I create one. I traced >thru the debugger and found that MyOCX::OnPaint does get called >but nothing seems to be visible. Spy++ also reports that the control is >there. I know I am not setting something very basic like mapping mode. I had the same problem when first trying to use an OCX control in an SDI app. Does this control's class have an Draw() method or the like? If so, then you'll probably need to call this method in the OnDraw() message handler of your view (or main frame if not using views). Otherwise, you can try calling that OnPaint directly... though this doesn't seem too clean. /****************************** * Alistair Israel * * (aisrael@hotmail.com) * * Pilipino Data Network, Inc. * * http://202.47.133.168 * ******************************/ --------------------------------------------------------- Get Your *Web-Based* Free Email at http://www.hotmail.com --------------------------------------------------------- -----From: "Mike Blaszczak" From: owner-mfc-l@netcom.com on behalf of Shankar Venkataraman > Environment : VC 4.1 / NT / Win95 Thanks. > Is there any sample which illustrates how to create a OCX > control in a OLE container ? I have looked around and all > the samples seem to detail using OCXes in regular applications. The article I wrote for MSJ, which appeared in the April, 1995 issue, does exactly this. .B ekiM http://www.nwlink.com/~mikeblas/
HellCat -- hellcat@mdm.ru Wednesday, July 24, 1996 >>>If you have OnDraw function you will see it being called even in >>>design >>mode. Beware of cordinates, though. The top-left is not >>>0,0. So >>handle your painting properly to nullify effect of >>>non-zero corner. So, how I can get a top-left corner in OnDraw or even in OnSize function? Thanks, Lech S.Gudalewicz>
John & Annette Elsbree -- elsbree@msn.com Monday, August 05, 1996 Lech - In OnDraw, you're given a rectangle as a parameter. That's the rectangle you should use. John ---------- From: owner-mfc-l@netcom.com on behalf of HellCat Sent: Wednesday, July 24, 1996 7:20 AM To: 'mfc-l@netcom.com' Subject: RE: OCX in a OLE container >>>If you have OnDraw function you will see it being called even in >>>design >>mode. Beware of cordinates, though. The top-left is not >>>0,0. So >>handle your painting properly to nullify effect of >>>non-zero corner. So, how I can get a top-left corner in OnDraw or even in OnSize function? Thanks, Lech S.Gudalewicz>
| Вернуться в корень Архива |