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@侠缘      
     (~)@(~)  一辈子,用心做一件事!
    --------------------------------
      学而不思则罔,思而不学则怠!  
    ================================
  • 相关阅读:
    CSS 会被继承的属性
    List的遍历和删除元素
    java中unicode和中文相互转换
    Hibernate注解方式一对多自关联关系映射
    HQL: Hibernate查询语言
    java replaceall 使用正则表达式替换单等号,不替换其他相关的等号。
    Java 将图片转二进制再将二进制转成图片
    返回上一页并刷新与返回不刷新代码
    Css圆角边框
    jquery mobile
  • 原文地址:https://www.cnblogs.com/WuCountry/p/305798.html
Copyright © 2011-2022 走看看