Jump to content

UniPanel Background


Serg

Recommended Posts

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

MainForm.UniPanel10.Background.URL:='111.jpg';

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


 

Link to comment
Share on other sites

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...