ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文
PHP・ASP用複数シートExcel表示スケルトン作成
日時: 2007/12/18 11:54
名前: lightbox



メンテナンス

実行プログラムのフルパス ( No.1 )
日時: 2009/02/21 19:59
名前: lightbox


日時: 2009/02/21 19:59
名前: lightbox
拡張子:
// 実行プログラムのフルパス
String exePath = Application.ExecutablePath;
// パスのディレクトリ部分の取得
exeDir = Path.GetDirectoryName(exePath);
このアーティクルの参照用URLをクリップボードにコピー メンテナンス
ディレクトリ選択ダイアログ ( No.2 )
日時: 2009/02/21 19:59
名前: lightbox
拡張子:
FolderBrowserDialog fd = new FolderBrowserDialog();

DialogResult ret = fd.ShowDialog();
if (ret == DialogResult.OK) {
	this.出力場所.Text = fd.SelectedPath;
}

fd.Dispose();
このアーティクルの参照用URLをクリップボードにコピー メンテナンス
ディレクトリ作成とファイルコピー ( No.3 )
日時: 2009/02/21 20:00
名前: lightbox
http://msdn.microsoft.com/ja-jp/library/system.io.aspx

拡張子:
// プロジェクトディレクトリ作成
String targetRoot = this.出力場所.Text + @"\" + this.プロジェクト.Text;
String target = targetRoot + @"\excel_out";
if (Directory.Exists(target)) {
	MessageBox.Show("プロジェクトが既に存在します   ");
	return;
}

// 途中のディレクトリも作成される
Directory.CreateDirectory(target);

String str;

// PHP 用
if (this.PHP.Checked) {
	// excel_out.php
	str = @"\excel_out.php";
	File.Copy(exeDir + @"\sk" + str, targetRoot + str);
	// book.php
	str = @"\book.php";
	File.Copy(exeDir + @"\sk" + str, targetRoot + str);

	// filelist.xml
	str = @"\filelist.xml";
	File.Copy(exeDir + @"\sk\excel_out" + str, target + str);
	// sheet.php
	str = @"\sheet.php";
	File.Copy(exeDir + @"\sk\excel_out" + str, target + str);
	// stylesheet.css
	str = @"\stylesheet.css";
	File.Copy(exeDir + @"\sk\excel_out" + str, target + str);
}
// ASP 用
if (this.ASP.Checked) {
	// excel_out.php
	str = @"\excel_out.asp";
	File.Copy(exeDir + @"\sk" + str, targetRoot + str);
	// book.php
	str = @"\book.inc";
	File.Copy(exeDir + @"\sk" + str, targetRoot + str);

	// filelist.xml
	str = @"\filelist.xml";
	File.Copy(exeDir + @"\sk\excel_out" + str, target + str);
	// sheet.php
	str = @"\sheet.asp";
	File.Copy(exeDir + @"\sk\excel_out" + str, target + str);
	// stylesheet.css
	str = @"\stylesheet.css";
	File.Copy(exeDir + @"\sk\excel_out" + str, target + str);
}
このアーティクルの参照用URLをクリップボードにコピー メンテナンス
ディレクトリをエクスプローラからドラッグドロップ ( No.4 )
日時: 2007/12/18 14:56
名前: lightbox
http://support.microsoft.com/kb/307966/ja

コントロールの AllowDrop を true にする

拡張子:
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 MyApp
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();

			this.出力場所.DragDrop += new DragEventHandler(this.出力場所_DragDrop);
			this.出力場所.DragEnter += new DragEventHandler(this.出力場所_DragEnter);

		}

		private void 参照ボタン_Click(object sender, EventArgs e)
		{
			FolderBrowserDialog fd = new FolderBrowserDialog();

			DialogResult ret = fd.ShowDialog();
			if (ret == DialogResult.OK)
			{
				this.出力場所.Text = fd.SelectedPath;
			}

			fd.Dispose();
		}

		private void 実行_Click(object sender, EventArgs e)
		{
			
			File.Copy(Application.ExecutablePath, this.出力場所.Text + @"\test.exe");
		}

		private void 出力場所_DragEnter(object sender, DragEventArgs e)
		{
			if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
				e.Effect = DragDropEffects.All;
			}
			else {
				e.Effect = DragDropEffects.None;
			}
		}

		private void 出力場所_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
		{
			string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
			this.出力場所.Text = s[0];
		}


	}
}
このアーティクルの参照用URLをクリップボードにコピー メンテナンス