如何在CHtmlView中控制拖放?

feng_bd 2001-11-14 05:22:14
程序:
在CHtmlView中,使用IE55开发包完成编辑.

问题:
如果使用ConnectionPointer,好象只能控制某一个具体的Element.而我想控制一类标记(SPAN标记)的拖放;
有人遇到过类似问题吗?

多谢!多谢!
...全文
88 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
smallfool 2001-11-15
  • 打赏
  • 举报
回复
既然你可以获得每一个元素,为什么你不可以为每一个元素(当然是符合你一定要求的元素)建立事件管道?MSDN文Handling HTML Element Events中就是讲述元素事件处理的.当然它只是响应一个ID叫"MyID"的元素的事件.但是我想你肯定可以响应一类元素的事件,其实是一样的吧?
feng_bd 2001-11-15
  • 打赏
  • 举报
回复
没有人一起讨论么?
feng_bd 2001-11-14
  • 打赏
  • 举报
回复
jiangsheng,你误会了,

我不是要拖放,而是要控制用户不能对<span>标记对象的拖放.

或者,如果能够禁止HTMLView中所有的拖放操作也行.
蒋晟 2001-11-14
  • 打赏
  • 举报
回复
哦,用IMarkupServices试试
Moving Content
You can move a range of content from one place to another with the Move method of the IMarkupServices interface.

HRESULT Move(
IMarkupPointer *pPointerSourceStart,
IMarkupPointer *pPointerSourceFinish,
IMarkupPointer *pPointerTarget
);

The Move operation takes three markup pointers: two for the source range to move, and a third for the destination. The effect on the content in the source markup is identical to the Remove operation. The content that was in the source will be moved into the markup specified by the target pointer.

All elements completely encompassed by the source range are moved intact to the target. That is, the identities of these elements are preserved. Elements that are completely outside the range of the source are unaffected, and are not transferred to the destination. However, elements that partially overlap the source range are cloned, and their CloneElements are moved to the target. Thus, given the preceding example in the Move operation, if that range were to be moved to the position shown in the following example:

X[pdest]Y

It would produce the following:

X[pdest]<I'>d<S>e</I'>f<U'>g</S>h</U'>Y

Notice that [pdest] is to the left of the newly inserted moved content. This is because it had left gravity. Notice that there are I' and U' elements. These are clones of the original I and U elements that were left back at the source. Elements can live only in one markup, and must influence one contiguous range in that markup. Note that the S element was not influenced by CloneElement. This is because the S element was entirely surrounded by the start and end pointers in the source before the move.

Tip Quite often, after a move (or a copy for that matter), you will want to have two pointers to the left and right, respectively, of the newly inserted content. To do this, create two markup pointers before the move: one with left gravity and another with right gravity. Place these two pointers at the destination pointer, then perform the move. After the move, the pointer with left gravity will be located to the left, and the pointer with right gravity will be located to the right of the newly moved/copied content.

Note The destination of the move can be between the source start and the source end of the range to move.

3,055

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC HTML/XML
社区管理员
  • HTML/XML社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧