以文本方式查看主題

-  曙海教育集團(tuán)論壇  (http://www.scb-ycwb.com/bbs/index.asp)
--  Delphi程序設(shè)計(jì)  (http://www.scb-ycwb.com/bbs/list.asp?boardid=76)
----  關(guān)于拉幕程序的討論和源碼  (http://www.scb-ycwb.com/bbs/dispbbs.asp?boardid=76&id=2572)

--  作者:wangxinxin
--  發(fā)布時(shí)間:2010-12-14 11:20:34
--  關(guān)于拉幕程序的討論和源碼

  修改后可以使用的程序源代碼(還是不完善:還不能實(shí)現(xiàn)從一側(cè)飛入的效果,輕易出錯(cuò)):
  unitUnit1;
  
  interface
  
  uses
  Windows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,
  StdCtrls,ExtCtrls,ComCtrls,ColorGrd,RxCombos;
  
  type
  TForm1=class(TForm)
  Button1:TButton;
  Edit1:TEdit;
  OpenDialog1:TOpenDialog;
  Button2:TButton;
  Button3:TButton;
  TrackBar1:TTrackBar;
  Panel1:TPanel;
  Panel2:TPanel;
  Panel3:TPanel;
  Label1:TLabel;
  Label2:TLabel;
  Timer1:TTimer;
  Button4:TButton;
  ColorDialog1:TColorDialog;
  FontDialog1:TFontDialog;
  Button6:TButton;
  Button7:TButton;
  ComboBox1:TComboBox;
  Panel4:TPanel;
  Edit2:TEdit;
  Edit3:TEdit;
  Label3:TLabel;
  Label4:TLabel;
  Label5:TLabel;
  Label6:TLabel;
  Edit4:TEdit;
  Edit5:TEdit;
  Button8:TButton;
  Button5:TButton;
  procedureButton1Click(Sender:TObject);
  procedureFormCreate(Sender:TObject);
  procedureTimer1Timer(Sender:TObject);
  procedureButton2Click(Sender:TObject);
  procedureButton3Click(Sender:TObject);
  procedureTrackBar1Change(Sender:TObject);
  procedureFormDestroy(Sender:TObject);
  procedureButton4Click(Sender:TObject);
  procedureButton7Click(Sender:TObject);
  procedureButton6Click(Sender:TObject);
  procedureButton8Click(Sender:TObject);
  procedureButton5Click(Sender:TObject);
  private
  procedurezShowText;
  ProcedurezBmpCreate;
  procedurezSetBmp;
  procedurezSetLineHeight;
  procedurezShowLine(sender:TObject);
  {Privatedeclarations}
  public
  {Publicdeclarations}
  end;
  
  var
  Form1:TForm1;
  
  implementation
  
  {$R*.DFM}
  const
  bWidth=200;
  var
  currline,LineHeight:integer;
  sItem:TStringList;
  bmp:TBitMap;
  bRect,R1:TRect;
  iDc:HDC;
  
  procedureTForm1.Button1Click(Sender:TObject);
  begin
  OpenDialog1.Execute;
  Edit1.Text:=OpenDialog1.FileName;
  end;
  
  procedureTForm1.FormCreate(Sender:TObject);
  begin
  Form1.WindowState:=wsMaximized;
  Panel1.Top:=80;
  Panel1.Left:=96;
  Panel1.Height:=385;
  Panel1.Width:=433;
  Timer1.Enabled:=False;
  Label2.Caption:=\'100\';
  iDC:=GetDc(Panel1.handle);
  Currline:=0;
  end;
  
  procedureTForm1.zShowLine(sender:TObject);
  begin
  zShowText;
  end;
  
  procedureTForm1.Timer1Timer(Sender:TObject);
  begin
  zShowLine(self);//顯示字符串
  //bitblt轉(zhuǎn)移矩形圖(目標(biāo)句柄,LSx,y,寬,高,源句柄,LSx,y,光柵運(yùn)算符)
  BitBlt(iDc,0,0,Panel1.Width,Panel1.Height,
  Bmp.Canvas.Handle,0,Currline,srcCopy);
  Inc(Currline,1);
  ifCurrline>=bRect.Bottom-panel1.Height 100then//循環(huán)條件?
  begin
  Timer1.Enabled:=False;
  Currline:=0;
  end;
  end;
  
  
  procedureTForm1.zShowText;
  var
  i:integer;
  ss:string;
  ReadFile:TextFile;
  begin
  AssignFile(ReadFile,Edit1.Text);
  Reset(ReadFile);
  i:=1;
  sItem:=TStringList.Create;
  withsItemdo
  whilenoteof(ReadFile)do
  begin
  Readln(ReadFile,ss);
  add(ss);
  i:=i 1;
  end;
  CloseFile(ReadFile);
  zBmpCreate;
  sItem.Free;//釋放串
  end;
  
  procedureTForm1.zBmpCreate;//創(chuàng)建圖片
  var
  i,y:integer;//y
  begin
  ifbmp<>nilthenbmp.free;
  bmp:=TBitMap.Create;
  zSetBmp;
  R1.Right:=bRect.Right;
  R1.Bottom:=bRect.Bottom;
  y:=Panel1.Height-100;
  fori:=0tosItem.Count-1do//從0到行數(shù)循環(huán)顯示圖片
  begin
  R1.Top:=y;
  R1.Bottom:=R1.Top LineHeight;
  ifCombobox1.Text=\'中間對(duì)齊\'then//顯示圖片
  DrawText(Bmp.Canvas.Handle,pChar(sItem[i]),-1,R1,Dt_CenterorDt_Top)
  else
  ifCombobox1.Text=\'左對(duì)齊\'then
  DrawText(Bmp.Canvas.Handle,pChar(sItem[i]),-1,R1,Dt_LeftorDt_Top)
  else
  ifCombobox1.Text=\'右對(duì)齊\'then
  DrawText(Bmp.Canvas.Handle,pChar(sItem[i]),-1,R1,Dt_RightorDt_Top)
  else
  DrawText(Bmp.Canvas.Handle,pChar(sItem[i]),-1,R1,Dt_CenterorDt_Top);
  Inc(y,LineHeight);
  end;
  end;
  
  
  
  
  
  procedureTForm1.zSetBmp;
  begin
  zSetLineHeight;
  withbRectdo//Rect矩形坐標(biāo)(左上x(chóng),左下y,右上x(chóng),右下y)
  begin
  Top:=0;
  Left:=0;
  Right:=Panel1.Width;
  Bottom:=LineHeight*sItem.Count Height;//行高*行數(shù) form高度
  end;
  withBmpdo
  begin
  Height:=bRect.Bottom 100;//圖片高度
  Width:=bRect.Right;
  withCanvasdo//canvas畫(huà)布
  begin
  Font:=FontDialog1.Font;
  //Font:=self.Font;//form所設(shè)置的字體
  Brush.Color:=ColorDialog1.Color;
  FillRect(bRect);
  Brush.Style:=bsClear;
  end;
  end;
  end;
  
  
  
  
  
  procedureTForm1.zSetLineHeight;
  {設(shè)置行間隔}
  var
  Metrics:TTextMetric;//設(shè)置字體API
  begin
  GetTextMetrics(iDc,Metrics);
  LineHeight:=Metrics.tmHeight Metrics.tmInternalLeading-Bmp.Canvas.Font.Height;
  end;
  
  
  
  procedureTForm1.Button2Click(Sender:TObject);
  begin
  ifEdit1.Text=\'thenShowMessage(\'請(qǐng)輸入文件地址\')
  else
  begin
  ifButton2.Caption=\'開(kāi)始\'thenButton2.Caption:=\'暫停\'
  elseButton2.Caption:=\'開(kāi)始\';
  Timer1.Enabled:=notTimer1.Enabled;
  end;
  end;
  
  procedureTForm1.Button3Click(Sender:TObject);
  begin
  timer1.Enabled:=false;
  Currline:=0;
  Button2.Click;
  Button2.Caption:=\'暫停\';
  end;
  
  procedureTForm1.TrackBar1Change(Sender:TObject);
  begin
  Timer1.Interval:=TrackBar1.Position*5;
  Label2.Caption:=inttostr(Timer1.Interval);
  end;
  
  procedureTForm1.FormDestroy(Sender:TObject);
  begin
  ifBmp<>nilthenBmp.Free;
  end;
  
  procedureTForm1.Button4Click(Sender:TObject);
  begin
  close;
  end;
  
  
  procedureTForm1.Button7Click(Sender:TObject);
  begin
  FontDialog1.Execute;
  end;
  
  procedureTForm1.Button6Click(Sender:TObject);
  begin
  ColorDialog1.Execute;
  end;
  
  procedureTForm1.Button8Click(Sender:TObject);
  begin
  if((strtoint(Edit2.Text)>=600)or(strtoint(Edit3.text)>=500)or((strtoint(Edit5.Text)>=553)or(strtoint(Edit4.Text)>=630)))
  thenshowmessage(\'范圍超界\')
  else
  begin
  Panel1.Top:=strtoint(Edit2.text);
  Panel1.Left:=strtoint(Edit3.text);
  Panel1.Width:=strtoint(Edit4.text);
  Panel1.Height:=strtoint(Edit5.text);
  end;
  
  end;
  
  
  
  procedureTForm1.Button5Click(Sender:TObject);
  begin
  Panel1.Top:=0;
  Panel1.Left:=0;
  Panel1.Width:=Panel3.Width;
  Panel1.Height:=Panel3.Height;
  end;
  
  end.
  


主站蜘蛛池模板: 精品久久综合一区二区| aaa成人永久在线观看视频 | a毛片在线还看免费网站| 精品免费国产一区二区三区| 成年女人免费碰碰视频| 国产60部真实乱| 中国大陆国产高清aⅴ毛片| 美女毛片一区二区三区四区| 成年人性生活免费视频| 又色又爽又黄的视频女女高清| 两性午夜欧美高清做性| 精品亚洲综合在线第一区| 妞干网手机免费视频| 人人澡人人澡人人澡| 99在线视频免费观看| 欧美老熟妇牲交| 国产精品亚洲专区无码不卡| 国产精品一区二区久久不卡| 亚洲午夜电影网| 日本dhxxxxxdh14日本| 日韩有码在线观看| 国产a级黄色片| yy11111光电影院手机版| 猛男狂搡美女免费| 国产视频你懂得| 亚洲av日韩综合一区在线观看| 香蕉视频成人在线观看| 欧美啊v在线观看| 国产激情视频在线观看首页| 久久精品国产96精品亚洲| 虎白女粉嫩尤物福利视频| 日韩精品一区二区三区老鸦窝| 国产免费一区二区三区免费视频 | 久久人人爽人人爽人人av东京热| 2018天天弄| 最美情侣中文字幕电影| 国产精品久久久久影院嫩草| 久久综合久综合久久鬼色| 老妇高潮潮喷到猛进猛出| 天天干天天操天天摸| 亚洲成年人电影网站|