FAQ
ArcObjects における画面の再描画

ナレッジ番号:5301 | 登録日:2023/07/26 | 更新日:2023/12/28

概要

プログラムで画面の表示状態が変更される操作を行った場合は、マップやコンテンツ ウィンドウなどに明示的に再描画用メソッドを実行します。

サンプル コード

アクティブなビューを再描画

アクティブなビューは、IActiveView インタフェースのメンバで再描画します。全体を再描画する方法と、限定した範囲を再描画する方法があります。限定する範囲を指定するにはいくつか方法がありますが、ここでは Envelope オブジェクトを使用して、矩形で範囲を指定して再描画する方法を示します。

IActiveView pActiveView = null;
pActiveView = ArcMap.Document.ActiveView; //ArcMap アドインの場合
//pActiveView = axMapControl1.ActiveView; //MapControl の場合

//アクティブなビュー全体を再描画
pActiveView.Refresh();  

//指定した範囲を再描画
IEnvelope pEnvelope = new EnvelopeClass();
pEnvelope.PutCoords(135, 35, 140, 40);  //範囲を指定
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, pEnvelope);
Dim pActiveView As IActiveView = Nothing
pActiveView = My.ArcMap.Document.ActiveView   'ArcMap アドインの場合
'pActiveView = axMapControl1.ActiveView      'MapControl の場合

'アクティブなビュー全体を再描画
pActiveView.Refresh()

'指定した範囲を再描画
Dim pEnvelope As IEnvelope = New EnvelopeClass()
pEnvelope.PutCoords(135, 35, 140, 40)   '範囲を指定
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, Nothing, pEnvelope)

コンテンツ ウィンドウの再描画

レイヤのシンボル(レンダラー)の変更により凡例が変化した場合は、明示的にコンテンツ ウィンドウを再描画する必要があります。

ArcMap.Document.UpdateContents(); //ArcMap アドインの場合
//axTOCControl1.Update(); //TOCControl の場合
My.ArcMap.Document.UpdateContents() 'ArcMap アドインの場合
'axTOCControl1.Update()  'TOCControl の場合

メタデータ

種類

製品