.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

จะใส่ Flash (*.swf) ลงไปใน C# Application ยังไงครับ Options · View
forsiam
Posted: Friday, September 12, 2008 4:30:25 PM
Rank: มือฝึกหัด
Groups: Member

Joined: 9/12/2008
Posts: 7

จะใส่ Flash (*.swf) ลงไปใน C# Application ยังไงครับ

อยากจะรวมให้ flash เป็นส่วนนึงของ Application ไปเลย พอเมื่อ compile ออกมาเป็น .exe แล้ว จะเหลือแค่ไฟล์ exe อย่างเดียว ก็สามารถแสดง flash ได้

paedotnet
Posted: Friday, September 12, 2008 10:24:30 PM

Rank: มือเทพ
Groups: Member

Joined: 12/6/2007
Posts: 354
Location: bkk

ไปที่ Toolbox คลิกขวาเลือก choose items COM components
แล้วเลือก Shockwave Flash Object จากนั้นจะมี tool ที่ชื่อ
Shockwave Flash Object เกิดขึ้นมาดังรูป


ให้ลาก tool นี้มาวางใน หน้า Window Form1 จากนั้นให้ดับเบิลคลิกที่ Form1
แล้วเขียนโค้ดดังนี้

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
         public Form1()
         {
            InitializeComponent();
         }
private void Form1_Load(object sender, EventArgs e)
        {
             string str_path = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "MyEmotion.SWF";
            axShockwaveFlash1.EmbedMovie = true;
            axShockwaveFlash1.Movie = str_path;
        }
  }
}

*** จะต้องนำไฟล์ .swf มาไว้ที่ bin/debug ด้วย***

จากนั้นทดสอบรันดูจะมีการแสดง flash animation เกิดขึ้นมา

ส่วนเรื่องของ ทำเป็นไฟล์ .exe ก็ไปที่ Build -> Publish ชื่อโปรเจค
แล้วกด next แล้วเลือก เป็น yes,this application is available online or offine จากนั้น finish
แล้วจะมีหน้าต่างขึ้นมาดังรูป

ก็ให้เลือก install หลังจากนั้นจะมีหน้าต่างขึ้นมาว่าต้องการ save file นี้ หรือ จะ run ถ้า
ต้องการทำเป็นไฟล์ .exe ก้ให้เลือก save ดังรูป

พอ โหลด ไฟล์ เสร็จแล้วจะได้ไฟล์ setup สำหรับติดตั้งมา
(ถ้าจะนำไฟล์ setup นี้ไปติดตั้งเครื่องอื่นๆก็ต้องดู prerequiresite ตามรูปที่2 สองด้วยว่าเครื่องนั้นๆมีไฟล์ต่างๆที่จำเป็นสำหรับการติดตั้งหรือยัง
 



[With great power comes great responsibility]
forsiam
Posted: Monday, September 15, 2008 10:18:22 AM
Rank: มือฝึกหัด
Groups: Member

Joined: 9/12/2008
Posts: 7

ขอบคุณมากเลยครับ

forsiam
Posted: Tuesday, September 16, 2008 3:21:57 PM
Rank: มือฝึกหัด
Groups: Member

Joined: 9/12/2008
Posts: 7

ถามเพิ่มเติมครับ

เราสามารถรวม Flash (*.swf) กับโปรแกรม ให้เป็นไฟล์ exe ไฟล์เดียวได้ไหมครับ

เพราะลองทำดูแล้ว ก็ยังเห็น swf อยู่ คืออยากจะซ่อนไว้น่ะครับ

Infotech
Posted: Tuesday, January 06, 2009 1:01:30 PM

Rank: มือสมัครเล่น
Groups: Member

Joined: 12/23/2008
Posts: 16
Location: bangkok
ขอบคุนครับ
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by