プログラミングコードをブログに貼れるようにコンバータを製作中
2015/12/29
前に宣言した通り、プログラミングコードをブログに貼り付けられるよう変換プログラムを作成中です。途中経過についてご報告。
プログラムはHTML+JavaScriptで製作中です。下の図にあるようにテキストボックスにプログラミングコードをコピペします。下の[C#]ボタンを押すと・・・、
ボタンの下にブログ貼り付けたときの状態が表示されます。(赤矢印) まだキーワードが色付けされません。上のテキストボックスにはブログ貼り付けようのHTMLタグが現れています。これをブログに貼り付ければOKです。
こちらが、コピペしたもの。うまく行きました。キーワードが色付けされれば完成です。
using System;
using System.Drawing;
using System.Windows.Forms;
public class IconPanel : PictureBox{
private int index;
public IconPanel(string path){
this.Size = new Size(80, 60);
this.index = -1;
Icon appIcon = Icon.ExtractAssociatedIcon(path);
this.Image = appIcon.ToBitmap();
Label label = new Label(){
Dock = DockStyle.Bottom,
ForeColor = Color.White,
Parent=this,
};
this.Controls.Add(label);
label.Text = System.IO.Path.GetFileName(path);
}
public void setting(int index, int w, int y){
this.index = index;
this.Location = new Point(w, y);
}
public int getIndex(){ return index; }
}
ただ、色付けが結構難儀で、例えば、単純にforを for と色付けするようにプログラミングしてしまうと、例えば formation みたいな変数名を持っていると、一緒に formation と色付けされてしまいます。ここをどうするか。両側に空欄や ( ; = . が存在している時だけ有効、みたいなロジックが必要です。まあちょっと考えてみます。
スポンサーリンク