2016-12-05 6 views
0

私のwinformはサイズを変更できません。 winceデバイスは480 * 764です。私は、デバッグおよび新しいサイズました:WINCE winformはサイズを変更できません

debug

しかし、サイズはまだ変わらないし。何が起こった?

+0

FormBorderStyleをsizableに設定する必要があります。 –

+0

@AdrianStanculescu:ほとんどのC#開発者は、Windows CEで作業するときにCompact Frameworkを使用しています。正しい場合、CFでサポートされている唯一の境界線スタイルは、None、FixedSingle、およびFixedDialogです。 – AlainD

+0

2a4b8c2b:.NET Framework 2.0または3.5のCompact Frameworkバージョンを使用している場合は、質問にそのタグを追加するか、タグを追加してください。 – AlainD

答えて

0

Loadイベントではなく、サイズ変更コードをコンストラクタに入れてみてください。 FormBorderStyleがサイズが必要であるとは思わないでください(使用していると思われる.NET Compact Frameworkでもサポートされていますか?)。フォームのスタイルはFixedDialogです。フォームを中央揃えする必要がある場合は、サイズを設定した直後に呼び出すヘルパー関数を使用できます。

public static void SetFormPosition(Form frmChild) 
{ 
    // Set the form position on the Windows CE panel 
    if (frmChild != null) 
    { 
     // Get the size of the screen (should be 480x768) 
     Rectangle rctScreen = Screen.PrimaryScreen.WorkingArea; 

     // Now calculate the position of the form 
     int nPosX = ((rctScreen.Width - frmChild.Width)/2); 
     int nPosY = ((rctScreen.Height - frmChild.Height)/2); 

     // Set the position 
     frmChild.Location = new Point(nPosX, nPosY); 
    } 
} 
関連する問題