请问,Delphi有没有TextOut函数?如何用?(100分)

  • 主题发起人 主题发起人 aegir
  • 开始时间 开始时间
有没有看帮助就知道啦,怎么用也是看帮助,不要什么都问。
 
当然有了,Cavas的函数,比如:<br>Canvas.Font.Color := Canvas.Brush.Color;<br>Canvas.textout(10,30,'aa');
 
刚才看了一下帮助,写的很清楚,还有例子:<br>procedure TForm1.FormCreate(Sender: TObject);<br><br>var<br>&nbsp; HeaderSection: THeaderSection;<br>&nbsp; I: Integer;<br>begin<br>&nbsp; for I := 0 to 4 do<br>&nbsp; begin<br>&nbsp; &nbsp; HeaderSection := HeaderControl1.Sections.Add;<br>&nbsp; &nbsp; HeaderSection.Text := 'Text Section ' + IntToStr(I);<br>&nbsp; &nbsp; HeaderSection.MinWidth := length(HeaderSection.Text) * Font.Size;<br>&nbsp; &nbsp; // Owner draw every other section<br>&nbsp; &nbsp; if (I mod 2 = 0) then<br>&nbsp; &nbsp; &nbsp; HeaderSection.Style := hsOwnerDraw<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; HeaderSection.Style := hsText;<br><br>&nbsp; end;<br>end;<br><br>procedure TForm1.HeaderControl1DrawSection(HeaderControl: THeaderControl;<br>&nbsp; Section: THeaderSection; const Rect: TRect; Pressed: Boolean);<br>begin<br>&nbsp; with HeaderControl.Canvas do<br>&nbsp; begin<br>&nbsp; &nbsp; // highlight pressed sections<br>&nbsp; &nbsp; if Pressed then<br>&nbsp; &nbsp; &nbsp; Font.Color := clRed<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; Font.Color := clBlue;<br>&nbsp; &nbsp; TextOut(Rect.Left + Font.Size, Rect.Top + 2, 'Owner Drawn text');<br><br>&nbsp; end;<br>end;
 
textout(X:integer,y:integer,str:string);<br>X,Y是输出文字是坐标位置,str是输出的字符串
 
有的.不过被封装成Tcanvas的一个方法了.<br>例如在form下可以这样用:<br>canvas.TextOut(self.Left,self.Top,'i love you');<br>如果您肯去翻一翻帮助,您会了解的更满意.<br>
 
谢谢大家啦.<br>我已经看到帮助了.<br>真是的.
 
多人接受答案了。
 
后退
顶部