How to get the co-ordinates of rectangle
-
Hi all, I dnt know whether its a right forum for this question.If any one can help me it will be helpful to me. I am drawing a rectangle using LeadTools. Here is the code :
void CImageViewerView::OnAnnotationRectanle()
{
m_ImageViewer.SetAction(CONTAINER_ACTION_ANNOTATION_RECTANGLE,CONTAINER_MOUSE_BUTTON_LEFT,FALSE);
m_ImageViewer.EnableActionCallBack(TRUE);
m_ImageViewer.SetAction(110, CONTAINER_MOUSE_BUTTON_RIGHT, DCACTION_ACTIVEONLY);
}How can i get the co-ordinates 1) m_ImageViewer.SetAction : Sets the rectangle for left mouse button. 2)m_ImageViewer.EnableActionCallBack: Returns if the rectangle is drawn. 3)I want to use GetAnnotationContainer() for returning the co-ordinates.
m_ImageViewer.SetAction(110, CONTAINER_MOUSE_BUTTON_RIGHT, DCACTION_ACTIVEONLY);
This is working fine for me,I am changing the rectangle action to Right Mouse button
Here is the API :
L_INT GetAnnotationContainer(L_INT nCellIndex,L_INT nSubCellIndex,HANNOBJECT * PhAnnContainer,L_UINT uFlags);I have this in .h file
typedef struct tagDISPCONTAINERCELLINFO
{
L_UINT uStructSize;
L_HDC hDC;
L_INT nCellIndex;
L_INT nSubCellIndex;
RECT rcRect;
RECT rcBitmapRect;
L_INT nX;
L_INT nY;
}
DISPCONTAINERCELLINFO, * pDISPCONTAINERCELLINFO;When i am trying to use the same
pDISPCONTAINERCELLINFO pCellInfo;
void CImageViewerView::OnAnnotationRectanle()
{
m_ImageViewer.SetAction(CONTAINER_ACTION_ANNOTATION_RECTANGLE,CONTAINER_MOUSE_BUTTON_LEFT,FALSE);
m_ImageViewer.EnableActionCallBack(TRUE);
m_ImageViewer.SetAction(110, CONTAINER_MOUSE_BUTTON_RIGHT, DCACTION_ACTIVEONLY);
m_ImageViewer.GetAnnotationContainer(pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, &PhAnnContainer, CONTAINER_ACTION_ANNOTATION_RECTANGLE);
}But i am getting memory cannot read for pCellInfo->nCellIndex (Run Time error) If any one knows what i am doing wrong,please help me Thanks raj
-
Hi all, I dnt know whether its a right forum for this question.If any one can help me it will be helpful to me. I am drawing a rectangle using LeadTools. Here is the code :
void CImageViewerView::OnAnnotationRectanle()
{
m_ImageViewer.SetAction(CONTAINER_ACTION_ANNOTATION_RECTANGLE,CONTAINER_MOUSE_BUTTON_LEFT,FALSE);
m_ImageViewer.EnableActionCallBack(TRUE);
m_ImageViewer.SetAction(110, CONTAINER_MOUSE_BUTTON_RIGHT, DCACTION_ACTIVEONLY);
}How can i get the co-ordinates 1) m_ImageViewer.SetAction : Sets the rectangle for left mouse button. 2)m_ImageViewer.EnableActionCallBack: Returns if the rectangle is drawn. 3)I want to use GetAnnotationContainer() for returning the co-ordinates.
m_ImageViewer.SetAction(110, CONTAINER_MOUSE_BUTTON_RIGHT, DCACTION_ACTIVEONLY);
This is working fine for me,I am changing the rectangle action to Right Mouse button
Here is the API :
L_INT GetAnnotationContainer(L_INT nCellIndex,L_INT nSubCellIndex,HANNOBJECT * PhAnnContainer,L_UINT uFlags);I have this in .h file
typedef struct tagDISPCONTAINERCELLINFO
{
L_UINT uStructSize;
L_HDC hDC;
L_INT nCellIndex;
L_INT nSubCellIndex;
RECT rcRect;
RECT rcBitmapRect;
L_INT nX;
L_INT nY;
}
DISPCONTAINERCELLINFO, * pDISPCONTAINERCELLINFO;When i am trying to use the same
pDISPCONTAINERCELLINFO pCellInfo;
void CImageViewerView::OnAnnotationRectanle()
{
m_ImageViewer.SetAction(CONTAINER_ACTION_ANNOTATION_RECTANGLE,CONTAINER_MOUSE_BUTTON_LEFT,FALSE);
m_ImageViewer.EnableActionCallBack(TRUE);
m_ImageViewer.SetAction(110, CONTAINER_MOUSE_BUTTON_RIGHT, DCACTION_ACTIVEONLY);
m_ImageViewer.GetAnnotationContainer(pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, &PhAnnContainer, CONTAINER_ACTION_ANNOTATION_RECTANGLE);
}But i am getting memory cannot read for pCellInfo->nCellIndex (Run Time error) If any one knows what i am doing wrong,please help me Thanks raj
You're accessing memory through an uninitialised pointer (
pDISPCONTAINERCELLINFO pCellInfo;
). In this situation the behaviour you're getting is exactly what's expected.Steve
-
You're accessing memory through an uninitialised pointer (
pDISPCONTAINERCELLINFO pCellInfo;
). In this situation the behaviour you're getting is exactly what's expected.Steve
Hi, I corrected with
DISPCONTAINERCELLINFO pCellInfo;
m_ImageViewer.GetAnnotationContainer(pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, &PhAnnContainer, CONTAINER_ACTION_ANNOTATION_RECTANGLE);But still i am no tgetting any coordinate values. Any idea will be helpful Thanks Raj
-
Hi, I corrected with
DISPCONTAINERCELLINFO pCellInfo;
m_ImageViewer.GetAnnotationContainer(pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, &PhAnnContainer, CONTAINER_ACTION_ANNOTATION_RECTANGLE);But still i am no tgetting any coordinate values. Any idea will be helpful Thanks Raj
Here's the API you gave in an earlier post:
Here is the API :
L_INT GetAnnotationContainer(L_INT nCellIndex,L_INT nSubCellIndex,HANNOBJECT * PhAnnContainer,L_UINT uFlags);I have this in .h file
typedef struct tagDISPCONTAINERCELLINFO
{
L_UINT uStructSize;
L_HDC hDC;
L_INT nCellIndex;
L_INT nSubCellIndex;
RECT rcRect;
RECT rcBitmapRect;
L_INT nX;
L_INT nY;
}
DISPCONTAINERCELLINFO, * pDISPCONTAINERCELLINFO;And here's the updated code you just posted (I've corrected the incorrect escaping):
DISPCONTAINERCELLINFO pCellInfo;
m_ImageViewer.GetAnnotationContainer(pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, &PhAnnContainer, CONTAINER_ACTION_ANNOTATION_RECTANGLE);The
pCellInfo
variable is still not inititalised! In fact this code is worse, it will not even compile:pCellInfo
is not a pointer (despite it's name suggesting it is) but is used as if it is (pCellInfo->nCellIndex
).Steve