发现了TPicture的一个有趣的现象(好像算是BUG)

gonglei007 2003-06-24 11:11:08
我在使用Delphi6的TPicture时发现了一个现象,TPicture的Graphic成员必须在Bitmap使用后使用,因为使用Bitmap前Graphic并没有被Create。所以要想先用他,(因为你要设置图像,比如长,宽等)就要先调用TPicture对象.Graphic :=TPicture对象.Bitmap.Create;才能用。但用完就不用你free了。
呵呵,这也应该算是VCL的一个毛病了吧。
...全文
56 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
hansion3406 2003-06-27
  • 打赏
  • 举报
回复
啊..好困..
我是没有看过VCL啦..
但..这个就算不像楼上那些牛人所说的那样的话..呵呵..
应该不算BUG吧...
当然..我们菜鸟级人物应该相信牛人!!!
数字蛋糕 2003-06-27
  • 打赏
  • 举报
回复
为什么要用TPicture?直接用TBitmap不是挺好吗?个人认为TPicture只是用来满足各种图片格式的兼容性要求的。
GoldProgramer 2003-06-26
  • 打赏
  • 举报
回复
再说一次TGraphic是抽象类,它是不负责建立真正的图像的,真正建立图像的地方在它的子类中。
当你给一个TPicture分配的时候,TPicture就会建立一个。仔细看看VCL的源码吧,会有帮助的。
liuziwei_china 2003-06-26
  • 打赏
  • 举报
回复
同意GoldProgramer()
据我了解,这是为了扩展性,如果你想处理JPEG等图像,就可以自己写各子类来处理
GoldProgramer 2003-06-24
  • 打赏
  • 举报
回复
TGraphic是个抽象类,TBitmap才是真正实现的类。不是VCL的毛病,而是你对VCL的认识不够。
l_xiaofeng 2003-06-24
  • 打赏
  • 举报
回复
具我所知它是个虚方法,不能直接使用。(这是我的理解)
jpyc 2003-06-24
  • 打赏
  • 举报
回复
up
gonglei007 2003-06-24
  • 打赏
  • 举报
回复
而不是我们后给他Create。
gonglei007 2003-06-24
  • 打赏
  • 举报
回复
没错。但是我总觉得我们用的是TPicture,而不是TGraphic,那么她就应该在Create中自己对TGraphic的对象进行创建,因为这是TPicture的一个成员,所以TPicture 应该自己管理呀。
hkbarton 2003-06-24
  • 打赏
  • 举报
回复
就向stringlist和strings一样
要创建strings必须用stringlist的create方法创建,因为strings只有一个虚构造函数
gonglei007 2003-06-24
  • 打赏
  • 举报
回复
原来如此,那我们使用TPicture时还要自己create TGraphic多不方便呀。vcl为什么不自己做这个工作呢?
V7.3 Released on 14 Apr 2011 • New Feature: TJamFileList and TJamShellList now include a context menu for the column headers that allows turning on or off certain columns. • New Feature: TJamDriveList has the new properties “WarnLevelPercent” and “ErrorLevelPercent”. They can be used to change the color of the small bar chart which shows the free space in yellow or red, dependant on the percentage of free space. The default values are 8 and 2 percent. Set these properies to 0 if you do not want the color to be changed. • New Feature: The property “IconsBasedOnFileExtension” has been added to TJamShellList and TJamFileList. If set to True, icons will be queried from the system based on the file extension only. This is usually faster compared to using the full path. The most noticeable difference is for executable files, which will no longer show the included icon but a standard icon. • New Feature: The method AutoAdjustColumnWidths() has been added to TJamShellList and TJamFileList. If called, it adjusts the column width to an optimal value, just like the shortcut Ctrl + Num+ does in every ListView. • New Feature: The menu item “Paste Shortcut” has been added to the background context menu of the TJamShellList, just like it exists in the Windows Explorer. The chosen view type and sort column are now marked in the background context menu of TJamShellList. • New Feature: The new property TJamFileList.AllowDropToBackground lets you decide if files can be added to the list using drag and drop. The default value is True. • Improvement: The controls TJamShellCombo and TJamFolderCombo are now derived from TComboBoxEx instead of TComboBox. Since TComboBoxEx supports images and indents, we were able to remove our code for custom-drawing the items. The Windows XP Explorer also uses the Windows ComboBoxEx control for its address bar, that means our TJamShellCombo now looks more like the original Explorer control. • Improvement: The type of the property BackgroundImage in TJamS

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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