Click here to Skip to main content
15,883,606 members
Articles / Programming Languages / C#

DSGraphEdit: A Reasonable Facsimile of Microsoft's GraphEdit in .NET

Rate me:
Please Sign up or sign in to vote.
4.93/5 (79 votes)
28 Jan 2018MIT7 min read 295.6K   10K   142  
A library for adding DirectShow GraphEdit-like abilities to .NET applications
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

using DirectShowLib;
using DirectShowLib.DMO;

namespace DaggerLib.DSGraphEdit
{
    [ToolboxItem(false)]
    public class DMOBoolParam : CheckBox
    {
        IMediaParams _param;
        int _paramNum;
        ParamInfo _pInfo;

        public DMOBoolParam(IMediaParams param, int paramNum, ParamInfo pInfo)
        {
            _param = param;
            _paramNum = paramNum;
            _pInfo = pInfo;

            Text = "";
            Size = new System.Drawing.Size(15, 19);
            Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
            
            MPData val;
            param.GetParam(_paramNum, out val);
            if (_pInfo.mopCaps == MPCaps.Jump)
            {
                Checked = val.vBool;
            }
            else
            {
                Checked = (val.vFloat == 0) ? false : true;
            }

            CheckedChanged += new EventHandler(DMOBoolParam_CheckedChanged);
        }

        void DMOBoolParam_CheckedChanged(object sender, EventArgs e)
        {
            MPData val = new MPData();
            if (_pInfo.mopCaps == MPCaps.Jump)
            {
                val.vBool = Checked;
            }
            else
            {
                val.vFloat = Checked ? 1f : 0f;
            }

            _param.SetParam(_paramNum, val);
        }
    }
}

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 The MIT License


Written By
Software Developer (Senior)
United States United States
AKA Rich Insley.

I have over 25 years experience in programming, and I'm completely self taught. (Except for one year at California State University Fresno where I had to learn the God awful language Miranda (http://miranda.org.uk/). I've spent 10 years as a Paratrooper in the US Army during the Clinton Administration.

Comments and Discussions