图片框,控制的DragDrop-支持 [英] DragDrop-Support of PictureBox-Control

查看:134
本文介绍了图片框,控制的DragDrop-支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过一番搜索我想出的DragDrop如何为一个图片来实现。但有一件事 - (继承当然)AllowDrop属性是不是从图片框类的代码或属性窗口访问。因此,为了使工作我添加下面一行到我的形式加载:

After some searching i figured out how dragdrop is implemented for a picturebox. But there is one thing - the (inherited of course) allowdrop property isn't accessible from code or property window of picturebox class. So to make it work i added following line to my form-load:

((控制)pictureBox1).AllowDrop = TRUE;

为什么我必须这样做?在MSDN它说:这个API支持.NET Framework基础结构,不适合直接在代码中使用。

Why do i have to do that? In msdn it says: "This API supports the .NET Framework infrastructure and is not intended to be used directly from your code."

任何解释的赞赏和对我的语法遗憾;)

Any explanation appreciated and sorry for my grammar ;)

推荐答案

图片框类覆盖了财产,并添加

The PictureBox class overrides the property and adds

[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] 

这防止它在智能感知。结果
正在显示然而,你仍然可以设置该属性无需进行转换。

This prevents it from being shown in IntelliSense.
However, you can still set the property without casting.

微软确实这个时候的属性并不适用于控制。 (例如, PictureBox.Text )结果
我不知道为什么的AllowDrop不适用于一个PictureBox;来源没有提到任何东西。

Microsoft does this when a property doesn't apply to a control. (eg, PictureBox.Text)
I don't know why AllowDrop wouldn't apply to a PictureBox; the source doesn't mention anything.

这篇关于图片框,控制的DragDrop-支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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