墨水画布橡皮擦
我的画板为 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 重新切换到橡皮擦。您会看到橡皮擦形状已更改。
为什么按+号后不呢?
I have sketchpad as InkCanvas
; I want to change size of eraser so I've written:
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
Try this:
- Select eraser by pressing e, Eraser stylusTip will appears Rectangular
- Press + sign to increase size , you will not see any changes. Why?
- Now you press i to change editing mode, ink tip will appears.
- Press e again to reswitch to Eraser. You will see that eraser shape has been changed.
Why not after pressing + sign?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 help:
“如果更改 EraserShape,则在下一次 EditingMode 更改之前,InkCanvas 上呈现的光标不会更新。”
我测试了以下代码并且运行良好:
From the help:
"If you change the EraserShape, the cursor rendered on the InkCanvas is not updated until the next EditingMode change."
I tested the following code and it works fine: