How to skin TWebBrowser ?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #35316
    guyinwonder
    Participant

    Does Anyone knows how to skin TWebBrowser ? Could some one share?

    #48798
    Hamilton
    Participant

    I don't have a good reply for ya but no one else has jumped in so I thought I'd offer something! Anyway I wouldn't do component development for a one-off use myself, and would recommend doing something manual like the code below which does a similar thing for a TsCategoryPanel.

    procedure TfdPOSDesigner.ResetColour;
    begin
    cpgProperties.Color := sSkinManager1.GetActiveEditColor;
    cpgProperties.GradientBaseColor := sSkinManager1.GetActiveEditColor;
    cpgProperties.GradientColor := sSkinManager1.GetHighLightColor;
    cpgProperties.HeaderFont.Color := sSkinManager1.GetActiveEditFontColor;
    cpgProperties.ChevronColor := sSkinManager1.GetActiveEditFontColor;
    cpgProperties.ChevronHotColor := sSkinManager1.GetHighLightFontColor;

    CategoryPanel1.Color := sSkinManager1.GetGlobalColor;
    CategoryPanel1.Font.Color := sSkinManager1.GetGlobalFontColor;
    CategoryPanel2.Color := sSkinManager1.GetGlobalColor;
    CategoryPanel2.Font.Color := sSkinManager1.GetGlobalFontColor;
    CategoryPanel3.Color := sSkinManager1.GetGlobalColor;
    CategoryPanel3.Font.Color := sSkinManager1.GetGlobalFontColor;

    Basically what I'm suggesting is to use the skin color that you can get a handle to conveniently and using those to manually skin the component. You could implement the call to ResetColor in an inherited Create event or similar, or call it manually in your code in FormCreate or similar. Something like:

    TMyWebBrowser = class(TWebBrowser)

    private

    procedure ResetColor;

    public

    constructor Create(Sender: TObject); override;

    end;

    TMyWebBrowser.Create(Sender: TObject);

    begin

    inherited;

    ResetColor;

    end;

    end;

    #48799
    Hamilton
    Participant

    The code for ResetColor lost it's formatting when I copied it into this thread; please refer to the formatted code for the same function at http://www.alphaskin…?showtopic=6544 instead.

    #48800
    guyinwonder
    Participant
    'Hamilton' wrote:

    The code for ResetColor lost it's formatting when I copied it into this thread; please refer to the formatted code for the same function at http://www.alphaskin…?showtopic=6544 instead.

    ok will try that.. and get back to you when i got the result 😀

    #48810
    guyinwonder
    Participant
    'Hamilton' wrote:

    The code for ResetColor lost it's formatting when I copied it into this thread; please refer to the formatted code for the same function at http://www.alphaskin…?showtopic=6544 instead.

    I play around with it and still dont get it on how to implement your script by making the twebbrowser descendant.

    by using the component it self the twebbrowser didnt exposed any color properties or font properties as this is an olecontrol .

    all i need is the frame got skinned and the scroll bar too i have try by adding it to the thirdparty and stated it as scrollcontrol but no luck .

    #48811
    Hamilton
    Participant

    I found this code that may help you. Didn't have time to test it sorry and it doesn't address the frame color; I'm hoping that if this works you'll be able to use it to decipher the rest of the puzzle. GL!

    Code:
    with WebBrowser1 do
    begin
    OleObject.document.body.Style.scrollbarFaceColor := '#FF6699';
    OleObject.Document.body.Style.scrollbarTrackColor := '#CCCC99';
    OleObject.document.body.Style.scrollbarHighlightColor := '#99FF99';
    OleObject.document.body.Style.scrollbar3DLightColor := '#6699CC';
    OleObject.Document.body.Style.scrollbarShadowColor := '#6600FF';
    OleObject.document.body.Style.scrollbarDarkShadowColor := '#00CC66';
    OleObject.document.body.Style.scrollbarArrowColor := '#336699';
    end;

    Another snippet, though it is probably bad practice to do this unless you have control over the pages being viewed:

    Code:
    WebBrowser1.OleObject.Document.bgColor := '#000000';
    #48812
    Hamilton
    Participant

    This link shows how to set the border. Again, I haven't tested it so GL!

    http://www.swissdelp…ode.php?id=1171

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.