我有画板InkCanvas
;我想改变橡皮擦的大小,所以我写了:
Private Sub Sketchpad_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles Sketchpad.KeyDown
If e.Key = Key.OemMinus Then
' Decrease size of Eraser to 5*5
Sketchpad.EraserShape = New RectangleStylusShape(5, 5)
End If
If e.Key = Key.OemPlus Then
' Increase size of Eraser to 50*50
Sketchpad.EraserShape = New RectangleStylusShape(50, 50)
End If
If e.Key = Key.I Then
' Change editing mode to Ink
Sketchpad.EditingMode = InkCanvasEditingMode.Ink
End If
If e.Key = Key.E Then
' Change editing mode to Eraser
Sketchpad.EditingMode = InkCanvasEditingMode.EraseByPoint
End If
End Sub
尝试这个:
- 按e选择橡皮擦,橡皮擦笔尖会出现矩形
- 按+号增加大小,你不会看到任何变化。为什么?
- 现在您按 i 更改编辑模式,将出现墨水提示。
- 再次按 e 可重新切换到橡皮擦。您会看到橡皮擦形状已更改。
为什么不按+号后?