LayoutEngineとは? わかりやすく解説

LayoutEngine クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

レイアウト エンジン実装するための基本クラス提供します

名前空間: System.Windows.Forms.Layout
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public MustInherit Class
 LayoutEngine
public abstract class LayoutEngine
public ref class LayoutEngine abstract
public abstract class LayoutEngine
解説解説
使用例使用例

LayoutEngine クラス使用してカスタム レイアウト動作実装する方法を示すコード例次に示します

Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Windows.Forms.Layout

' This class demonstrates a simple custom layout panel.
' It overrides the LayoutEngine property of the Panel
' control to provide a custom layout engine. 
Public Class DemoFlowPanel
    Inherits Panel

    Private layoutEng As DemoFlowLayout

    Public Sub New()
    End Sub

    Public Overrides ReadOnly
 Property LayoutEngine() As LayoutEngine
        Get
            If layoutEng Is Nothing
 Then
                layoutEng = New DemoFlowLayout()
            End If

            Return layoutEng
        End Get
    End Property
End Class

' This class demonstrates a simple custom layout engine.
Public Class DemoFlowLayout
   Inherits LayoutEngine

    Public Overrides Function
 Layout( _
    ByVal container As Object,
 _
    ByVal layoutEventArgs As LayoutEventArgs)
 As Boolean

        Dim parent As Control = container

        ' Use DisplayRectangle so that parent.Padding is honored.
        Dim parentDisplayRectangle As Rectangle
 = parent.DisplayRectangle
        Dim nextControlLocation As Point =
 parentDisplayRectangle.Location

        Dim c As Control
        For Each c In parent.Controls

            ' Only apply layout to visible controls.
            If c.Visible <> True Then
                Continue For
            End If

            ' Respect the margin of the control:
            ' shift over the left and the top.
            nextControlLocation.Offset(c.Margin.Left, c.Margin.Top)

            ' Set the location of the control.
            c.Location = nextControlLocation

            ' Set the autosized controls to their 
            ' autosized heights.
            If c.AutoSize Then
                c.Size = c.GetPreferredSize(parentDisplayRectangle.Size)
            End If

            ' Move X back to the display rectangle origin.
            nextControlLocation.X = parentDisplayRectangle.X

            ' Increment Y by the height of the control 
            ' and the bottom margin.
            nextControlLocation.Y += c.Height + c.Margin.Bottom
        Next c

        ' Optional: Return whether or not the container's 
        ' parent should perform layout as a result of this 
        ' layout. Some layout engines return the value of 
        ' the container's AutoSize property.
        Return False

    End Function
End Class
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Layout;

// This class demonstrates a simple custom layout panel.
// It overrides the LayoutEngine property of the Panel
// control to provide a custom layout engine. 
public class DemoFlowPanel : Panel
{
    private DemoFlowLayout layoutEngine;

    public DemoFlowPanel()
    {
    }

    public override LayoutEngine LayoutEngine
    {
        get
        {
            if (layoutEngine == null)
            {
                layoutEngine = new DemoFlowLayout();
            }

            return layoutEngine;
        }
    }
}

// This class demonstrates a simple custom layout engine.
public class DemoFlowLayout : LayoutEngine
{
    public override bool Layout(
        object container,
        LayoutEventArgs layoutEventArgs)
    {
        Control parent = container as Control;

        // Use DisplayRectangle so that parent.Padding is honored.
        Rectangle parentDisplayRectangle = parent.DisplayRectangle;
        Point nextControlLocation = parentDisplayRectangle.Location;

        foreach (Control c in parent.Controls)
        {
            // Only apply layout to visible controls.
            if (!c.Visible)
            {
                continue;
            }

            // Respect the margin of the control:
            // shift over the left and the top.
            nextControlLocation.Offset(c.Margin.Left, c.Margin.Top);

            // Set the location of the control.
            c.Location = nextControlLocation;

            // Set the autosized controls to their 
            // autosized heights.
            if (c.AutoSize)
            {
                c.Size = c.GetPreferredSize(parentDisplayRectangle.Size);
            }

            // Move X back to the display rectangle origin.
            nextControlLocation.X = parentDisplayRectangle.X;

            // Increment Y by the height of the control 
            // and the bottom margin.
            nextControlLocation.Y += c.Height + c.Margin.Bottom;
        }

        // Optional: Return whether or not the container's 
        // parent should perform layout as a result of this 
        // layout. Some layout engines return the value of 
        // the container's AutoSize property.

        return false;
    }
}
#using <System.Drawing.dll>
#using <System.dll>
#using <System.Windows.Forms.dll>

using namespace System;
using namespace System::Collections::Generic;
using namespace System::Drawing;
using namespace System::Text;
using namespace System::Windows::Forms;
using namespace System::Windows::Forms::Layout;

// This class demonstrates a simple custom layout engine.
public ref class DemoFlowLayout : public
 LayoutEngine
{
public:
    virtual bool Layout(Object^ container,
        LayoutEventArgs^ layoutEventArgs) override
    {
        Control^ parent = nullptr;
        try
        {
            parent = (Control ^) container;
        }
        catch (InvalidCastException^ ex)
        {
            throw gcnew ArgumentException(
                "The parameter 'container' must be a control", "container",
 ex);
        }
        // Use DisplayRectangle so that parent.Padding is honored.
        Rectangle parentDisplayRectangle = parent->DisplayRectangle;
        Point nextControlLocation = parentDisplayRectangle.Location;

        for each (Control^ currentControl in
 parent->Controls)
        {
            // Only apply layout to visible controls.
            if (!currentControl->Visible)
            {
                continue;
            }

            // Respect the margin of the control:
            // shift over the left and the top.
            nextControlLocation.Offset(currentControl->Margin.Left,
                currentControl->Margin.Top);

            // Set the location of the control.
            currentControl->Location = nextControlLocation;

            // Set the autosized controls to their
            // autosized heights.
            if (currentControl->AutoSize)
            {
                currentControl->Size = currentControl->GetPreferredSize(
                    parentDisplayRectangle.Size);
            }

            // Move X back to the display rectangle origin.
            nextControlLocation.X = parentDisplayRectangle.X;

            // Increment Y by the height of the control
            // and the bottom margin.
            nextControlLocation.Y += currentControl->Height +
                currentControl->Margin.Bottom;
        }

        // Optional: Return whether or not the container's
        // parent should perform layout as a result of this
        // layout. Some layout engines return the value of
        // the container's AutoSize property.

        return false;
    }
};

// This class demonstrates a simple custom layout panel.
// It overrides the LayoutEngine property of the Panel
// control to provide a custom layout engine.
public ref class DemoFlowPanel : public
 Panel
{
private:
    DemoFlowLayout^ layoutEngine;

public:
    DemoFlowPanel()
    {
        layoutEngine = gcnew DemoFlowLayout();
    }

public:
    virtual property System::Windows::Forms::Layout::LayoutEngine^ LayoutEngine
    {
        System::Windows::Forms::Layout::LayoutEngine^ get() override
        {
            if (layoutEngine == nullptr)
            {
                layoutEngine = gcnew DemoFlowLayout();
            }

            return layoutEngine;
        }
    }
};

継承階層継承階層
System.Object
  System.Windows.Forms.Layout.LayoutEngine
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

LayoutEngine コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

LayoutEngine クラス新しインスタンス初期化します。

名前空間: System.Windows.Forms.Layout
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

protected LayoutEngine ()
protected:
LayoutEngine ()
protected LayoutEngine ()
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LayoutEngine クラス
LayoutEngine メンバ
System.Windows.Forms.Layout 名前空間

LayoutEngine メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

LayoutEngine クラス
System.Windows.Forms.Layout 名前空間

その他の技術情報

方法 : カスタム レイアウト エンジン実装する

LayoutEngine メンバ

レイアウト エンジン実装するための基本クラス提供します

LayoutEngine データ型公開されるメンバを以下の表に示します


プロテクト コンストラクタプロテクト コンストラクタ
  名前 説明
プロテクト メソッド LayoutEngine LayoutEngine クラス新しインスタンス初期化します。
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

LayoutEngine クラス
System.Windows.Forms.Layout 名前空間

その他の技術情報

方法 : カスタム レイアウト エンジン実装する

レンダリングエンジン

(LayoutEngine から転送)

出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2021/07/28 10:03 UTC 版)

レンダリングエンジン (rendering engine) とは、レンダリングを行うソフトウェア部品。情報(データ)を読み込んで、特定のルールにしたがい適切な表現に変換する役割を担う。レイアウトエンジン (layout engine)、レンダラー (renderer) ともいう。




「レンダリングエンジン」の続きの解説一覧


英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「LayoutEngine」の関連用語

LayoutEngineのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



LayoutEngineのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.
ウィキペディアウィキペディア
All text is available under the terms of the GNU Free Documentation License.
この記事は、ウィキペディアのレンダリングエンジン (改訂履歴)の記事を複製、再配布したものにあたり、GNU Free Documentation Licenseというライセンスの下で提供されています。 Weblio辞書に掲載されているウィキペディアの記事も、全てGNU Free Documentation Licenseの元に提供されております。

©2024 GRAS Group, Inc.RSS