LEADTOOLS Support
General
General Questions
Add right-click handling to medicalviewer cell
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, December 19, 2013 5:05:31 PM(UTC)
Groups: Registered
Posts: 9
Thanks very much !
I have another question here , is there any way to add a MouseRightClick event to a cell ?
#2
Posted
:
Sunday, December 22, 2013 7:49:09 AM(UTC)
Groups: Registered
Posts: 256
Daidaiyu,
We have split this post from the original thread because this is a new question.
We have right-mouse events implemented in our demos. For example, in our Medical Viewer demo you can do various actions like Window leveling, Scale, Stack..etc by the right mouse button to be the action using SetAction() Method.
You can also implement user-defined actions, by casting the user-defined action ID into the actionType parameter. For more information, see the following help topics:
"AddAction Method"
"Applying Actions"
Is this what you want? Or do you want something else? If you want something else, please explain in details what is it that you want.
#3
Posted
:
Monday, December 23, 2013 4:23:37 PM(UTC)
Groups: Registered
Posts: 9
Thanks for replaying ~
When I adjust the window lever , I want to end this action by RightClick , but it doesn't work . Here is my code :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
private void windowlevel_Click(object sender, System.Windows.RoutedEventArgs e)
{
_actionType = MedicalViewerActionType.WindowLevel;
setCellAction(_actionType);
medicalviewer.Cells[0].SetAction(MedicalViewerActionType.None, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);
}
private void setCellAction(MedicalViewerActionType _actionType)
{
MedicalViewerActionFlags applyingOperation = (MedicalViewerActionFlags)0;
applyingOperation = MedicalViewerActionFlags.Selected;
applyingOperation ^= MedicalViewerActionFlags.RealTime;
foreach (MedicalViewerBaseCell viewerCell in medicalviewer.Cells)
viewerCell.SetAction(_actionType, MedicalViewerMouseButtons.Left, applyingOperation);
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Thanks ~
#4
Posted
:
Monday, December 23, 2013 9:44:23 PM(UTC)
Groups: Registered
Posts: 256
You have three issues in your code:
1) In the setCellAction() function, you are setting the Window leveling to the left mouse click button NOT the right click.
2) In the call to medicalviewer.Cells[0].SetAction() you are setting the mouse right-click to have no action.
3) If you use either calls (after fixing issues 1&2), it should give you the result you want. You don't need to call the two.
Here is the code you should use to enable Window Level action on the mouse righ-click:
==============================
private void windowlevel_Click(object sender, System.Windows.RoutedEventArgs e)
{
medicalViewer.Cells[0].SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);
}
==============================
OR
==============================
private void windowlevel_Click(object sender, System.Windows.RoutedEventArgs e)
{
_actionType = MedicalViewerActionType.WindowLevel;
setCellAction(_actionType);
}
private void setCellAction(MedicalViewerActionType _actionType)
{
MedicalViewerActionFlags applyingOperation = (MedicalViewerActionFlags)0;
applyingOperation = MedicalViewerActionFlags.Selected;
applyingOperation ^= MedicalViewerActionFlags.RealTime;
foreach (MedicalViewerBaseCell viewerCell in medicalviewer.Cells)
viewerCell.SetAction(_actionType, MedicalViewerMouseButtons.Right, applyingOperation);
}
==============================
LEADTOOLS Support
General
General Questions
Add right-click handling to medicalviewer cell
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.