Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC WTL
hi
 
Recently, I have a question.
 
i want to do something when i click a ole in a richedit,but i find that i can not get the accurate position of ole.
 
Now,one way to get the position like this.
 
the "rcLastUpdate" is the i am using.
 
sometimes,it is not accurate,when the ole is not visible.
 
	STDMETHOD(Draw)(DWORD dwDrawAspect, LONG lindex, void *pvAspect,	DVTARGETDEVICE *ptd, HDC hicTargetDev, HDC hdcDraw,
	LPCRECTL prcBounds, LPCRECTL prcWBounds,
	BOOL (__stdcall * /*pfnContinue*/)(DWORD_PTR dwContinue),DWORD_PTR /*dwContinue*/)
	{
		if (prcBounds != NULL)
		{
			m_rcLastUpdate.left = prcBounds->left + 1; 
			m_rcLastUpdate.top = prcBounds->top + 1; 
			m_rcLastUpdate.right = prcBounds->right - 1; 
			m_rcLastUpdate.bottom = prcBounds->bottom - 1; 
		}
		IViewObject_Draw(dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, hdcDraw,
			prcBounds, prcWBounds);
		return 0;
	}

 
another way is that use "posfromchar()".
 
POINT posLeftBottom={PosFromChar(CPN).x, PosFromChar(CPN1).y }
 
cpn: the index of the ole .
CPN1: a char in the next line.
 
then i can get the position of the ole.
 
i think there must be a better solution.
 
so i want to know, how can i get the accurate position of ole?
 

thanks, recently asked more questions。 hoho,have more i should to learn.
Posted 7-Jan-13 22:04pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 359
1 Maciej Los 290
2 Sergey Alexandrovich Kryukov 230
3 Shweta N Mishra 185
4 PIEBALDconsult 149
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 8 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100