Click here to Skip to main content
15,886,110 members
Articles / Operating Systems / Windows

WPF Chart Control With Pan, Zoom and More

Rate me:
Please Sign up or sign in to vote.
4.92/5 (42 votes)
10 Dec 2012Public Domain10 min read 386.6K   10.9K   174  
Chart Control for Microsoft .NET 3.0/WPF with pan, zoom, and offline rendering to the clipboard for custom sizes.
//Copyright (c) Microsoft Corporation.  All rights reserved.

#pragma once
#include "DXGISurface.h"

namespace  Microsoft { namespace WindowsAPICodePack { namespace DirectX { namespace DXGI {

using namespace System;

    /// <summary>
    /// The Surface1 interface extends the Surface by adding support for rendering to a DXGI interface using GDI.
    /// <para>(Also see DirectX SDK: IDXGISurface1)</para>
    /// </summary>
    public ref class Surface1 :
        public Microsoft::WindowsAPICodePack::DirectX::DXGI::Surface
    {
    public: 
        /// <summary>
        /// Returns a device context (DC) that allows you to render to a DXGI surface using GDI.
        /// <para>(Also see DirectX SDK: IDXGISurface1::GetDC)</para>
        /// </summary>
        /// <param name="Discard">If true the application will not preserve any rendering with GDI; otherwise, false.           If false, any previous rendering to the device context will be preserved.           This flag is ideal for simply reading the device context and not doing any rendering to the surface.</param>
        /// <returns>A HDC handle that represents the current device context for GDI rendering.</returns>
        IntPtr GetDC(Boolean Discard);

        /// <summary>
        /// Releases the GDI device context (DC) associated with the current surface and allows rendering using Direct3D.
        /// <para>(Also see DirectX SDK: IDXGISurface1::ReleaseDC)</para>
        /// </summary>
        /// <param name="DirtyRect">A RECT structure that identifies the dirty region of the surface.            A dirty region is any part of the surface that you have used for GDI rendering and that you want to preserve.           This is used as a performance hint to graphics subsystem in certain scenarios.           Do not use this parameter to restrict rendering to the specified rectangular region.           Passing in NULL causes the whole surface to be considered dirty.           Otherwise the area specified by the RECT will be used as a performance hint to indicate what areas have been manipulated by GDI rendering.</param>
        void ReleaseDC(D3dRect DirtyRect);
    internal:
        Surface1()
        {
        }
    internal:

        Surface1(IDXGISurface1* pNativeIDXGISurface1)
        {
            Attach(pNativeIDXGISurface1);
        }

    };
} } } }

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Founder Cheesy Design
Taiwan Taiwan
John graduated from the University of South Australia in 1997 with a Bachelor of Electronic Engineering Degree, and since then he has worked on hardware and software in many fields including Aerospace, Defence, and Medical giving him over 10 of years experience in C++ and C# programming. In 2009 John Started his own contracting company doing business between Taiwan and Australia.

Comments and Discussions