zoukankan      html  css  js  c++  java
  • 初学c# -- 开始学directx

    这些天对directx有兴趣了,开始慢慢学,先学基础,找了好些资料,为毛都写的辣么长呢,学习精简下来就几行。

    安装个directx sdk,在win10里面文件夹C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2902.0

    把Microsoft.DirectX.AudioVideoPlayback.dll、Microsoft.DirectX.dll、Microsoft.DirectX.DirectDraw.dll等dll文件复制到exe生成文件夹里bindebug

    添加引用,就是在“引用”点右键,“浏览”,找到那几个dll就行了。

    cs里面加上

    using Microsoft.DirectX;
    using Microsoft.DirectX.DirectSound;
    using Microsoft.DirectX.AudioVideoPlayback;

    再放2个按钮,一个播放音频,一个播放视频

     private Audio ourAudio = null;
     private Video ourVideo = null;
     private void button1_Click(object sender, EventArgs e)
     {
        ourAudio = new Audio("abc.mp3");
        ourAudio.Volume = 0; //设置音量,最大值为0;
        ourAudio.Play(); //播放        
      }
    
      private void button2_Click(object sender, EventArgs e)
      {
         ourVideo = new Video("5.avi");
         ourVideo.Owner = panel1;
         panel1.Width = 300;
         panel1.Height = 200;
         ourVideo.Play();
      }


    完事。虽然支持的格式少点。

    就这么简单,慢慢学。。。。

    还有注意一点那个app.config文件

    改一下:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup useLegacyV2RuntimeActivationPolicy="true">
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
        </startup>
    </configuration>

     红色的部分,不改不能运行

    写了个基本图像例子 https://pan.baidu.com/s/1cCI5T8

    其他基本操作放http://www.haolizi.net/example/view_10469.html

    http://www.haolizi.net/example/view_10450.html

    这里了

  • 相关阅读:
    JSON
    event flow
    for,for each,for in,for of
    history of program language
    px fr em rem
    正则符号
    DOM、BOM
    web布局
    grid
    初学python环境安装
  • 原文地址:https://www.cnblogs.com/qiaoke/p/6364673.html
Copyright © 2011-2022 走看看