Второй день ломаю голову не могу понять почему если выбрать и увеличить картинку потом выбрать ещё одну то размер следующей картинки становится увеличенным и не уменьшается!
Add(MainForm,2953706,182,98) { Width=908 Height=576 Color=12632256 Caption="Image Viewer" BorderStyle=1 Position=1 Point(onMouseWheel) Point(Left) Point(Top) link(onMouseWheel,1180587:In,[]) } Add(InlineCode,7501453,413,49) { WorkPoints=#13:doClearSpisok|8:doSpisok|6:doInit|6:doFile|7:doStart|8:doFinish| EventPoints=#7:onClear|5:onIdx|6:onFile|6:Rezerv|6:onPath|4:onPs|4:onLs| Code=#15:unit HiAsmUnit;|0:|9:interface|0:|21:uses kol,Share,Debug;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|27: l:array[0..4] of string;|29: spisok : Array of String; |7: K,|8: C, |8: S, |15: F:integer;|29: procedure calk(i:integer);|9: public|66: count, onClear, onIdx, onPath, onFile, onLs, onPs : THI_Event;|57: procedure doClearSpisok(var _Data:TData; Index:Word);|52: procedure doSpisok(var _Data:TData; Index:Word);|50: procedure doInit(var _Data:TData; Index:Word);|50: procedure doFile(var _Data:TData; Index:Word);|51: procedure doStart(var _Data:TData; Index:Word);|52: procedure doFinish(var _Data:TData; Index:Word);|5: end;|0:|50:const ext:string=('bmp gif ico jpg jpeg png tif');|0:|14:implementation|0:|0:|36:procedure THiAsmClass.doClearSpisok;|5:begin|21: SetLength(spisok,0);|4:end;|0:|29:procedure THiAsmClass.doFile;|5:begin|41: _hi_onEvent(onFile,l[toInteger(_Data)]);|4:end;|0:|31:procedure THiAsmClass.doSpisok;|17:var ss, S:string;|14: i:integer;|5:begin|8: ss:='';|22: S := toString(_Data);|39: If (S='') or (pos('.',S)=0) then Exit;|70: for i:=length(S) downto 1 do IF s[i]='.' then break else ss:=S[i]+ss;|19: ss:=lowerCase(ss);|28: if pos(ss,ext)=0 then Exit;|20: i:= High(spisok)+1;|23: SetLength(spisok,i+1);|14: spisok[i]:=S;|4:end;|0:|29:procedure THiAsmClass.doinit;|5:BEGIN|18: C:=High(spisok);|7: S:=0;|33: If (C>5) then F:=C-5 else F:=C;|29: If C<5 then K:=C else K:=4;|10: calk(1);|4:END;|0:|38:procedure THiAsmClass.calk(i:integer);|14:var n:integer;|5:begin|10: case i of|11: 0: begin|15: S:=S+4; |24: If S>F then S:=F;|10: end;|10: 1:begin|14: S:=S-4; |23: If S<0 then S:=0;|6: |9: end;|5: end;|23: _hi_onEvent(onClear);|59: If S=0 then _hi_onEvent(onLs,0) else _hi_onEvent(onLs,1);|59: If S=F then _hi_onEvent(onPs,0) else _hi_onEvent(onPs,1);|19: For n:=0 to K do |9: begin|24: l[n]:=spisok[n+S];|27: _hi_onEvent(onIdx,n);|31: _hi_onEvent(onPath,l[n]);|12: end; |4:end;|0:|30:procedure THiAsmClass.doStart;|5:BEGIN|9: calk(0);|4:END;|0:|31:procedure THiAsmClass.doFinish;|5:BEGIN|9: calk(1);|4:END;|4:end.| link(onClear,5968486:doEvent1,[]) link(onIdx,5968486:doEvent,[]) link(onFile,12519286:doLoadFrom,[]) link(onPath,12519286:doGetThumbFrom,[]) link(onPs,1358769:doVisible,[(460,90)(460,127)(303,127)(303,90)]) link(onLs,13649227:doVisible,[(453,97)(453,120)(359,120)(359,97)]) } Add(FileSearch,2629711,252,56) { SubDir=1 link(onSearch,7501453:doSpisok,[]) link(onEndSearch,7501453:doInit,[]) } Add(Browse,9986803,119,49) { link(onBrowse,6456784:doText,[]) link(onCancel,2953706:doClose,[(167,62)(167,125)]) } Add(Button,6523879,70,49) { Left=10 Top=15 Width=75 Font=[MS Sans Serif,8,1,0,1] TabOrder=-1 Caption="Каталог" link(onClick,9986803:doBrowse,[]) } Add(Edit,6456784,182,49) { Left=100 Top=15 Width=630 Font=[Courier New,12,1,0,204] Text="" Alignment=2 link(onChange,11488404:doEvent1,[]) link(onEnter,11488404:doEvent2,[]) } Add(Hub,11488404,224,49) { InCount=2 link(onEvent1,7501453:doClearSpisok,[]) link(onEvent2,2629711:doSearch,[]) } Add(Img_GDIFileProcessor,12519286,469,63) { Point(onGetThumb) Point(doGetThumbFrom) link(onLoad,7488456:In,[]) link(onGetThumb,5968486:doEvent2,[]) } Add(ChildPanelEx,5968486,560,49) { link(onRead,7501453:doFile,[(606,55)(606,135)(296,135)(296,76)]) } BEGIN_SDK Add(EditMultiEx,14500564,21,21) { WorkCount=#8:doEvent1|7:doEvent|4:Free|8:doEvent2| EventCount=#6:onRead| Width=335 Height=249 VOffset=28 link(doEvent1,15091165:doEvent1,[(73,55)(73,132)]) link(doEvent,7440660:doValue,[(57,62)(57,146)]) link(doEvent2,12724308:doEvent,[(45,76)(45,195)]) } Add(Panel,8947318,294,147) { Left=125 Top=470 Width=474 Height=66 Color=12632256 BorderWidth=0 BevelInner=0 BevelWidth=0 } Add(Image,7975942,196,49) { Left=5 Width=85 Height=65 Ctl3D=0 WinStyle=1 ViewStyle=5 link(onClick,5423092:doWork1,[]) } Add(Image,1542487,196,217) { Left=385 Width=85 Height=65 Ctl3D=0 WinStyle=1 ViewStyle=5 link(onClick,5423092:doWork5,[(252,223)(252,83)]) } Add(Image,12463613,196,175) { Left=290 Width=85 Height=65 Ctl3D=0 WinStyle=1 ViewStyle=5 link(onClick,5423092:doWork4,[(245,181)(245,76)]) } Add(Image,688805,196,133) { Left=195 Width=85 Height=65 Ctl3D=0 WinStyle=1 ViewStyle=5 link(onClick,5423092:doWork3,[(239,139)(239,69)]) } Add(Image,16651437,196,91) { Left=100 Width=85 Height=65 Ctl3D=0 WinStyle=1 ViewStyle=5 link(onClick,5423092:doWork2,[(234,97)(234,62)]) } Add(IndexToChanel,12724308,70,189) { Count=5 Point(Index) link(onEvent1,7975942:doLoad,[(113,195)(113,55)]) link(onEvent2,16651437:doLoad,[(120,202)(120,97)]) link(onEvent3,688805:doLoad,[(179,209)(179,139)]) link(onEvent4,12463613:doLoad,[(186,216)(186,181)]) link(onEvent5,1542487:doLoad,[]) link(Index,7440660:Value,[]) } Add(ChanelToIndex,5423092,259,49) { Count=5 link(onIndex,14500564:onRead,[]) } Add(Hub,15091165,140,126) { OutCount=5 link(onEvent1,7975942:doClear,[(163,132)(163,62)]) link(onEvent2,16651437:doClear,[(170,139)(170,104)]) link(onEvent3,688805:doClear,[]) link(onEvent4,12463613:doClear,[(165,153)(165,188)]) link(onEvent5,1542487:doClear,[(160,160)(160,230)]) } Add(Memory,7440660,70,140) { } END_SDK Add(LineBreak,12574562,91,147) { link(Out,3917293:doWork1,[]) Primary=[7488456,427,-84] } Add(Label,13649227,371,84) { Left=90 Top=480 Width=10 Height=17 Color=12632256 Font=[Consolas,28,1,0,204] Visible=1 Caption="<" ColorHover=255 Point(doVisible) link(onClick,7501453:doFinish,[]) } Add(Label,1358769,315,77) { Left=610 Top=480 Width=10 Height=17 Color=12632256 Font=[Consolas,28,1,0,204] Visible=1 Caption=">" ColorHover=255 Point(doVisible) link(onClick,7501453:doStart,[]) } Add(ChildPanel,3917293,182,147) { link(Data1,2953706:Left,[]) link(Data2,2953706:Top,[]) } BEGIN_SDK Add(EditMulti,1790418,21,21) { WorkCount=2 DataCount=2 Width=433 Height=284 link(doWork1,6414238:doEvent1,[(100,27)(100,69)]) link(doWork2,2341891:In,[]) } Add(Panel,2581579,63,119) { Left=5 Top=40 Width=568 Height=416 } Add(Image,2974248,196,63) { Left=2 Top=2 Width=644 Height=407 Color=12639424 ViewStyle=1 Point(onMouseWheel) Point(doWidth) Point(doHeight) Point(doLeft) Point(doTop) Point(ImageWidth) Point(ImageHeight) Point(Left) Point(Top) Point(Width) Point(Height) Point(MouseX) Point(MouseY) Point(Handle) Point(onMouseEnter) Point(onMouseLeave) link(onClick,38186:doMove,[]) link(onMouseEnter,15155924:doWork1,[]) link(onMouseLeave,15155924:doWork2,[]) } Add(MultiElement,6649246,203,196) { @Hint=#66:Зуммируем и центрируем картинку по курсору мыши, используя скролл.| link(onEvent1,1948744:Cable,[(258,202)(258,142)(154,142)(154,83)]) link(Data1,12049083:Cable,[]) link(Data2,10448568:Var,[]) link(Data3,6676616:Var,[]) AddHint(-156,62,198,26,@Hint) } BEGIN_SDK Add(EditMulti,11369874,21,21) { EventCount=1 WorkCount=2 DataCount=3 Width=832 Height=494 link(doWork1,15398367:doCalc,[(63,27)(63,300)]) link(doWork2,6990747:doCalc,[(35,34)(35,356)]) } Add(Math,14529659,420,357) { OpType=2 ResultType=0 link(onResult,12912451:Wire1,[]) link(Op2,7305812:Var3,[(433,273)]) } Add(Math,9840342,469,364) { OpType=2 ResultType=0 link(onResult,12912451:Wire2,[]) link(Op2,16428207:Var3,[(482,259)]) } Add(Hub,6728913,385,357) { OutCount=4 link(onEvent1,14529659:doOperation,[]) link(onEvent2,9840342:doOperation,[]) link(onEvent3,5554615:doCalc,[]) link(onEvent4,15441322:doCalc,[]) } Add(MathParse,7048634,560,371) { DataCount=3 MathStr="%2-(%2-%3)*%1" ResultType=0 link(onResult,12912451:Wire3,[]) link(X1,7133587:Var2,[]) link(X3,2905274:Wire3,[(580,137)(111,137)]) } Add(MathParse,15552860,658,378) { DataCount=3 MathStr="%2-(%2-%3)*%1" ResultType=0 link(onResult,12912451:Wire4,[]) link(X1,7133587:Var3,[(664,348)]) link(X3,2905274:Wire4,[(678,126)(118,126)]) } Add(MathParse,6990747,105,350) { @Hint=#47:Используем скролл для изменения масштаба +-0.01| MathStr="((%1>0)*(%2+0.19))+\r\n(((%1<0)and(%2>0.0))*(%2-0.19))\r\n" Default=1 link(onResult,7594904:doWork2,[]) link(X2,15211541:Var1,[(118,342)(161,342)(161,411)]) AddHint(-70,74,200,26,@Hint) } Add(Hub,9721823,245,350) { link(onEvent1,5699551:doWork2,[]) link(onEvent2,6728913:doEvent1,[]) } Add(MemFifo,16389379,287,371) { Count=1 link(onData,14395678:doOperation,[(326,377)(326,418)(268,418)(268,433)]) } Add(MathParse,15398367,105,294) { DataCount=4 MathStr="min(%3/%1,%4/%2)" link(onResult,3227651:doEvent1,[]) link(X1,7305812:Var2,[]) link(X2,16428207:Var2,[]) link(X3,2905274:Wire5,[]) link(X4,2905274:Wire6,[]) } Add(Math,14395678,287,427) { OpType=3 link(Op1,15211541:Var2,[]) } Add(GetDataEx,15211541,287,406) { link(Data,16389379:Value1,[]) } Add(Hub,3227651,154,294) { OutCount=3 link(onEvent1,5699551:doWork1,[(277,300)]) link(onEvent2,11915571:doOperation,[]) link(onEvent3,7594904:doWork1,[(186,314)]) } Add(If_else,5973104,196,350) { Type=4 Op2=Real(0.01) link(onTrue,9721823:doEvent1,[]) link(Op2,11915571:Result,[]) } Add(GetDataEx,7133587,560,343) { Angle=3 link(Data,14395678:Result,[(466,348)(466,470)(293,470)]) } Add(GetDataEx,7305812,105,268) { Angle=3 link(Data,2905274:Wire1,[(97,273)]) } Add(HubEx,5699551,273,350) { Angle=1 link(onEvent,16389379:doValue,[(277,377)]) } Add(CableWork,12912451,707,357) { Count=4 link(Cable,11369874:onEvent1,[(742,363)(742,27)]) } Add(CableVar,2905274,91,77) { Count=8 link(Cable,11369874:Data1,[(97,57)(27,57)]) } Add(InfoTip,12370879,112,56) { Info=#19:iW iH L T W H mX mY| Width=127 Height=18 Margin=2 } Add(GetDataEx,16428207,112,254) { Angle=3 link(Data,2905274:Wire2,[(104,259)]) } Add(MathParse,5554615,518,371) { MathStr="%1-%2-8" ResultType=0 PColor(X1,11184640) PColor(X2,16711935) link(onResult,7048634:doCalc,[]) link(X1,2905274:Wire7,[(524,116)(139,116)]) link(X2,11369874:Data2,[(531,48)(34,48)]) } Add(MathParse,15441322,609,378) { MathStr="%1-%2-30" ResultType=0 PColor(X1,11184640) PColor(X2,16711935) link(onResult,15552860:doCalc,[]) link(X1,2905274:Wire8,[(615,106)(146,106)]) link(X2,11369874:Data3,[(622,41)(41,41)]) } Add(Math,11915571,203,301) { OpType=3 Op2=2 } Add(HubEx,7594904,182,350) { link(onEvent,5973104:doCompare,[]) } END_SDK Add(CableEvent,1948744,168,77) { Count=4 link(Wire1,2974248:doWidth,[]) link(Wire2,2974248:doHeight,[]) link(Wire3,2974248:doLeft,[]) link(Wire4,2974248:doTop,[]) } Add(CableData,12049083,203,126) { Count=8 link(Wire1,2974248:ImageWidth,[]) link(Wire2,2974248:ImageHeight,[]) link(Wire3,2974248:Left,[]) link(Wire4,2974248:Top,[]) link(Wire5,2974248:Width,[]) link(Wire6,2974248:Height,[]) link(Wire7,2974248:MouseX,[]) link(Wire8,2974248:MouseY,[]) } Add(MoveWindow,38186,385,63) { link(Handle,2974248:Handle,[(391,50)(327,50)(327,119)(265,119)]) } Add(ChanelToIndex,15155924,287,77) { link(onIndex,6819917:doValue,[]) } Add(Memory,6819917,336,77) { } Add(IndexToChanel,15717583,336,133) { Point(Index) link(onEvent1,6649246:doWork2,[(379,139)(379,236)(195,236)(195,209)]) link(Index,6819917:Value,[]) } Add(Hub,6414238,112,63) { link(onEvent1,2974248:doLoad,[]) link(onEvent2,6649246:doWork1,[(142,76)(142,202)]) } Add(LineBreak,985704,21,63) { Type=1 link(Data,1790418:Data1,[]) Primary=[10448568,189,84] } Add(LineBreak,9230767,28,42) { Type=1 link(Data,1790418:Data2,[]) Primary=[6676616,189,126] } Add(LineBreak,3575438,294,133) { link(Out,15717583:doEvent,[]) Primary=[2341891,-231,-105] } END_SDK Add(LineBreak,16223078,133,154) { link(Out,3917293:doWork2,[]) Primary=[1180587,98,-35] }
и ещё не могу понять как сделать что бы картинка при увеличении (перемещении) не уходила за границы.
|