zoukankan      html  css  js  c++  java
  • [导入]How to play a flash with C#

    How to play a flash with C#

    First of all, you should know flash is a ActiveX controls, so it's has the common interface like other ActiveX controls. But the C#, is running in the protected environment, so you can not use the ActiveX Controls such as COM controls like the way in VC++. But, it's also very easy to use it.

    Firt, set a new project, just windows appliction.

    Second, you can add the Flash control to your tool bar. Please be sure, your computer must be set up this ActiveX control. You can find the file (Flash.ocx) on your computer in the directory of "C:\WINDOWS\system32\Macromed\Flash\Flash.ocx". Add it.

    Then, your can drag the ActriveX controls to your Windows application like other controls. After that, you can set some property for is. You muset set the file path(must be full path) to play the SWF file. You also can add the SWF file into your application, but it will increase the size of you project(maybe very large).

    Give another secret, there is a file GetFlash.exe at your computer(if you have set up the Flash Control). The pathe is: "C:\WINDOWS\system32\Macromed\Flash\", you can get update the FlashPlayer by run this file, is can update your FlashPlayer automately.

    You can fliter the keyboard message by setting the property of the Form. But I have not find anyway to filter the message which send by right button of mouse in C#, but it is very easily to do this in C++.

    Filter the keyboard message.
    First, set the property.
    this.KeyPreview = true;
    This property is false by default, the form will not to filter the keyboard message when this propterty is "false". Then you should wirte a function to filter the message.
      private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
      {
      
      }

      private void Form1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
      {
      
      }

      private void Form1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
      {
      
      }
    This three funcitons should be defined and do something which you whant to filter the message. You can set the "e.Handled = true;", that means, the message have been disposal, then the child Control will nolonger to deal with this message.
    For example, you can filter some speciall KeyCode like this:
       if(e.KeyCode==32)
       {
        //to do something
        e.Handled = true;
       }
    OK, I will find anyway to filter the


    文章来源:http://computer.mblogger.cn/wucountry/posts/45358.aspx
    ================================
      /\_/\                        
     (=^o^=)  Wu.Country@侠缘      
     (~)@(~)  一辈子,用心做一件事!
    --------------------------------
      学而不思则罔,思而不学则怠!  
    ================================
  • 相关阅读:
    回归模型与房价预测
    朴素贝叶斯应用:垃圾邮件分类
    sklearn中的朴素贝叶斯模型及其应用
    朴素贝叶斯
    KMEAMS算法应用:图片压缩与贝叶斯公式理解
    第九周 课堂
    numpy数组及处理:效率对比
    完整的中英文词频统计
    杜-----------前期作业小笔记
    django_apscheduler 0.4.0删除了name字段
  • 原文地址:https://www.cnblogs.com/WuCountry/p/305798.html
Copyright © 2011-2022 走看看