编辑器

自定义颜色
This commit is contained in:
JianjunLiu
2023-01-12 16:18:45 +08:00
parent 12f73f17d6
commit 797509de51
9 changed files with 593 additions and 23 deletions
+5 -4
View File
@@ -1147,7 +1147,7 @@ type tbtn = class(tcustombtn) //
function publishs();override;
begin
return array("name","action","left","top","width","height",
"align","anchors","caption","font","enabled","visible","bkbitmap","color","parentcolor","parentfont","tabstop",
"align","anchors","caption","font","enabled","visible","bkbitmap","color","parentcolor","parentfont","tabstop","wsdlgmodalframe",
"onclick","onmousemove","onsetfocus","onkillfocus","onkeyup","onkeydown","onkeypress","onnotification");
end
@@ -1917,7 +1917,8 @@ type TColorbox=class(TcustomListBox)
"onselchanged","onnotification"
);
end
property customcolor read fcustomcolor write setcustomcolor;
property customcolor:color read fcustomcolor write setcustomcolor;
private
function setcustomcolor(cl);
begin
if fcustomcolor<>cl and (cl>=0 or cl<0) then
@@ -1927,7 +1928,7 @@ type TColorbox=class(TcustomListBox)
r["color"] := cl;
FitemData.splice(0,1,r);
p := parent ;
if p then p.Notification(self,"customcolorchanged");
if p is TColorCombobox then p.Notification(self,"customcolorchanged");
end
end
fcustomcolor;
@@ -2059,7 +2060,7 @@ type TColorCombobox=class(TCustomComboBoxbase)
"readonly","itemindex",
"onselchanged","ondropdown","oncloseup","onnotification");
end
property customcolor read getcustomcolor write setcustomcolor;
property customcolor:Color read getcustomcolor write setcustomcolor;
private
function getcustomcolor();
begin
+6 -3
View File
@@ -782,7 +782,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
cvs := Canvas;
iy := 0;
cvs.Font := font;
cvs.Font.Color := 1;
//cvs.Font.Color := 1;
for i := nL1 to nL2 do
begin
r := rc;//rcDraw;
@@ -3791,6 +3791,7 @@ type TSynCustomMemo = class(TCustomMemo)
if not Highlighter then return inherited;
cvs := canvas;
bfontname := cvs.font.facename;
bfc := cvs.Font.color;
Highlighter.InsureTokenParserd(LastLine);
cw := GetXScrollDelta();
@@ -3847,6 +3848,8 @@ type TSynCustomMemo = class(TCustomMemo)
break;
end
c := V.FFColor;
if ifobj(c) then c := c.color;
if ifnil(c) then c := bfc;
fn := v.FFfacename;
//bfontname := cvs.font.facename;
cvs.Font.bkmode := TRANSPARENT;
@@ -3861,7 +3864,7 @@ type TSynCustomMemo = class(TCustomMemo)
begin
cvs.Font.Color := c;
end
else cvs.Font.Color := 0;
else cvs.Font.Color := bfc;
if (selt and selt = lowercase(val))or(seltcj and seltcj=v.FMate) then
begin
@@ -3873,7 +3876,7 @@ type TSynCustomMemo = class(TCustomMemo)
end
end
cvs.font.facename := bfontname;
cvs.Font.Color := 0;
cvs.Font.Color := bfc;
cvs.Font.bkmode := TRANSPARENT;
end
function GetCaretPos(x,y);//获得光标位置
+19 -5
View File
@@ -448,14 +448,30 @@ type tcustombtn = class(TCustomControl) //
end
function paint();override;//绘制
begin
begin
dc := Canvas;
cr := ClientRect;
if true then //绘制边框
begin
C := 0x090909;
dc.pen.Color := max(0,Color-c);
dc.pen.Width := 1;
rec := cr;
rec[2]-=1;
rec[3]-=1;
dc.moveto(rec[array(0,1)]);
dc.LineTo(rec[array(2,1)]);
dc.LineTo(rec[array(2,3)]);
dc.LineTo(rec[array(0,3)]);
dc.LineTo(rec[array(0,1)]);
end
if Fbtnstate then
begin
PaintMouseDown();
end else
if FBtnfocused then
begin
paintfocus(self.Canvas,self.ClientRect);
paintfocus(dc,cr);
end
rec := GetBtntextRect();
if not ifarray(rec) then return ;
@@ -487,9 +503,7 @@ type tcustombtn = class(TCustomControl) //
df := DT_CENTER .| DT_VCENTER .| DT_SINGLELINE;
end
end ;
dc := Canvas;
c := caption;
c := caption;
if ifstring(c) and c then
begin
dc.font := font;