Jump to content

UniPanel Background


Serg

Recommended Posts

1 hour ago, Serg said:

Во время работы программы меняю фон панели 

Но ничего не происходит

Как обходное решение, попробуйте этот код:

  with UniPanel1 do
  begin
    JSInterface.JSCall('setBodyStyle', ['background', 'url(files/tulips.jpg)']);
    if Background.Fit then
      JSInterface.JSCall('setBodyStyle', ['background-size', '100%']);
  end;

 

Link to comment
Share on other sites

  • 6 months later...
On 6/21/2019 at 2:18 AM, Sherzod said:

Как обходное решение, попробуйте этот код:


  with UniPanel1 do
  begin
    JSInterface.JSCall('setBodyStyle', ['background', 'url(files/tulips.jpg)']);
    if Background.Fit then
      JSInterface.JSCall('setBodyStyle', ['background-size', '100%']);
  end;

 

Does not work,sorry!

How to do?

Link to comment
Share on other sites

On 1/12/2020 at 5:03 AM, 55143681 said:

see the testPanelD.zip please

Hello,

Firstly, in your test case, there are two folders named "files", image is located in the wrong folder.

Secondly, the UniPanel.Background.Fit property is not set True, therefore, you will not see the image, since the size is not small (1920x1200)

 

Also try this modified code:

  with UniPanel1 do
  begin
    JSInterface.JSCall('setBodyStyle', ['background-image', 'url(files/111.jpg)']);
    JSInterface.JSCall('setBodyStyle', ['background-repeat', 'no-repeat']);
    JSInterface.JSCall('setBodyStyle', ['background-position', 'center']);

    if Background.Fit then
      JSInterface.JSCall('setBodyStyle', ['background-size', '100%']);
  end;

 

Link to comment
Share on other sites

On 1/14/2020 at 6:48 PM, Sherzod said:

Hello,

Firstly, in your test case, there are two folders named "files", image is located in the wrong folder.

Secondly, the UniPanel.Background.Fit property is not set True, therefore, you will not see the image, since the size is not small (1920x1200)

 

Also try this modified code:


  with UniPanel1 do
  begin
    JSInterface.JSCall('setBodyStyle', ['background-image', 'url(files/111.jpg)']);
    JSInterface.JSCall('setBodyStyle', ['background-repeat', 'no-repeat']);
    JSInterface.JSCall('setBodyStyle', ['background-position', 'center']);

    if Background.Fit then
      JSInterface.JSCall('setBodyStyle', ['background-size', '100%']);
  end;

 

Thanks a lot,Sherzod,works well for delphi,

but I use unigui1514+cbuilder10.3.3,

that doesn't work,

 Is there any wrong with my code?

help me please,thanks.

void __fastcall TUniFormStartBoard::UniBitBtn14Click(TObject *Sender)
{
UniPanelA->JSInterface->JSCall("setBodyStyle", "['background', 'url(files/111.jpg)']");
UniPanelA->JSInterface->JSCall("setBodyStyle","['background-repeat', 'no-repeat']");
UniPanelA->JSInterface->JSCall("setBodyStyle","['background-position', 'center']");
if(UniPanelA->Background->Fit)
    UniPanelA->JSInterface->JSCall("setBodyStyle","['background-size', '100%']");
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...