社区
Delphi
帖子详情
发现了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
打赏
收藏
发现了TPicture的一个有趣的现象(好像算是BUG)
我在使用Delphi6的TPicture时发现了一个现象,TPicture的Graphic成员必须在Bitmap使用后使用,因为使用Bitmap前Graphic并没有被Create。所以要想先用他,(因为你要设置图像,比如长,宽等)就要先调用TPicture对象.Graphic :=TPicture对象.Bitmap.Create;才能用。但用完就不用你free了。 呵呵,这也应该算是VCL的一个毛病了吧。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用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为什么不自己做这个工作呢?
c++builder基础进阶
c++builder基础进阶 c++builder基础进阶 c++builder基础进阶 c++builder基础进阶
delphi7组件参考大全
Additional组件页 1、TBitBtn组件:该组件是表面显示位图的位图按钮组件,该组件的行为与Tbutton组件相同。虽然
一个
TBitBtn组件只能与
一个
位图相关联,但该位图可以平分为4个部分,分别在按钮处于弹起、按下、禁止和单机状态时显示。 2、TSpeedButton组件:该组件是
一个
按钮,用于执行
一个
命令。该组件与Tbutton、Tbitbtn不同,它不是从窗口组件派生的,因此,没有windows句柄,不能获得焦点。但是,该组件具有单机事件,并且能够存储位图。 3、TMaskEdit组件:该组件用于建立掩码文本编辑框,这种文本编辑框与用Edit和RichEdit建立的文本框不同在于规定了文本的格式(即掩码)以避免用户输入非法格式的文本。 4、TStringGrid组件:该组件是
一个
字符串表格组件,用于简化字符串与关联对象间的操作。该组件提供了许多属性来控制表格的外观,同时也提供了许多方法、事件以电子表格的形式响应用户的动作,此外,该组件还将表格中的字符串关联
一个
对象,这些对象通过字符串封装了一些信息和行为供用户使用。 5、TImage组件:用TImage组件在窗体上显示一张图片,用T
Pic
tu
re对象在
Pic
tu
re属性中指定
一个
图标、图元文件、位图图像或用户定义的图像。
VCL 图片按钮 控件
Rize中有个图片控件但是只支持BMP格式很多地方不是很实用,有一天看到T
Pic
tu
re控件支持很多图片格式,特别是对PNG的支持,于是就利用T
Pic
tu
re控件写了这个控件,代码不多但很实用,也许有些地方处理的很生涩,但功能上够用了,主要是对PNG的支持背景透明后可以做很多效果比如圆形按钮等等各种按钮,你能画出多花哨的PNG就能做多花哨的按钮,所以很值得下····
Delphi QQ小键盘控件.rar
Delphi QQ小键盘控件,//如果下列图片属性为空,则FUse
Pic
tu
re为假 FBackground
Pic
tu
re: T
Pic
tu
re; //背景图片 FNormalKey
Pic
tu
re: T
Pic
tu
re; //按键平常背景图片 FMoveKey
Pic
tu
re: T
Pic
tu
re; //鼠标移动到按键上的时候的背景图片 FClickKey
Pic
tu
re: T
Pic
tu
re; //鼠标点击的时候按键的背景图片 FLetterKeyWidth: Integer; //字母按键宽度 FLetterKeyHeight: Integer; //字母按键高度 FNumberKeyWidth: Integer; //数字按键宽度 FNumberKeyHeight: Integer; //数字按键高度 FShiftKeyWidth: Integer; //Shift按键宽度 FSpaceWidth: Integer; //按键之间左右空隙大小 FSpaceHeight: Integer; //按键之间上下空隙大小 FLetterKeyLeft: Integer; //字母按键水平坐标 FNumberKeyLeft: Integer; //数字按键水平坐标 FKeyPadTop: Integer; //起始高度 FHasShiftOffsetLeft: Integer; //主显示字符水平偏差 FNoShiftOffsetLeft: Integer; //次显示字符水平偏差 FHasShiftOffsetTop: Integer; //主显示字符垂直偏差 FNoShiftOffsetTop: Integer; //次显示字符垂直偏差
Shellbrowser Component Suite v7.3 Full Source
V7.3 Released on 14 Apr 2011 • New Fea
tu
re: TJamFileList and TJamShellList now include a context menu for the column headers that allows
tu
rning on or off certain columns. • New Fea
tu
re: 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 Fea
tu
re: 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 Fea
tu
re: 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 Fea
tu
re: 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 Fea
tu
re: 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
Delphi
5,386
社区成员
262,729
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章