由于 CBrCtlInterface 的特殊性,在创建的时候有些注意的。注:本文仅说明创建是的功能,对于如何使用,可以上网搜一下。
void CWebContainer::ConstructL(const TRect& aRect)
{
//Create a window for this application view
CreateWindowL();
//注意1:传入的 aRect 为客户区区域,左上角不为(0,0 )。刚开始是,我直接将此函数传入 CreateBrowserControlL ,结果是控件不能画满
TRect iRect;
TPoint iP = TPoint(0,0);
iRect.SetRect( iP, aRect.iBr);
SetRect( aRect );
//SetExtentToWholeScreen();
//Add the browser
iBrowser = CreateBrowserControlL( this,
iRect,
iCapabilities,
iCommandBase,
NULL,
NULL,
NULL,
NULL,
NULL
);
iBrowser->ActivateL();
if( iBrowser )
{
iBrowser->AddLoadEventObserverL( this );
//注意2:上边注释去的一行是标准设置,下一行是显示中文是的设置。
//iBrowser->SetBrowserSettingL( TBrCtlDefs::ESettingsFontSize, TBrCtlDefs::EFontSizeLevelNormal );
iBrowser->SetBrowserSettingL( TBrCtlDefs::ESettingsCharacterset, KCharacterSetIdentifierUtf8 );
}
ActivateL();
}