ID2D1StrokeStyle 介面 (d2d1.h)

描述筆劃的上限、斜線限制、線條聯結和虛線資訊。

繼承

ID2D1StrokeStyle 介面繼承自 ID2D1ResourceID2D1StrokeStyle 也有下列類型的成員:

方法

ID2D1StrokeStyle 介面具有這些方法。

 
ID2D1StrokeStyle::GetDashCap

取得值,指定如何繪製每個虛線的結尾。
ID2D1StrokeStyle::GetDashes

將虛線圖樣複製到指定的陣列。
ID2D1StrokeStyle::GetDashesCount

擷取虛線數位中的項目數目。
ID2D1StrokeStyle::GetDashOffset

擷取值,指定筆劃在虛線序列中開始的距離。
ID2D1StrokeStyle::GetDashStyle

取得值,描述筆劃的虛線圖樣。
ID2D1StrokeStyle::GetEndCap

擷取筆劃結尾所使用的圖形類型。
ID2D1StrokeStyle::GetLineJoin

擷取圖形外框頂點所使用的聯結類型。
ID2D1StrokeStyle::GetMiterLimit

擷取斜線長度與筆劃粗細一半的比例限制。
ID2D1StrokeStyle::GetStartCap

擷取筆劃開頭所使用的圖形類型。

備註

建立 ID2D1StrokeStyle 物件

若要建立筆劃樣式,請使用 ID2D1Factory::CreateStrokeStyle 方法。

筆劃樣式是裝置無關的資源;您可以建立它一次,然後保留應用程式存留期。 如需資源的詳細資訊,請參閱 資源概觀

範例

下列範例會建立使用自定義虛線圖樣的筆劃。

// Dash array for dashStyle D2D1_DASH_STYLE_CUSTOM
float dashes[] = {1.0f, 2.0f, 2.0f, 3.0f, 2.0f, 2.0f};

// Stroke Style with Dash Style -- Custom
if (SUCCEEDED(hr))
{
    hr = m_pD2DFactory->CreateStrokeStyle(
        D2D1::StrokeStyleProperties(
            D2D1_CAP_STYLE_FLAT,
            D2D1_CAP_STYLE_FLAT,
            D2D1_CAP_STYLE_ROUND,
            D2D1_LINE_JOIN_MITER,
            10.0f,
            D2D1_DASH_STYLE_CUSTOM,
            0.0f),
        dashes,
        ARRAYSIZE(dashes),
        &m_pStrokeStyleCustomOffsetZero
        );
}

下一個範例會在繪製線條時使用筆劃樣式。

m_pRenderTarget->DrawLine(
    D2D1::Point2F(0, 310),
    D2D1::Point2F(200, 310),
    m_pCornflowerBlueBrush,
    10.0f,
    m_pStrokeStyleCustomOffsetZero
    );

規格需求

需求
最低支援的用戶端 適用於 Windows Vista 的 Windows 7、Windows Vista SP2 和平臺更新 [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器 Windows Server 2008 R2、Windows Server 2008 SP2 和 Platform Update for Windows Server 2008 [傳統型應用程式 |UWP 應用程式]
目標平台 Windows
標頭 d2d1.h

另請參閱

ID2D1Factory::CreateStrokeStyle

ID2D1Resource