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@侠缘      
     (~)@(~)  一辈子,用心做一件事!
    --------------------------------
      学而不思则罔,思而不学则怠!  
    ================================
  • 相关阅读:
    内容栏_2
    GridView控件-01-[简单的数据显示]
    ASP.NET页面之间传值
    RadioButtonList控件
    C语言统计运行时间
    常用排序算法的实现和复杂度的分析
    C语言函数指针
    利用汇编查看C++函数调用
    C++内存中的封装、继承、多态(下)
    从C++对象内存布局和构造过程来具体分析C++中的封装、继承、多态
  • 原文地址:https://www.cnblogs.com/WuCountry/p/305798.html
Copyright © 2011-2022 走看看