Пример #1
0
 /// <summary>
 /// Handles clicking on an item.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnItemClick(PaletteEventArg e)
 {
     if (ItemClick != null)
     {
         ItemClick(this, e);
     }
 }
Пример #2
0
            protected override void OnTouchUp(TouchEventArgs e)
            {
                base.OnTouchUp(e);

                TouchCapture.Capture(this, CaptureMode.None);
#endif
                int x;
                int y;

                // Get the position of the event.
#if MF_FRAMEWORK_VERSION_V3_0
                e.GetPosition(this, out x, out y);
#else
                e.GetPosition(this, 0, out x, out y);
#endif

                int r = 0;
                int c = 0;

                // Calculate the row and column.
                r = y / _itemHeight;
                c = x / _itemWidth;

                // Validate the row and column.
                if ((r >= 0) && (r < _row) && (c >= 0) && (c < _column))
                {
                    // Calculate the item.
                    int item = c + r * _column;

                    // Make sure the item is the same one that the touch down
                    // event occurred on.
                    if (item == _pressedItem)
                    {
                        // Trigger a palette event.
                        PaletteEventArg arg = new PaletteEventArg(item);
                        OnItemClick(arg);
                    }
                }
            }
Пример #3
0
 /// <summary>
 /// Handles the color palette item click event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void colorPalette_ItemClick(object sender, PaletteEventArg e)
 {
     inkCanvas.Color = colorPalette.GetColor(e.Item);
 }
Пример #4
0
 /// <summary>
 /// Handles the color palette item click event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void colorPalette_ItemClick(object sender, PaletteEventArg e)
 {
     inkCanvas.Color = colorPalette.GetColor(e.Item);
 }
Пример #5
0
            protected override void OnTouchUp(TouchEventArgs e)
            {
                base.OnTouchUp(e);

                TouchCapture.Capture(this, CaptureMode.None);
#endif
                int x;
                int y;

                // Get the position of the event.
#if MF_FRAMEWORK_VERSION_V3_0
                e.GetPosition(this, out x, out y);
#else
                e.GetPosition(this, 0, out x, out y);
#endif

                int r = 0;
                int c = 0;

                // Calculate the row and column.
                r = y / _itemHeight;
                c = x / _itemWidth;

                // Validate the row and column.
                if ((r >= 0) && (r < _row) && (c >= 0) && (c < _column))
                {
                    // Calculate the item.
                    int item = c + r * _column;

                    // Make sure the item is the same one that the touch down 
                    // event occurred on.
                    if (item == _pressedItem)
                    {
                        // Trigger a palette event.
                        PaletteEventArg arg = new PaletteEventArg(item);
                        OnItemClick(arg);
                    }
                }
            }
Пример #6
0
 /// <summary>
 /// Handles clicking on an item.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnItemClick(PaletteEventArg e)
 {
     if (ItemClick != null)
     {
         ItemClick(this, e);
     }
 }