Вверх ↑
Разработчик
Ответов: 26163
Рейтинг: 2127
#1: 2014-08-19 14:19:54 ЛС | профиль | цитата
Решение вопроса установки цвета, начертания, имени шрифта и размера для выбранной строки

Add(MainForm,11774986,189,140)
{
Width=586
Height=248
}
Add(RichEdit,4566545,189,196)
{
Left=10
Top=35
Width=550
Height=165
Font=[Arial Narrow,8,0,0,204]
Point(doFormatSel)
Point(PHandle)
}
Add(ComboBox,2381782,308,112)
{
Left=375
Top=5
Width=90
Height=21
Strings=#7:Обычный|6:Жирный|6:Курсив|13:Жирный курсив|12:Подчёркнутый|
Text=""
ReadOnly=0
Point(Index)
link(onClick,11154160:doWork3,[(347,125)])
}
Add(ColorBox,3901238,238,98)
{
Left=10
Top=5
Width=145
Height=21
link(onClick,3003326:doWork3,[(277,104)])
}
Add(InlineCode,6686563,231,273)
{
WorkPoints=#11:doFormatSel|
DataPoints=#7:PHandle|5:Color|5:Style|8:FontName|8:FontSize|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|21:uses kol,Share,Debug;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|0:|12: PHandle,|10: Color,|10: Style,|13: FontName,|24: FontSize: THI_Event;|4: |58: procedure doFormatSel(var _Data: TData; Index: word); |5: end;|0:|14:implementation|0:|34:procedure THiAsmClass.doFormatSel;|3:var|21: sControl: PControl;|10: p: byte;|12: s: string;|13: i: integer;|0:|5:begin|48: sControl := PControl(ToIntegerEvent(PHandle));|38: if not Assigned(sControl) then exit;|2: |64: if (sControl.SelLength <> 0) then {no valid selection -> quit}|7: begin|82: sControl.RE_CharFmtArea := raSelection; {apply attribute(s) only to selection}|58: sControl.RE_FmtFontColor := ReadInteger(_Data, Color);|0:|35: p := ReadInteger(_Data, Style);|39: sControl.RE_FmtBold := p and 1 > 0;|41: sControl.RE_FmtItalic := p and 2 > 0;|44: sControl.RE_FmtUnderline := p and 4 > 0;|37: s := ReadString(_Data, FontName);|20: if s <> ' then|35: sControl.RE_FmtFontName := s;|43: i := ReadInteger(_Data, FontSize) * 20;|20: if i <> 0 then |36: sControl.RE_FmtFontSize := i; |6: end;|4:end;|0:|4:end.|
link(PHandle,4566545:PHandle,[(237,257)(216,257)])
link(Color,3901238:CurrentColor,[])
link(Style,2381782:Index,[(251,173)(328,173)])
link(FontName,7941939:CurrentFont,[(258,180)(377,180)])
link(FontSize,8008192:String,[(265,187)(456,187)])
}
Add(HubEx,3003326,273,84)
{
Angle=2
link(onEvent,14434637:doData,[(172,90)(172,279)])
}
Add(FontBox,7941939,371,112)
{
Left=160
Top=5
Width=210
Height=21
SelFont="MS Sans Serif"
link(onResult,16620996:doWork3,[(410,118)])
}
Add(HubEx,11154160,343,84)
{
Angle=2
link(onEvent,3003326:doWork2,[])
}
Add(ComboBox,8008192,443,114)
{
Left=470
Top=5
Width=90
Height=21
Strings=#1:8|2:10|2:12|2:14|2:16|2:18|2:20|2:22|2:24|2:26|2:28|2:32|
Text=""
ReadOnly=0
Point(Index)
link(onClick,16620996:doWork2,[(480,127)(480,90)])
}
Add(HubEx,16620996,406,84)
{
Angle=2
link(onEvent,11154160:doWork2,[])
}
Add(DoData,14434637,182,273)
{
link(onEventData,6686563:doFormatSel,[])
}

карма: 22

1
Голосовали:LainX