用RichEdit显示图片,你可以自己改改这个控件,处理TRichEdit的 WM_Paint消息,画个图片。type 
  TMyRichEdit= class(TRichEdit) 
  protected 
    procedure WMPaint(var Message: TWMPaint); message WM_PAINT; 
  end; 
procedure TMyRichEdit.WMPaint(var Message: TWMPaint); 
var 
  MCanvas: TControlCanvas; 
  DrawBounds : TRect; 
Begin 
  inherited; 
  MCanvas:=TControlCanvas.Create; 
  DrawBounds := ClientRect;  // Work with temporary TRect record. 
  Try 
  MCanvas.Control:=Self; 
  With MCanvas do 
  Begin 
    Brush.Color := clBtnFace; 
    FrameRect( DrawBounds ); 
    InflateRect( DrawBounds, -1, -1); 
    FrameRect( DrawBounds ); 
    FillRect ( DrawBounds ); 
    MoveTo ( 33, 0 ); 
    Brush.Color := clWhite; 
    LineTo ( 33, ClientHeight ); 
    PaintImages;//定义的画图片过程 
  end; 
  finally 
    MCanvas.Free; 
  End; 
end; 

解决方案 »

  1.   

    RichEdit1.Brush.bitmap:=image1.picture.bitmap;
      

  2.   

    Transparent RichEdit (just display)implementation
    uses richedit;
    {$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
    var
      imagecanvas: TCanvas;
      fmt: TFormatRange;
    begin
      RichEdit1.lines.LoadFromFile('C:\WINDOWS\Desktop\触摸屏程序\DOC\开发习惯.txt');
      imagecanvas := image1.canvas;  with fmt do begin
        hdc:= imagecanvas.handle;
        hdcTarget:= hdc;
        // rect needs to be specified in twips (1/1440 inch) as unit
        rc:= Rect(0, 0,
            imagecanvas.cliprect.right * 1440 div pixelsperinch,
            imagecanvas.cliprect.bottom * 1440 div pixelsperinch
            );
        rcPage:= rc;
        chrg.cpMin := 0;
        chrg.cpMax := richedit1.GetTextLen;
      end;  SetBkMode( imagecanvas.Handle, TRANSPARENT );
      richedit1.perform( EM_FORMATRANGE, 1, integer( @fmt ));
      // next call frees some cached data
      richedit1.perform( EM_FORMATRANGE, 0, 0 );
      image1.refresh;
      // refresh is necessary since the control only refreshes automatically
      // if a canvas method is used to change its content.end;end.