symbian 介面繪製

來源:互聯網
上載者:User
裝置, 軟體 版本:

S60 3rd Edition

S60 3rd Edition, FP1

詳細描述:

預設情況下,程式是根據手機螢幕的當前方向開始啟動的。如果要強製程序以橫屏或豎屏的模式啟動,那我們在CAknAppUi::ConstructL()方法中調用BaseConstructL()時就要傳遞相應的flag值:

void CMyAppUi::ConstructL()
{
BaseConstructL( EAknEnableSkin | EAppOrientationLandscape ); // start in landscape mode
...
}

如果要在程式運行期間改變方向,則需要調用:

void CAknAppUiBase::SetOrientationL( TAppUiOrientation aOrientation );

這裡的參數為EAppUiOrientationLandscape和EAppUiOrientationPortrait,注意這種情況下的調用就不要再向BaseConstructL()中傳遞相同的參數了。

注意

  • 橫屏(landscape),前者是橫幅,一般多用在風景照,所以叫"landscape"。
  • 豎屏(portrait),後者是直幅,一般多用在肖像上,所以叫"portrait"。

 symbian 介面繪製收藏
 
全屏
構造container時,將AppUi()->ApplicationRect()做為參數aRect傳遞進去。
然後在container建構函式中調用SetRect(aRect);這樣即可全螢幕顯示
 
隱藏狀態列
      CEikStatusPane* statusPane = StatusPane();    
            statusPane->MakeVisible( EFalse );   
 
旋轉螢幕
2.8,3.0 SDK支援旋轉螢幕,程式裡面可以捕獲該訊息,然而使UI自訂的改變位置
繼承的函數為:Container::HandleResourceChange,原先的SizeChange這個函數不會響應
 
在該函數內不要使用AppUi->ClientRect函數來擷取工作區範圍,資料會有偏差(這個問題鬱悶了好久),可以使用
TRect rect;
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,rect );
來擷取RECT 
 
 
全屏到正常
User "SetRect" inside your container. Pass in the original client area rect parameter back to the CCoeControl.

You may use the following code:

1) Before calling "SetExtentToWholeScreen", save the rect:

iRect = Rect();

Gets the control's extent

2) call "SetExtentToWholeScreen"

3) Switch back:

SetRect( iRect );
 
 
擷取當前旋轉狀態
http://wiki.forum.nokia.com/index.php/How_to_get_the_Current_Orientation

#include <aknappui.h>
 
CCoeEnv* env = CCoeEnv::Static();
if( env )
    {
    CAknAppUiBase* appUiBase = REINTERPRET_CAST( CAknAppUiBase*, env->AppUi() );
    if( appUiBase )
        {
        /*
        * Possible values for TAppUiOrientation are :
        * EAppUiOrientationUnspecified,
        * EAppUiOrientationPortrait,
        * EAppUiOrientationLandscape,
        * EAppUiOrientationAutomatic
        **/
        CAknAppUiBase::TAppUiOrientation orientation = appUiBase->Orientation();
        }
    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.