如何对memo进行编程,鼠标点击memo如何知道是点击那一行?如何对不同行设置不同颜色,高分在线等待!用于记录错误信息,点击每条(每行)错误信息,自动定位到某个控件。
如果不用Memo用什么控件好?再问
如何设置PageControl的TabSheet的Caption的颜色
我用PageControl.Page[i].font.color:= clred;
改变了 page[i]页的控件的颜色。我只能给100分。
如果不用Memo用什么控件好?再问
如何设置PageControl的TabSheet的Caption的颜色
我用PageControl.Page[i].font.color:= clred;
改变了 page[i]页的控件的颜色。我只能给100分。
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
begin
with pagecontrol1 do
begin
if Active then pageControl1.Canvas.Font.Color:=clRed;
pageControl1.Canvas.TextOut(rect.left+4,rect.top+4,PageControl1.Pages[TabIndex].Caption);
end;end;memo那个和: soundbug(兼职乞丐) ( 一样,用ricktext吧,问题就不回答了
var
LineNum:longint;
begin
LineNum := SendMessage(Memo1.Handle,EM_LINEFROMCHAR, Memo1.SelStart,0);
var
i:integer;//被指定的行数
begin
i:=strtoint(edit1.Text );//edit1用来输入要指定的行号
if i>listbox1.items.count then exit;
i:=i-1;
ListBox1.Selected[i]:=True;
end;
procedure TForm1.ListBox1MeasureItem(Control: TWinControl; Index: Integer;
var Height: Integer);
begin
Height := Index Mod 3 * 2 + ListBox1.ItemHeight;
//你要画的每个Item的高度,根据字体不同而不同,我这是随便取了几个不同的值end;procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
ListBox1.Canvas.Brush.Color := Index * $A0F0F0;
ListBox1.Canvas.FillRect(Rect);
//上面的代码是填充Item的背景,下面画出每个Item的文字,可以为每个Item设置不同的字体及着色
if Index mod 2 = 0 then
begin
ListBox1.Canvas.Font.Name := 'Impact';
ListBox1.Canvas.Font.Color := clLime;
end
else
begin
ListBox1.Canvas.Font.Name := 'Tahoma';
ListBox1.Canvas.Font.Color := clRed;
end;
//用Canvas的TextOut画出文字:
ListBox1.Canvas.TextOut(Rect.Left, Rect.Top, ListBox1.Items[Index]);end;