Can only modify an image if it contains a bitmap

Image1装载了JPG文件后下面都报错,因为。

Image1.Canvas.CopyRect(drect,Image1.Canvas,srect);

Image1.Picture.Bitmap.Canvas.CopyRect(drect,Image1.Canvas,srect);

以上2行都报错。只是在image1的picture为bmp的时候适用。

Image1.Canvas.MoveTo(1,1);
Image1.Canvas.LineTo(100,100);

这样也报错,但是未装载jpg文件或者装载的bmp文件就不报错了。

如果Image1.Picture.Graphic不是TBitmap,Image1.Canvas是不可使用的。

procedure TForm1.Button1Click(Sender: TObject);
var
MyRgn: HRGN;
begin
MyRgn := CreateRectRgn(,,,);
SelectClipRgn(Image1.Canvas.Handle,MyRgn);
Image1.Canvas.Brush.Color := clRed;
Image1.Canvas.FillRect(Image1.Canvas.ClipRect);
Image1.Invalidate;
SelectClipRgn(Image1.Canvas.Handle, HRGN(nil));
DeleteObject(MyRgn);
end;
    Image1.Canvas.Brush.Color := clRed;
Image1.Canvas.Brush.Style := bsDiagCross;
Image1.Canvas.Ellipse(, , Image1.Width, Image1.Height);

Can only modify an image if it contains a bitmap的更多相关文章

  1. AutoMapper:Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type

    异常处理汇总-后端系列 http://www.cnblogs.com/dunitian/p/4523006.html 应用场景:ViewModel==>Mode映射的时候出错 AutoMappe ...

  2. Modify Branding of FreeCAD

    Modify Branding of FreeCAD eryar@163.com This article describes the Branding of FreeCAD. Branding me ...

  3. -bash: ulimit: pipe size: cannot modify limit: Invalid argument

    从root账号切换到oracle账号时,出现了"-bash: ulimit: pipe size: cannot modify limit: Invalid argument"提示 ...

  4. Cannot send session cache limiter Cannot modify header information

    当php报出  Cannot send session cache limiter 或Cannot modify header information   的错误时   其理论上是因为php代码以前有 ...

  5. (error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about t

    运行redis过程中,突然报错如下: (error) MISCONF Redis is configured to save RDB snapshots, but is currently not a ...

  6. 阿里云服务器出现Warning: Cannot modify header information - headers already sent by (output started at 问题的解决方法

    阿里云服务器出现Warning: Cannot modify header information - headers already sent by (output started at 问题的解决 ...

  7. Modify a Stored Procedure using SQL Server Management Studio

    In Object Explorer, connect to an instance of Database Engine and then expand that instance. Expand  ...

  8. Modify textures at runtime

    动态修改Texture Modify textures at runtime?http://answers.unity3d.com/questions/7906/modify-textures-at- ...

  9. (HY000): Cannot modify @@session.sql_log_bin inside a transaction

    昨天,线上发生一例(HY000): Cannot modify @@session.sql_log_bin inside a transaction代码缺少显示的start transaction控制 ...

随机推荐

  1. ZOJ3329One Person Game(循环型 数学期望)

    There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. ...

  2. 解决form嵌套

    自己的尝试功能实现了 但是项目中没有使用: 思路利用ajax:第一个form提交的时候触发第二个需要提交数据的ajax的请求url function checkform(type){ var issu ...

  3. 何时使用padding和margin

    先看看这张图: 重点其实是background-image CSS边距属性定义元素周围的空间.通过使用单独的属性,可以对上.右.下.左的外边距进行设置.也可以使用简写的外边距属性同时改变所有的外边距. ...

  4. eclipse 无用代码扫描工具UCDetector

    本文主要介绍UCDetector(无用代码扫描工具)使用方法及局限 对于沉积或多方接手开发的项目经常会遇到一坨一坨无用的代码,但一个一个类查找又相当费时,这里介绍一个eclipse插件扫描没有引用的类 ...

  5. 重温CLR(十六) CLR寄宿和AppDomain

    寄宿(hosting)使任何应用程序都能利用clr的功能.特别要指出的是,它使现有应用程序至少能部分使用托管代码编写.另外,寄宿还为应用程序提供了通过编程来进行自定义和扩展的能力. 允许可扩展性意味着 ...

  6. Proteus 仿真运算放大器出现 GMIN 问题

    Proteus 仿真运算放大器出现 GMIN 问题 为了仿真一个反相运算放大器,在仿真时出现 GMIN 问题,将 后面的 4.7UF 去掉就可以正常仿真. 初步检查是因为输入频率太低,输入时我用的是 ...

  7. filter敏感词替换

    1.properties文件的应用 在<filter>写入配置 <filter> <filter-name>myFilter</filter-name> ...

  8. MySQL 性能优化技巧

    原文地址:MySQL 性能优化技巧 博客地址:http://www.extlight.com 一.背景 最近公司项目添加新功能,上线后发现有些功能的列表查询时间很久.原因是新功能用到旧功能的接口,而这 ...

  9. jQuery实现清空table表格除首行外的所有数据

    1.其实网上有很多版本,试了好几个都不行,最后还是查到了一个非常方便的:不会清除表格第一行表头部分. 其中J_tab_fam是table的id. ? 1 $("#J_tab_fam  tr: ...

  10. 【SQLYOG】SSH ERROR:UNABLE TO OPEN CONNECTION:GETHOSTBYNAME:UNKNOWN ERROR牵引出来的一系列问题

    出现这个问题很蹊跷,SQLyog管理过一二十台的mysql服务器或者vps,连接一直没有问题,各种服务商的都没问题,也包括阿里云的.可昨天偏偏一台阿里云的服务器本地通过SQLyog去连接它的时候报这样 ...