andrewproffi писал(а): andrewproffi Как вариант Add(VisualShape,9619313,1691,921) { Left=520 Top=670 Width=490 Height=35 Color=-16777204 Color2=-16777204 } Add(VisualShape,8992484,1740,970) { Left=520 Top=630 Width=490 Height=35 Color=65280 Color2=65280 } Add(VisualShape,6621327,1726,886) { Left=520 Top=590 Width=490 Height=35 Color=255 Color2=255 } Add(VisualShape,9461506,1722,931) { Left=520 Top=550 Width=490 Height=35 Color=0 Color2=0 } Add(VisualShape,5432128,1673,434) { Left=15 Top=170 Width=120 Height=145 Ctl3D=0 } Add(Image,3179763,1680,287) { Left=425 Top=5 Width=868 Height=533 Color=0 Visible=1 Point(doVisible) } Add(Hub,1978584,791,364) { OutCount=4 link(onEvent1,9088038:doSearch,[(896,370)(896,419)]) link(onEvent3,8638450:doStrCat,[(868,384)(868,335)]) link(onEvent4,16668560:doAdd,[(817,391)(817,517)(681,517)(681,643)]) } Add(Label,3946155,665,315) { Left=45 Top=25 Width=0 Height=17 Color=-16777194 Caption="COM порт" Alignment=2 } Add(StyleXP,11046345,504,343) { } Add(MainForm,14372191,329,490) { Left=200 Top=150 Width=1527 Height=737 Color=-16777194 Font=[Arial,8,0,0,1] Ctl3D=0 Caption="test AKB" BorderStyle=1 Point(doBringToFront) Point(onSetFocus) Point(onDblClick) link(onCreate,15162287:doEvent1,[(373,510)(373,496)]) } Add(Button,1842072,462,448) { Left=15 Top=110 Width=120 Height=30 Hint="Закрыть порт" Caption="Закрыть порт" Data=Real(0) link(onClick,2365950:doClose,[(548,454)(548,475)]) } Add(Button,13336586,462,490) { Left=15 Top=75 Width=120 Height=30 Hint="Открыть порт" Caption="Открыть порт" Data=Real(0) link(onClick,2365950:doOpen,[(503,496)(503,468)]) } Add(ComboBox,8670476,595,378) { Left=15 Top=47 Width=120 Height=21 Strings=#1:1|1:2|1:3|1:4|1:5|1:6|1:7|1:8|1:9|2:10|0:|0:| AddType=1 Text="Выберите порт" ReadOnly=0 } Add(COMEX,2365950,602,462) { BaudRate=18 link(onSyncRead,1978584:doEvent1,[(709,482)(709,370)]) link(Port,8670476:String,[]) } Add(Button,1574390,385,385) { Left=15 Top=5 Width=120 Height=35 Hint="Открыть порта" Caption="Поиск порт" Data=Real(0) link(onClick,8070816:doEvent1,[]) } Add(EnumCOM,2173630,476,392) { OutType=0 link(onEnumPorts,8670476:doAdd,[(538,398)(538,384)]) } Add(Hub,8070816,441,385) { InCount=2 OutCount=3 link(onEvent1,8670476:doClear,[]) link(onEvent2,2173630:doEnumPorts,[]) } Add(Hub,15162287,385,490) { link(onEvent1,8070816:doEvent2,[(420,496)(420,398)]) } Add(Button,7184611,1379,287) { Left=20 Top=180 Width=108 Height=40 Caption="Скриншот" link(onClick,16364808:doCapture,[]) } Add(Hub,2186279,1540,287) { link(onEvent1,3179763:doLoad,[]) link(onEvent2,3535410:doData,[(1564,300)(1564,307)]) } Add(InlineCode,16364808,1491,287) { WorkPoints=#9:doCapture| EventPoints=#5:onScr| Code=#25:// autor andrestudio 2021|15:unit HiAsmUnit;|0:|9:interface|0:|29:uses kol,windows,Share,Debug;|0:|5:const|12: PSIZE = 2;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|27: f1,f2,f3,f4: PControl;|16: t1: PTimer;|9: public|22: onScr: THI_Event;|51: procedure doCapture(var dt: TData; idx: word);|73: procedure onMouseDown(Sender: PControl; var Mouse: TMouseEventData);|71: procedure onMouseUp(Sender: PControl; var Mouse: TMouseEventData);|31: procedure Timer(Obj:PObj);|22: procedure GetBMP;|5: end;|0:|14:implementation|0:|29:procedure THiAsmClass.GetBMP;|3:var|10: dc: HDC;|19: Bmp: Kol.PBitmap;|19: w,h,x,y: integer;|14: pos: TPoint;|5:begin|18: dc := GetDC(0);|21: GetCursorPos(pos);|59: w := Max(f2.Left,f4.Left) - Min(f2.Left,f4.Left) -PSIZE;|55: h := Max(f1.Top,f3.Top) - Min(f1.Top,f3.Top) -PSIZE;|35: x := Min(f2.Left,f4.Left)+PSIZE;|33: y := Min(f1.Top,f3.Top)+PSIZE;|3: |25: Bmp := NewBitmap(w,h);|69: BitBlt(Bmp.Canvas.Handle,0,0,Bmp.Width,Bmp.Height,DC,x,y,SRCCOPY);|26: _hi_OnEvent(onScr,bmp);|23: bmp.CopyToClipboard;|12: bmp.Free;|54: // пришлось отказатся от пересоздания из за FPC |40: //f1.Free; f2.Free; f3.Free; f4.Free;|13: //t1.Free;|4:end;|0:|34:procedure THiAsmClass.onMouseDown;|5:begin|38: if Mouse.Button <> mbLeft then Exit;|14: t1.Tag := 2;|20: f3.Show; f4.Show; |4:end;|0:|32:procedure THiAsmClass.onMouseUp;|5:begin|38: if Mouse.Button <> mbLeft then Exit;|33: if f2.Left = f4.Left then Exit;|31: if f1.Top = f3.Top then Exit;|22: t1.Enabled := False;|37: f1.Hide; f2.Hide; f3.Hide; f4.Hide;|9: GetBMP;|4:end;|0:|38:procedure THiAsmClass.Timer(Obj:PObj);|3:var|14: pos: TPoint;|5:begin|20: GetCursorPos(pos);|21: if Obj.Tag = 1 then|7: begin|20: f1.Top := Pos.y;|21: f2.Left := Pos.x;|6: end;|21: if Obj.Tag = 2 then|7: begin|20: f3.Top := Pos.y;|21: f4.Left := Pos.x;|8: end; |4:end;|0:|32:procedure THiAsmClass.doCapture;|6:begin |34: if not Assigned(f1) then begin |28: f1 := NewForm(Applet,'');|22: f1.GetWindowHandle;|25: f1.Style := 101187584;|23: f1.ExStyle := 65536;|27: f1.Width := ScreenWidth;|22: f1.Height := PSIZE;|19: f1.Color := 255;|16: f1.Left := 0;|13: //f1.Show;|38: f1.onMouseDown := onMouseDown; end;|0:|34: if not Assigned(f2) then begin |28: f2 := NewForm(Applet,'');|22: f2.GetWindowHandle;|25: f2.Style := 101187584;|23: f2.ExStyle := 65536;|29: f2.Height := ScreenHeight;|21: f2.Width := PSIZE;|19: f2.Color := 255;|15: f2.Top := 0;|13: //f2.Show;|38: f2.onMouseDown := onMouseDown; end;|3: |35: if not Assigned(f3) then begin |28: f3 := NewForm(Applet,'');|22: f3.GetWindowHandle;|25: f3.Style := 101187584;|23: f3.ExStyle := 65536;|27: f3.Width := ScreenWidth;|22: f3.Height := PSIZE;|19: f3.Color := 255;|16: f3.Left := 0;|11: f3.Hide;|34: f3.onMouseUp := onMouseUp; end;|0:|34: if not Assigned(f4) then begin |28: f4 := NewForm(Applet,'');|22: f4.GetWindowHandle;|25: f4.Style := 101187584;|23: f4.ExStyle := 65536;|29: f4.Height := ScreenHeight;|21: f4.Width := PSIZE;|19: f4.Color := 255;|15: f4.Top := 0;|11: f4.Hide;|42: f4.onMouseUp := onMouseUp; end; |3: |34: if not Assigned(t1) then begin |22: t1 := NewTimer(25);|28: t1.OnTimer := Timer; end;|15: t1.Tag := 1;|23: t1.Enabled := True; |11: f1.Show;|16: f2.Show; |4:end;|0:|4:end.| link(onScr,2186279:doEvent1,[]) } Add(SDialog,12843375,1421,371) { Filter=".jpeg" FileName="" Point(doFileName) link(onExecute,6649720:doEvent1,[]) } Add(Button,2096136,1379,371) { Left=20 Top=225 Width=110 Height=40 Caption="Сохранить картинку" Point(doVisible) link(onClick,12843375:doExecute,[]) } Add(StrCat,864988,1491,378) { Str2=".jpeg" link(onStrCat,3599384:doEvent1,[]) link(Str1,15696856:GetData,[]) } Add(EventFromData,15696856,1491,329) { } Add(Hub,6649720,1463,371) { link(onEvent1,15696856:doData,[(1484,377)(1484,335)]) link(onEvent2,864988:doStrCat,[]) } Add(PictureStream,8303435,1673,371) { link(Bitmap,3179763:ImageBitmap,[]) } Add(DoData,3535410,1575,301) { Data=Integer(1) link(onEventData,15356796:doEvent1,[]) } Add(Hub,3599384,1540,378) { link(onEvent1,8303435:doSave,[]) link(onEvent2,2824840:doData,[]) } Add(DoData,2824840,1575,385) { Data=Integer(0) link(onEventData,15356796:doEvent2,[(1623,391)(1623,314)]) } Add(Hub,15356796,1645,301) { InCount=3 OutCount=1 link(onEvent1,3179763:doVisible,[]) } Add(Button,5182486,1379,427) { Left=20 Top=270 Width=110 Height=35 Caption="Отмена" Data=Integer(0) Point(doVisible) link(onClick,15356796:doEvent3,[(1633,433)(1633,321)]) } Add(Edit,11229754,1596,511) { Left=390 Width=960 Height=30 Font=[GOST type B,14,1,0,204] Visible=1 Text="" Alignment=2 ClearAfterEnter=1 Point(doVisible) } Add(CheckBox,3004579,1547,511) { Left=20 Top=360 Width=110 Color=-16777194 Caption="Добавить подпись" link(onCheck,11229754:doVisible,[(1587,517)(1587,531)]) } Add(BlockFind,9088038,987,413) { IncludeBlock=1 StartBlock="N1=" EndBlock="n" Point(onNotFind) link(onSearch,5789015:doText,[]) link(Text,16020354:Var3,[(993,387)]) link(onNotFind,15662643:doSearch,[(1031,433)(1031,454)(975,454)(975,475)]) } Add(Edit,5789015,1036,413) { Left=910 Top=550 Width=90 Height=35 Font=[MS Sans Serif,14,1,0,1] Enabled=1 Name="n1" Text="" Alignment=2 DataType=4 ReadOnly=0 link(onChange,15862282:doWork2,[]) } Add(BlockFind,15662643,987,469) { IncludeBlock=1 StartBlock="N2=" EndBlock="n" Point(doStop) Point(onNotFind) link(onSearch,12165363:doText,[]) link(Text,8058839:Var3,[(993,430)]) link(onNotFind,2182903:doSearch,[(1031,489)(1031,510)(975,510)(975,531)]) } Add(Edit,12165363,1036,469) { Left=910 Top=590 Width=90 Height=35 Font=[MS Sans Serif,14,1,0,1] Enabled=1 Name="n2" Text="" Alignment=2 DataType=4 ReadOnly=0 link(onChange,16243796:doWork2,[]) } Add(BlockFind,2182903,987,525) { IncludeBlock=1 StartBlock="N3=" EndBlock="n" Point(doStop) Point(onNotFind) link(onSearch,10962526:doText,[]) link(Text,6663987:Var3,[(993,479)]) link(onNotFind,5390850:doSearch,[(1031,545)(1031,566)(975,566)(975,587)]) } Add(Edit,10962526,1036,525) { Left=910 Top=630 Width=90 Height=35 Font=[MS Sans Serif,14,1,0,1] Enabled=1 Name="n3" Text="" Alignment=2 DataType=4 ReadOnly=0 link(onChange,14432459:doWork2,[]) } Add(BlockFind,5390850,987,581) { IncludeBlock=1 StartBlock="N4=" EndBlock="n" Point(doStop) Point(onNotFind) link(onSearch,16219502:doText,[]) link(Text,7257219:Var3,[(993,532)]) link(onNotFind,10450601:doSearch,[(1031,601)(1031,619)(975,619)(975,636)]) } Add(Edit,16219502,1036,581) { Left=910 Top=670 Width=90 Height=35 Font=[MS Sans Serif,14,1,0,1] Enabled=1 Name="n4" Text="" Alignment=2 DataType=4 ReadOnly=0 link(onChange,14441520:doWork2,[]) } Add(Label,819423,490,833) { Left=540 Top=530 Width=68 Height=17 Color=-16777194 Caption="Напряжение" } Add(Label,33608,487,830) { Left=660 Top=530 Width=23 Height=17 Color=-16777194 Caption="Ток" } Add(Label,11948939,480,823) { Left=740 Top=530 Width=48 Height=17 Color=-16777194 Caption="Емкость" } Add(Label,13044191,473,816) { Left=841 Top=531 Width=37 Height=17 Color=-16777194 Caption="Время" } Add(Label,14869141,466,809) { Left=915 Top=530 Width=77 Height=17 Color=-16777194 Caption="Кол-во циклов" } Add(Label,10869640,485,904) { Left=505 Top=555 Width=12 Height=25 Color=-16777194 Font=[GOST type B,14,1,0,204] Caption="1" } Add(Label,5438268,484,902) { Left=505 Top=595 Width=14 Height=25 Color=-16777194 Font=[GOST type B,14,1,0,204] Caption="2" } Add(Label,3258498,477,895) { Left=505 Top=635 Width=14 Height=25 Color=-16777194 Font=[GOST type B,14,1,0,204] Caption="3" } Add(Label,16389299,470,888) { Left=505 Top=675 Width=15 Height=25 Color=-16777194 Font=[GOST type B,14,1,0,204] Caption="4" } Add(BlockFind,10450601,987,630) { IncludeBlock=1 StartBlock="R1=" EndBlock="m" Point(onNotFind) link(onSearch,8061186:doText,[]) link(Text,2189735:Var3,[(993,583)]) link(onNotFind,9198612:doSearch,[(1031,650)(1031,671)(975,671)(975,692)]) } Add(Edit,8061186,1036,630) { Left=1005 Top=550 Width=90 Height=35 Font=[MS Sans Serif,14,1,0,1] Enabled=1 Name="R1" Text="" Alignment=2 DataType=4 ReadOnly=0 link(onChange,984718:doWork2,[]) } Add(BlockFind,9198612,987,686) { IncludeBlock=1 StartBlock="R2=" EndBlock="m" Point(doStop) Point(onNotFind) link(onSearch,11581458:doText,[]) link(Text,13512767:Var3,[(993,643)]) link(onNotFind,3078973:doSearch,[(1031,706)(1031,727)(975,727)(975,748)]) } Add(Edit,11581458,1036,686) { Left=1005 Top=590 Width=90 Height=35 Font=[MS Sans Serif,14,1,0,1] Enabled=1 Name="R2" Text="" Alignment=2 DataType=4 ReadOnly=0 link(onChange,12437849:doWork2,[]) } Add(BlockFind,3078973,987,742) { IncludeBlock=1 StartBlock="R3=" EndBlock="m" Point(doStop) Point(onNotFind) link(onSearch,10972951:doText,[]) link(Text,4233646:Var3,[(993,691)]) link(onNotFind,12154479:doSearch,[(1031,762)(1031,783)(975,783)(975,804)]) } Add(Edit,10972951,1036,742) { Left=1005 Top=630 Width=90 Height=35 Font=[MS Sans Serif,14,1,0,1] Enabled=1 Name="R3" Text="" Alignment=2 DataType=4 ReadOnly=0 link(onChange,7639570:doWork2,[]) } Add(BlockFind,12154479,987,798) { IncludeBlock=1 StartBlock="R4=" EndBlock="m" Point(doStop) Point(onNotFind) link(onSearch,6602635:doText,[]) link(Text,4233646:Var2,[(993,746)(958,746)]) } Add(Edit,6602635,1036,798) { Left=1005 Top=670 Width=90 Height=35 Font=[MS Sans Serif,14,1,0,1] Enabled=1 Name="R4" Text="" Alignment=2 DataType=4 ReadOnly=0 link(onChange,7639570:doWork3,[(1080,804)]) } Add(Label,3568395,460,803) { Left=1010 Top=530 Width=82 Height=17 Color=-16777194 Caption="Сопротивление" } Add(SDialog,11161239,539,665) { Filter=".txt" FileName="" Point(doFileName) link(onExecute,11114417:doEvent1,[]) } Add(Button,12598604,497,665) { Left=15 Top=400 Width=120 Height=40 Caption="Сохранить текст" Point(doVisible) link(onClick,11161239:doExecute,[]) } Add(StrCat,11940027,609,672) { Str2=".txt" link(onStrCat,16668560:doSave,[]) link(Str1,6746969:GetData,[]) } Add(EventFromData,6746969,609,623) { } Add(Hub,11114417,581,665) { link(onEvent1,6746969:doData,[(602,671)(602,629)]) link(onEvent2,11940027:doStrCat,[]) } Add(Memo,16668560,693,637) { Left=5 Top=515 Width=495 Height=190 ScrollBars=2 Point(doSave) } Add(Edit,13831158,371,805) { Left=1305 Top=590 Width=120 Height=30 Font=[MS Sans Serif,10,1,0,1] Name="n1" Text="" Alignment=2 DataType=4 link(onEnter,2147313:doEvent6,[(419,818)(419,664)]) } Add(Button,1428091,378,588) { Left=1305 Top=550 Width=120 Height=30 Hint="Открыть порт" Caption="Режим тестирования" Data=Integer(252) link(onClick,2147313:doEvent1,[(422,594)(422,629)]) } Add(Button,14506433,378,630) { Left=1165 Top=655 Width=120 Height=30 Hint="Открыть порт" Caption="пропустить паузу" Data=Integer(131) link(onClick,2147313:doEvent2,[]) } Add(Button,10368005,378,672) { Left=1165 Top=620 Width=120 Height=30 Hint="Открыть порт" Caption="режим разряда" Data=Integer(132) link(onClick,2147313:doEvent3,[(422,678)(422,643)]) } Add(Button,15944908,378,714) { Left=1165 Top=585 Width=120 Height=30 Hint="режим заряда" Caption="режим заряда" Data=Integer(133) link(onClick,2147313:doEvent4,[(422,720)(422,650)]) } Add(Hub,2147313,434,623) { InCount=6 OutCount=1 link(onEvent1,2365950:doWrite,[(525,629)(525,482)]) } Add(Button,13074427,375,760) { Left=1165 Top=550 Width=120 Height=30 Hint="Открыть порт" Caption="тест полной емкости" Data=Integer(123) link(onClick,2147313:doEvent5,[(421,766)(421,657)]) } Add(Memory,7573913,931,329) { } Add(StrCat,8638450,875,329) { link(onStrCat,7573913:doValue,[]) link(Str1,7262214:Var1,[(881,317)(907,317)(907,376)]) } Add(GetDataEx,7262214,931,371) { link(Data,7573913:Value,[]) } Add(HubEx,15862282,1076,413) { Angle=3 link(onEvent,7573913:doClear,[(1080,381)(919,381)(919,342)]) } Add(HubEx,16243796,1076,469) { Angle=3 link(onEvent,15862282:doWork3,[]) } Add(HubEx,14432459,1076,525) { Angle=3 link(onEvent,16243796:doWork3,[]) } Add(HubEx,14441520,1076,581) { Angle=3 link(onEvent,14432459:doWork3,[]) } Add(HubEx,984718,1076,630) { Angle=3 link(onEvent,14441520:doWork3,[]) } Add(HubEx,12437849,1076,686) { Angle=3 link(onEvent,984718:doWork3,[]) } Add(HubEx,7639570,1076,742) { Angle=3 link(onEvent,12437849:doWork3,[]) } Add(GetDataEx,16020354,952,382) { Angle=3 link(Data,7262214:Var2,[(937,387)]) } Add(GetDataEx,8058839,952,425) { link(Data,16020354:Var2,[]) } Add(GetDataEx,6663987,952,474) { link(Data,8058839:Var2,[]) } Add(GetDataEx,7257219,952,527) { link(Data,6663987:Var2,[]) } Add(GetDataEx,2189735,952,578) { link(Data,7257219:Var2,[]) } Add(GetDataEx,13512767,952,638) { link(Data,2189735:Var2,[]) } Add(GetDataEx,4233646,952,686) { link(Data,13512767:Var2,[]) }
Редактировалось 2 раз(а), последний 2024-07-09 08:22:28
|