Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
mzhao  
#1 Posted : Monday, September 20, 2010 12:17:14 AM(UTC)
mzhao

Rank: Advanced Member

Groups: Member
Joined: 9/10/2010(UTC)
Posts: 57

Thanks: 1 times
Question: what is the best way to edit a selected object on multilayerviewer by key event?

E.G: we want to use alt-key and arrow-key to move a selected object by one unit ( eg one point) on multilayerviewer.

We tried to use KeyDown event of multilayerviewer to do this. It does detect alt-key but no arrow-key.

What it the good way to do this?

Alex Kon  
#2 Posted : Tuesday, September 21, 2010 7:37:16 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello mzhao,

The simplest way to move object is to translate object's transformation matrix.

As for arrow keys - it seems that it is a little bit tricky part. After some googling I finally make it work by overloading ProcessCmdKey() method of the control. Here is sample code:

Code:
class MyMLV : MultiLayerViewer
{
	public MyMLV()
	{
	}

	protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
	{
		const int WM_KEYDOWN = 0x100;
		const int WM_SYSKEYDOWN = 0x104;

		if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
		{
			switch (keyData)
			{
				case Keys.Down:
					MessageBox.Show("Down Arrow Captured");
					break;

				case Keys.Up:
					MessageBox.Show("Up Arrow Captured");
					break;
			}
		}
		return true;
	}
}

Users browsing this topic
Guest
Forum Jump  
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.