Click here to Skip to main content
Click here to Skip to main content

WebPage as MDI Background In TangramLite

, 21 Aug 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
WebPage as MDI Background and Interact with User

HTML Background:

Click "Create New Document" Button:

Navigate to some URL:

New Document:

Introduction

Generally, there is a bitmap of company Logo as the background of MDI window. Sometimes, you may need a dynamic picture or more interactive ability. Here I will tell you how do it using TangranLite framework.

Config Background for MDI

You may download TangramLite first. After you setup, you can see "OS:\Program Files\TangramLite\debug" directory on your disk. There are samples we prepare for you.

Open "TangramLiteD.exe.config" file. This the config file for "TangramLiteD.exe", actually, this is XML format. You may see two nodes:

<BackgroundType>html</BackgroundType>
<BackgroundFile>background.htm</BackgroundFile>

The first node specifies what type of background, here we want HTML. The second node specifies the filename of the HTML. But where is it located? You can find it here:

"OS:\Program Files\TangramUniverseDocument\Tangram Team\TangramLite\Background"

Now you can change it with your HTML page.

Interact with HTML

How can we interact with HTML? When we create a CHTMLView and navigate to a special HTML file, the webbrowser gets IDispatch interface of a COM object. Then we can write a script to invoke methods of the object through IDispatch. COM object's method can call native code. Open "C:\Program Files\TangramUniverseDocument\Tangram Team\TangramLite\Background\Background.htm" in Notepad or other editor to see source. We can find the script:

<!--
Sub Button1_onclick
 window.external.NewDocument
End Sub

Sub Button2_onclick
 window.external.opendoc
End Sub
-->

That means when you click Button1, it will invoke "NewDocument" method of theCOM object. We do an action in the method in fact. Open sample project "TangramLiteMainFrameD", there, you can find an interface "IApplication", it has a method "TangramLiteMainFrameD". We do NewDocument in the method implementation.

History

  • 21st August, 2006: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

wlwlxj
Web Developer
China China
I've been programming since I was 21. Started with C++, looked at Java, keen on Visual Basic and Visual C++, thinking about .NET and C#.^_^.
My Email:wlwlxj@google.com

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 21 Aug 2006
Article Copyright 2006 by wlwlxj
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid