![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
![]() |
Tue, Apr 2 2013 5:28 PM | Permanent Link |
Peter | Hello,
it would be great, if the TImage-Object had a Repeat-Property (repeat, repeat-x, repeat-y, no-repeat). Thanks in advance & Greetings ... Peter --- Sorry for my weird english |
Wed, Apr 3 2013 7:35 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Peter,
<< it would be great, if the TImage-Object had a Repeat-Property (repeat, repeat-x, repeat-y, no-repeat). >> The only way to repeat images, at least in the way that I think you're referring to, is via a style sheet and a background image, which is not how the TImage works. It uses an actual "img" tag. What are you trying to do ? Perhaps I can suggest another way. Thanks, Tim Young Elevate Software www.elevatesoft.com |
Wed, Apr 3 2013 5:28 PM | Permanent Link |
Peter | Hello Tim,
thanks for your fast reply! i want to fill a TImage with a small seamless tile. The size of the TImage is variable (depends on the desktop-size) so i cannot use a fixed sized picture. Greetings ... Peter --- Sorry for my weird english |
Thu, Apr 4 2013 7:52 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Peter,
<< i want to fill a TImage with a small seamless tile. The size of the TImage is variable (depends on the desktop-size) so i cannot use a fixed sized picture. >> Okay, time for some hacking. ![]() unit BackImage; interface uses WebDOM, WebCore, WebCtrls; type TRepeatType = (rtNone,rtHorizontal,rtVertical,rtBoth); TBackgroundImage = class(TControl) private FImageName: String; FRepeatType: TRepeatType; procedure SetImageName(const Value: String); procedure SetRepeatType(Value: TRepeatType); protected function CreateElement: THTMLElement; override; procedure SetElementBackgroundImage; virtual; procedure SetElementBackgroundRepeat; virtual; public property ImageName: String read FImageName write SetImageName; property RepeatType: TRepeatType read FRepeatType write SetRepeatType; end; implementation { TBackgroundImage } function TBackgroundImage.CreateElement: THTMLElement; begin Result:=CreateHTMLElement('div'); // This *will* change in 1.02, so be forewarned !!!!! // Result:=CreateDispatchableElement(Self,'div'); // 1.02 syntax !!!!! end; procedure TBackgroundImage.SetElementBackgroundImage; begin Base.style.backgroundImage:='url('''+FImageName+''')'; end; procedure TBackgroundImage.SetElementBackgroundRepeat; begin case FRepeatType of rtNone: Base.style.backgroundRepeat:='no-repeat'; rtHorizontal: Base.style.backgroundRepeat:='repeat-x'; rtVertical: Base.style.backgroundRepeat:='repeat-y'; rtBoth: Base.style.backgroundRepeat:='repeat'; end; end; procedure TBackgroundImage.SetImageName(const Value: String); begin if (Value <> FImageName) then begin FImageName:=Value; SetElementBackgroundImage; end; end; procedure TBackgroundImage.SetRepeatType(Value: TRepeatType); begin if (Value <> FRepeatType) then begin FRepeatType:=Value; SetElementBackgroundRepeat; end; end; end. And you use it like this (in this case, it's creating it on a panel on a form): procedure TForm2.Button7Click(Sender: TObject); begin with TBackgroundImage.Create(Panel1) do begin Top:=232; Left:=8; Height:=257; Width:=505; ImageName:='heart.png'; RepeatType:=rtBoth; Visible:=True; end; end; If you have any other questions, please let me know. Tim Young Elevate Software www.elevatesoft.com |
Thu, Apr 4 2013 4:44 PM | Permanent Link |
Peter | Hello Tim,
> unit BackImage; > [...] Wonderful! Works like a charm. I love EWB (and you ![]() Thanks a lot & Greetings ... Peter --- Sorry for my weird english |
This web page was last updated on Tuesday, November 28, 2023 at 10:08 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |