如何在 VBA 中为 Ms Access 擦除或重新加载笔划到 InkPicture? [英] How to erase or reload strokes to an InkPicture in VBA for Ms Access?

查看:66
本文介绍了如何在 VBA 中为 Ms Access 擦除或重新加载笔划到 InkPicture?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示以前保存在 Ms Access 中的墨迹图片对象上的笔画(它通过 ActiveX 在表单上).

I would like to display strokes that I have saved previously on an inkPicture Object in Ms Access (it is on a form via ActiveX).

笔画作为笔画"字段中的 ole 对象保存在表格中.

The strokes are saved in a table as an ole-object in the field 'Strokes'.

现在,做一次很容易(一行代码),我可以毫无问题地使用这个片段:

Now, doing it once is easy enough (one line of code), I can use this snippet without any problem :

Public Sub loadInkImage(MyInkPic As MSINKAUTLib.InkPicture)       

    MyInkPic.Object.Ink.Load (Me.Strokes)       

End Sub

当我想第二次这样做时,问题就出现了:墨水图片不再干净"并且无法加载笔划.
只是删除现有的笔触不起作用,那么我如何再次填充相同的墨水图片?

The problem comes in when I want to do it a second time : the inkpicture is not 'clean' any more and cannot load the strokes.
Just deleting the existing strokes doesn't work, so how can I fill the same inkpicture again ?

谢谢!

推荐答案

您是想将两组笔画加载到同一个对象中,还是只是将一组新的笔画重新加载到 InkPicture 中?如果您想重新加载笔画,您需要创建一个新的 InkDisp 对象,然后将其分配给 InkPicture.

Are you trying to load two sets of strokes into the same object, or just reload a new set of strokes into the InkPicture? If you want to reload strokes you need to create a new InkDisp Object then assign it to the InkPicture.

Public Sub loadInkImage(MyInkPic As MSINKAUTLib.InkPicture)

    Dim newInk As New MSINKAUTLib.InkDisp 'need new object to load new ink

    newInk.Load Me.Strokes 'load in the ink

    Set MyInkPic.Ink = newInk 'set the InkPictures Ink to the new Ink
End Sub

注意:我目前没有能力对此进行测试,因此可能需要进行调整.

Note: I currently do not have the ability to test this, so it might need tweaking.

这篇关于如何在 VBA 中为 Ms Access 擦除或重新加载笔划到 InkPicture?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆