前回(「WPFを学習する(2)」)で、「『両者は似たようで非なるものだ』という印象を強くし」たと書きましたが、

 

 vs 

C#の膨大なクラス等すべての対比をするわけにはいかないので、サンプルとして前回作ったウィンドウ(WinFormではFormクラス、WPFではWindowクラス)に関わるプロパティ、メソッド、イベントをWindowクラスとFormクラスで対比してみようと思います。

出典はMS Learningですので、個々の詳細はご自身で確認してください。

 

【WindowクラスとFormクラスの対比】

Window Form
プロパティ AllowsTransparency プロパティ AcceptButton
Dialogresult Activeform
アイコン ActiveMdiChild
IsActive AllowTransparency
Left Autoscale
LogicalChildren AutoScaleBaseSize
OwnedWindows 自動スクロール
所有者 AutoSize
ResizeMode AutoSizeMode
RestoreBounds AutoValidate
ShowActivated BackColor
ShowInTaskbar CancelButton
SizeToContent ClientSize
TaskbarItemInfo ControlBox
タイトル CreateParams
DefaultImeMode
最 上位 DefaultSize
WindowStartupLocation DesktopBounds
WindowState DesktopLocation
[WindowStyle] Dialogresult
メソッド アクティブ化 FormBorderStyle
ArrangeOverride HelpButton
閉じる アイコン
DragMove IsMdiChild
GetWindow IsMdiContainer
非表示 IsRestrictedWindow
MeasureOverride KeyPreview
OnActivated 場所
OnClosed MainMenuStrip
OnClosing 余白
OnContentChanged MaximizeBox
OnContentRendered MaximizedBounds
OnCreateAutomationPeer MaximumSize
OnDeactivated MdiChildren
OnDpiChanged MdiChildrenMinimizedAnchorBottom
OnLocationChanged MdiParent
OnManipulationBoundaryFeedback MinimizeBox
OnSourceInitialized MinimumSize
OnStateChanged モーダル
OnVisualChildrenChanged Opacity
OnVisualParentChanged OwnedForms
表示 所有者
ShowDialog RestoreBounds
イベント アクティブ RightToLeftLayout
Closed ShowIcon
閉じる ShowInTaskbar
ContentRendered ShowWithoutActivation
非アクティブ化 サイズ
DpiChanged SizeGripStyle
LocationChanged StartPosition
SourceInitialized TabIndex
StateChanged TabStop
  Text
TopLevel
最 上位
TransparencyKey
WindowState
メソッド アクティブ化
ActivateMdiChild
AddOwnedForm
AdjustFormScrollbars
ApplyAutoScaling
CenterToParent
CenterToScreen
閉じる
CreateAccessibilityInstance
CreateControlsInstance
CreateHandle
DefWndProc
Dispose
GetAutoScaleSize
GetScaledBounds
Layoutmdi
OnActivated
OnBackgroundImageChanged
OnBackgroundImageLayoutChanged
OnClosed
OnClosing
OnCreateControl
OnDeactivate
OnDpiChanged
OnEnabledChanged
Onenter
OnFontChanged
OnFormClosed
OnFormClosing
OnGetDpiScaledSize
OnGotFocus
OnHandleCreated
OnHandleDestroyed
OnHelpButtonClicked
OnInputLanguageChanged
OnInputLanguageChanging
OnLayout
Onload
OnMaximizedBoundsChanged
OnMaximumSizeChanged
OnMdiChildActivate
OnMenuComplete
OnMenuStart
OnMinimumSizeChanged
OnPaint
Onresize
OnResizeBegin
OnResizeEnd
OnRightToLeftLayoutChanged
OnShown
OnStyleChanged
OnTextChanged
OnVisibleChanged
ProcessCmdKey
ProcessDialogChar
ProcessDialogKey
ProcessKeyPreview
ProcessMnemonic
ProcessTabKey
RemoveOwnedForm
ScaleControl
ScaleCore
ScaleMinMaxSize
Select
SetBoundsCore
SetClientSizeCore
SetDesktopBounds
SetDesktopLocation
SetVisibleCore
表示
ShowDialog
ToString
UpdateDefaultButton
ValidateChildren
Wndproc
イベント アクティブ
AutoSizeChanged
AutoValidateChanged
Closed
閉じる
非アクティブ化
DpiChanged
FormClosed
FormClosing
HelpButtonClicked
InputLanguageChanged
InputLanguageChanging
[読み込み]
MarginChanged
MaximizedBoundsChanged
MaximumSizeChanged
MdiChildActivate
MenuComplete
MenuStart
MinimumSizeChanged
ResizeBegin
ResizeEnd
RightToLeftLayoutChanged
表示
TabIndexChanged
TabStopChanged

 

これだけで、Microsoftが大ナタを振るってクラスを書き換えていることが分かります。でも、過去の遺産にとらわれず、すっぱりと簡素化している点は好感が持てますね。