処理を止める。

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
ユーザー1

処理を止める。

#1

投稿記事 by ユーザー1 » 7年前

メッセージボックスと同じ処理(他の処理を止める)を画像にしたいのですがどうすればいいでしょうか?

アバター
みけCAT
記事: 6734
登録日時: 13年前
住所: 千葉県
連絡を取る:

Re: 処理を止める。

#2

投稿記事 by みけCAT » 7年前

私には質問の意味がわかりません。
特に「画像にしたい」というのが意味不明です。
ユーザー1 さんが書きました:どうすればいいでしょうか?
フォーラムルールを読んで従い、もう少し詳しい具体的な質問をするといいかもしれません。

フォーラムルールより転載
どう質問していいか解らない時は、以下のテンプレをコピペして、

各項目に対して答える形で記載して下さい。

[hr]
[1] 質問文
 [1.1] 自分が今行いたい事は何か
 [1.2] どのように取り組んだか(プログラムコードがある場合記載)
 [1.3] どのようなエラーやトラブルで困っているか(エラーメッセージが解る場合は記載)
 [1.4] 今何がわからないのか、知りたいのか

[2] 環境  
 [2.1] OS : Windows, Linux等々
 [2.2] コンパイラ名 : VC++ 2008EE, Borand C++, gcc等々
[3] その他
 ・どの程度C言語を理解しているか
 ・ライブラリを使っている場合は何を使っているか

[hr]
複雑な問題?マシンの性能を上げてOpenMPで殴ればいい!(死亡フラグ)

Math

Re: 処理を止める。

#3

投稿記事 by Math » 7年前

VBで作成しました。Windows10[64bits]のみの機能でOKですよ。
メモ帳さえ使えれば大丈夫です。
同一フォルダーに3つのファイルを置きvb.batをWクリックすればコンパイル・実行が出来ます。
[vb1.jpg,vb.bat,vb1.vb]
http://csi.nisinippon.com/vb1.jpg
vb.bat

コード:

C:\windows\Microsoft.NET\Framework64\v4.0.30319\vbc.exe vb1.vb
vb1.exe
pause
vb1.vb

コード:

Imports System.Windows.Forms
Module Module1
Sub Main()

    Dim f As New Form()
    f.Width=500
    f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg")
    System.Console.WriteLine("ごにょごにょ...")
    MsgBox("メッセージボックス(他の処理を止める)")
    System.Console.WriteLine("ゴニョゴニョ...")
    f.ShowDialog()
    System.Console.WriteLine("ごにょごにょ...")
    MsgBox("終わり")
    
  End Sub
End Module
実行結果

コード:

D:\z\14\cs>C:\windows\Microsoft.NET\Framework64\v4.0.30319\vbc.exe vb1.vb
Microsoft (R) Visual Basic Compiler version 14.6.1586
for Visual Basic 2012
Copyright (c) Microsoft Corporation.  All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to Visual Basic 2012, which is no longer the latest version. For compilers that support newer versions of the Visual Basic programming language, see http://go.microsoft.com/fwlink/?LinkID=533241


D:\z\14\cs>vb1.exe
ごにょごにょ...
ゴニョゴニョ...
ごにょごにょ...

D:\z\14\cs>pause
続行するには何かキーを押してください . . .

Math

Re: 処理を止める。

#4

投稿記事 by Math » 7年前

Vista32bitsの場合はこうなります。

コード:

C:\windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe vb1.vb
vb1.exe
pause

Math

Re: 処理を止める。

#5

投稿記事 by Math » 7年前

[C#版] vb と C# は兄弟言語なので 相互に 置き換えられます。
vbと同じフォルダーにcs.batとcs1.csを作成し同様にcs.batをWクリックすればいいです。
cs.bat

コード:

C:\windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe cs1.cs
cs1.exe
pause
cs1.cs

コード:

using System.Windows.Forms;
namespace Console1
{
    class Progra 
    {
        static void Main() 
        {

            Form f = new Form();
            f.Width=500;
            f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("メッセージボックス(他の処理を止める)");
            System.Console.WriteLine("ゴニョゴニョ...");
            f.ShowDialog();
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("終わり");
	
        }
    }
}

Math

Re: 処理を止める。

#6

投稿記事 by Math » 7年前

[C++] C++/CLI を使用する。VisualStudio開発者コマンドプロンプトを使用する。

cpp.bat

コード:

cl /clr cpp1.cpp
cpp1.exe
pause
cpp1.cpp

コード:

#using <System.dll> //参照設定
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
//----------------
#include <stdio.h> //標準入出力ヘッダーファイル
//---------------------
using namespace System; //使用する名前空間
using namespace System::Windows::Forms;
//-------------------------------------
int main(array<System::String ^> ^args)
{
    System::Windows::Forms::Form^ f = gcnew Form();
    f->Width = 500;
    f->BackgroundImage = System::Drawing::Image::FromFile("vb1.jpg");
    Console::WriteLine("ごにょごにょ...");
    printf("...Go-nyo...!.\n");
    MessageBox::Show("メッセージボックス(他の処理を止める)");
    Console::WriteLine("ゴニョゴニョ...");
    printf("...Go-nyo...!.\n");
    f->ShowDialog();
    Console::WriteLine(L"ごにょごにょ...");
    printf("...Go-nyo...!.\n");
    printf("...End...!.\n");
    return 0;
}

Math

Re: 処理を止める。

#7

投稿記事 by Math » 7年前

実行結果
[VS2015 Communityの場合]

コード:

D:\z\15\cs>cpp

D:\z\15\cs>cl /clr cpp1.cpp
Microsoft(R) C/C++ Optimizing Compiler Version 19.00.24215.1
for Microsoft(R) .NET Framework Version 4.06.1586.0
Copyright (C) Microsoft Corporation.  All rights reserved.

cpp1.cpp
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:cpp1.exe
cpp1.obj

D:\z\15\cs>cpp1.exe
ごにょごにょ...
...Go-nyo...!.
ゴニョゴニョ...
...Go-nyo...!.
ごにょごにょ...
...Go-nyo...!.
...End...!.

D:\z\15\cs>pause
続行するには何かキーを押してください . . .
[VS2008の場合]

コード:

D:\z\15\cs>cpp

D:\z\15\cs>cl /clr cpp1.cpp
Microsoft(R) C/C++ Optimizing Compiler Version 15.00.30729.01
for Microsoft(R) .NET Framework Version 2.00.50727.8745
Copyright (C) Microsoft Corporation.  All rights reserved.

cpp1.cpp
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:cpp1.exe
cpp1.obj

D:\z\15\cs>cpp1.exe
ごにょごにょ...
...Go-nyo...!.
ゴニョゴニョ...
...Go-nyo...!.
ごにょごにょ...
...Go-nyo...!.
...End...!.

D:\z\15\cs>pause
続行するには何かキーを押してください . . .

Math

Re: 処理を止める。

#8

投稿記事 by Math » 7年前

おまけ
[PowerShell_ise]

スクリプト

コード:

$f = New-Object System.Windows.Forms.Form
$f.Width=500
$f.BackgroundImage=[System.Drawing.Image]::FromFile("vb1.jpg")
[System.Console]::WriteLine("ごにょごにょ...")
[System.Windows.Forms.MessageBox]::Show("メッセージボックス(他の処理を止める)")
[System.Console]::WriteLine("ゴニョゴニョ...")
$f.ShowDialog()
[System.Console]::WriteLine("ごにょごにょ...")
[System.Windows.Forms.MessageBox]::Show("終わり")
exit	
実行結果

コード:

PS D:\z\15\cs> D:\z\04a\ps\p.ps1
ごにょごにょ...
OK
ゴニョゴニョ...
Cancel
ごにょごにょ...
OK

PS D:\z\15\cs> 

Math

Re: 処理を止める。

#9

投稿記事 by Math » 7年前


もう一つ”おまけ”に エンヤコラ

[C#スクリプト]  http://csi.nisinippon.com/index.html

[csiexe.bat]

コード:

"C:\Program Files (x86)\MSBuild\14.0\bin\csi.exe" csi.txt

pause
[csi.txt]

コード:

#r "System.Windows.Forms"
#r "System.Drawing"

using System.Windows.Forms;
using System.Drawing;


Form f = new Form();
f.Width=500;
f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
System.Console.WriteLine("ごにょごにょ...");
MessageBox.Show("メッセージボックス(他の処理を止める)");
System.Console.WriteLine("ゴニョゴニョ...");
f.ShowDialog();
System.Console.WriteLine("ごにょごにょ...");
MessageBox.Show("終わり");
	
[/size]

Math

Re: 処理を止める。

#10

投稿記事 by Math » 7年前

すみません。実行結果が抜けてました。

コード:

D:\z\15\cs>"C:\Program Files (x86)\MSBuild\14.0\bin\csi.exe" csi.txt
ごにょごにょ...
ゴニョゴニョ...
ごにょごにょ...

D:\z\15\cs>pause
続行するには何かキーを押してください . . .

Math

Re: 処理を止める。

#11

投稿記事 by Math » 7年前

http://dixq.net/forum/viewtopic.php?f=3&t=18830と同様に
C#のプログラムはPowerShellの”ヒアーストリング”としてもコンパイル出来ました!

コード:

$source = @"
using System.Windows.Forms;
class Program
{
         static void Main() 
        {
            Form f = new Form();
            f.Width=500;
            f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("メッセージボックス(他の処理を止める)");
            System.Console.WriteLine("ゴニョゴニョ...");
            f.ShowDialog();
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("終わり");
        }
}
"@
Add-Type -TypeDefinition $source -Language CSharp `
 -ReferencedAssemblies "System.Windows.Forms.dll","System.Drawing.dll" `
 -OutputAssembly "Program.exe" -OutputType ConsoleApplication
 
.\Program.exe #実行
実行結果

コード:

PS D:\z\15\cs> D:\z\15\cs\p.ps1
ごにょごにょ...
ゴニョゴニョ...
ごにょごにょ...

PS D:\z\15\cs> 

Math

Re: 処理を止める。

#12

投稿記事 by Math » 7年前

Roslyn-ロズリン-今迄のコンパイラは C++ で書かれていたのですが、
Roslynは C# で実装しなおしたコンパイラでVS2015に使われている。

PowerShell_iseを使いUnixのコマンドで
RoslynのC#コンパイラーcsc.exeのエイリアスcscを使う!

スクリプト

コード:

csc cs1.cs
ls cs*
.\cs1.exe
cs1.cs

コード:

using System.Windows.Forms;
namespace Console1
{
    class Program 
    {
        static void Main() 
        {

            Form f = new Form();
            f.Width=500;
            f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("メッセージボックス(他の処理を止める)");
            System.Console.WriteLine("ゴニョゴニョ...");
            f.ShowDialog();
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("終わり");
	
        }
    }
}
実行結果

コード:

S D:\z\15\cs> D:\z\15\cs\p.ps1
Microsoft (R) Visual C# Compiler バージョン 1.3.1.60616
Copyright (C) Microsoft Corporation. All rights reserved.



    ディレクトリ: D:\z\15\cs


Mode                LastWriteTime         Length Name                          
----                -------------         ------ ----                          
-a----       2017/02/15      8:32             84 cs.bat                        
-a----       2017/02/15     23:16            595 cs1.cs                        
-a----       2017/02/15     23:35           4096 cs1.exe                       
-a----       2017/02/15      8:38           2660 csc.rsp-------------txt.txt   
-a----       2017/02/15     16:52            449 csi.txt                       
-a----       2017/02/15     16:47             70 csiexe.bat                    
ごにょごにょ...
ゴニョゴニョ...
ごにょごにょ...



PS D:\z\15\cs>

Math

Re: 処理を止める。

#13

投稿記事 by Math » 7年前


VS2015の”C# インタラクティブ” ウィンドウで実行します。#load "myScript.csx"を実行する。

myScript.csx

コード:


#r "System.Windows.Forms"
#r "System.Drawing"
 
using System.Windows.Forms;
using System.Drawing;
 
 
Form f = new Form();
f.Width=500;
f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
System.Console.WriteLine("ごにょごにょ...");
MessageBox.Show("メッセージボックス(他の処理を止める)");
System.Console.WriteLine("ゴニョゴニョ...");
f.ShowDialog();
System.Console.WriteLine("ごにょごにょ...");
MessageBox.Show("終わり");
C# Script help と実行結果

コード:

Microsoft (R) Roslyn C# コンパイラ バージョン 1.3.4.60902
'CSharpInteractive.rsp' からコンテキストを読み込んでいます。
詳細については、「#help」と入力します。
> #help
キーボード ショートカット:
  Enter                現在の送信が完了している場合は、評価します。完了していない場合には、新しい行を挿入します。
  Ctrl-Enter           現在の送信内で、現在の送信を評価します。
                       前の送信内で、前の送信を現在の送信に追加します。
  Shift-Enter          新しい行を挿入します。
  Escape               現在の送信をクリアします。
  Alt-UpArrow          現在の送信を前の送信に置き換えます。
  Alt-DownArrow        現在の送信を次の送信に置き換えます (前に戻っている場合)。
  Ctrl-Alt-UpArrow     現在の送信を、同じテキストで始まる前の送信に置き換えます。
  Ctrl-Alt-DownArrow   現在の送信を、同じテキストで始まる次の送信に置き換えます (前に戻っている場合)。
  Ctrl-K, Ctrl-Enter   対話型バッファーの最後に選択内容を貼り付け、キャレットを入力の末尾に付けます。
  Ctrl-E, Ctrl-Enter   対話型バッファー内の保留中の入力の前に、選択内容を貼り付けて実行します。
  Ctrl-A               最初に押すと、カーソルの置かれた送信が選択されます。もう一度押すと、ウィンドウ内のすべてのテキストが選択されます。
REPL コマンド:
  #cls, #clear         編集ウィンドウの内容をクリアし、履歴と実行コンテキストはそのまま保持します。
  #help                指定のコマンド、または指定していない場合には利用可能なすべてのコマンドとキー バイデンィングに関する、ヘルプを表示します。
  #reset               実行環境を初期状態にリセットし、履歴を保持します。
スクリプト ディレクティブ:
  #r                   指定されたアセンブリとそのすべての依存関係へのメタデータ参照を追加します (例: #r "myLib.dll")。
  #load                指定されたスクリプト ファイルを読み込んで実行します (例: #load "myScript.csx")。

> #load "myScript.csx"
ごにょごにょ...
ゴニョゴニョ...
ごにょごにょ...
> 
[/size]

Math

Re: 処理を止める。

#14

投稿記事 by Math » 7年前

Visual Studio (VS2008)

http://csi.nisinippon.com/vs2008.png

コード:

using System;

using System.Windows.Forms;
namespace Console1
{
    class Program
    {
        static void Main()
        {

            Form f = new Form();
            f.Width = 500;
            f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("メッセージボックス(他の処理を止める)");
            System.Console.WriteLine("ゴニョゴニョ...");
            f.ShowDialog();
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("終わり");

        }
    }
}

Math

Re: 処理を止める。

#15

投稿記事 by Math » 7年前

Visual Studio (VS2015) [WPF Window] ..Modified MSDN Sample..

http://csi.nisinippon.com/wpf.png

コード:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace cons
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            Window mainWindow;
            // Create the main window
            mainWindow = new Window();

            // Create the Grid
            Grid myGrid = new Grid();
            myGrid.Width = 750;
            myGrid.Height = 500;
            myGrid.HorizontalAlignment = HorizontalAlignment.Left;
            myGrid.VerticalAlignment = VerticalAlignment.Top;
            myGrid.ShowGridLines = true;

            // Define the Columns
            ColumnDefinition colDef1 = new ColumnDefinition();
            ColumnDefinition colDef2 = new ColumnDefinition();
            ColumnDefinition colDef3 = new ColumnDefinition();
            myGrid.ColumnDefinitions.Add(colDef1);
            myGrid.ColumnDefinitions.Add(colDef2);
            myGrid.ColumnDefinitions.Add(colDef3);

            // Define the Rows
            RowDefinition rowDef1 = new RowDefinition();
            RowDefinition rowDef2 = new RowDefinition();
            RowDefinition rowDef3 = new RowDefinition();
            RowDefinition rowDef4 = new RowDefinition();
            myGrid.RowDefinitions.Add(rowDef1);
            myGrid.RowDefinitions.Add(rowDef2);
            myGrid.RowDefinitions.Add(rowDef3);
            myGrid.RowDefinitions.Add(rowDef4);

            // Add the first text 
            TextBlock txt1 = new TextBlock();
            txt1.Text = "C# : WPF --- Hello World!";
            txt1.FontSize = 60;
            txt1.FontWeight = FontWeights.Bold;
            Grid.SetColumnSpan(txt1, 3);
            Grid.SetRow(txt1, 0);

            // Add the second text 
            TextBlock txt2 = new TextBlock();
            txt2.Text = "SetColumn: 0";
            txt2.FontSize = 40;
            txt2.FontWeight = FontWeights.Bold;
            Grid.SetRow(txt2, 1);
            Grid.SetColumn(txt2, 0);

            // Add the third text 
            TextBlock txt3 = new TextBlock();
            txt3.Text = "SetColumn: 1";
            txt3.FontSize = 40;
            txt3.FontWeight = FontWeights.Bold;
            Grid.SetRow(txt3, 1);
            Grid.SetColumn(txt3, 1);

            // Add the fourth text 
            TextBlock txt4 = new TextBlock();
            txt4.Text = "SetColumn: 2";
            txt4.FontSize = 40;
            txt4.FontWeight = FontWeights.Bold;
            Grid.SetRow(txt4, 1);
            Grid.SetColumn(txt4, 2);

            // Add the sixth text 
            TextBlock txt5 = new TextBlock();
            Double db1 = new Double();
            db1 = 111.0;
            txt5.Text = db1.ToString();
            Grid.SetRow(txt5, 2);
            Grid.SetColumn(txt5, 0);

            // Add the seventh text 
            TextBlock txt6 = new TextBlock();
            Double db2 = new Double();
            db2 = 222.0;
            txt6.Text = db2.ToString();
            Grid.SetRow(txt6, 2);
            Grid.SetColumn(txt6, 1);

            // Add the final text 
            TextBlock txt7 = new TextBlock();
            Double db3 = new Double();
            db3 = 333.0;
            txt7.Text = db3.ToString();
            Grid.SetRow(txt7, 2);
            Grid.SetColumn(txt7, 2);

            Image myImage3 = new Image();
            BitmapImage bi3 = new BitmapImage();
            bi3.BeginInit();
            bi3.UriSource = new Uri("vb1.jpg", UriKind.Relative);
            bi3.EndInit();
            myImage3.Source = bi3;

            Grid.SetRow(myImage3, 3);
            Grid.SetColumnSpan(myImage3, 3);

            // Add the TextBlock elements to the Grid Children collection
            myGrid.Children.Add(txt1);
            myGrid.Children.Add(txt2);
            myGrid.Children.Add(txt3);
            myGrid.Children.Add(txt4);
            myGrid.Children.Add(txt5);
            myGrid.Children.Add(txt6);
            myGrid.Children.Add(txt7);
            myGrid.Children.Add(myImage3);

            // Add the Grid as the Content of the Parent Window Object
            mainWindow.Content = myGrid;

            mainWindow.Title = "Hello World!";
            mainWindow.Height = 600;
            mainWindow.Width = 800;
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("メッセージボックス(他の処理を止める)");
            System.Console.WriteLine("ゴニョゴニョ...");
            mainWindow.ShowDialog();
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("終わり");
        }
    }
}

Math

Re: 処理を止める。

#16

投稿記事 by Math » 7年前

[Windows Form] Windows10のみでコンパイル。本格実装しました。
[DataGridView][DataTable][ReadXml][ラムダ式:ボタンの操作]...
http://csi.nisinippon.com/csdgv.png
f.bat

コード:

del f.exe
C:\windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe ^
f.cs
f.exe
pause
f.cs

コード:

using System;
using System.Data;
using System.Windows.Forms;
using System.Drawing;
public class Program
{
    [STAThread]
    static void Main()
    {
        Form f;
        Button b;
        TextBox t;
        DataGridView dg;
        DataTable dt;
        f = new Form();
        b = new Button();
        t = new TextBox();
        dg = new DataGridView();
        dt = new DataTable();
        f.Text = "Form";
f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
        t.Text = "TextBox";
        b.Text = "Button";
        f.Size = new Size(300, 300);
        f.Location = new Point(500, 400);
        t.Location = new Point(20, 20);
        b.Location = new Point(150, 20);
        dg.Location = new Point(20, 60);
        f.Controls.Add(b);
        f.Controls.Add(t);
        f.Controls.Add(dg);
        dg.Anchor =  (AnchorStyles)15;
        dt.Columns.Add("A");
        dt.Columns.Add("B");
        dt.Columns.Add("C");
        dg.DataSource = dt;
        dt.TableName="dtSheet1";
        dt.ReadXml("DataGridView.xml");
        dg.CurrentCell = dg[2, 100];
        dg.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
        b.Click += (sender, e) => t.Text = dg.CurrentRow.Cells[2].Value.ToString();
        //------------------------------------------------------------
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("メッセージボックス(他の処理を止める)");
            System.Console.WriteLine("ゴニョゴニョ...");
            f.ShowDialog();
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("終わり");
    }
}

Math

Re: 処理を止める。

#17

投稿記事 by Math » 7年前


DataGridView.xml
(データは2000行以上有ったので送れませんでした。)

コード:

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="dtSheet1" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="dtSheet1">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="A" type="xs:string" minOccurs="0" />
                <xs:element name="B" type="xs:string" minOccurs="0" />
                <xs:element name="C" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <dtSheet1>
    <A>0</A>
    <B>MemberType</B>
    <C>Name</C>
  </dtSheet1>
  <dtSheet1>
    <A>1</A>
    <B>Event</B>
    <C>AllowUserToAddRowsChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>2</A>
    <B>Event</B>
    <C>AllowUserToDeleteRowsChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>3</A>
    <B>Event</B>
    <C>AllowUserToOrderColumnsChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>4</A>
    <B>Event</B>
    <C>AllowUserToResizeColumnsChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>5</A>
    <B>Event</B>
    <C>AllowUserToResizeRowsChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>6</A>
    <B>Event</B>
    <C>AlternatingRowsDefaultCellStyleChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>7</A>
    <B>Event</B>
    <C>AutoGenerateColumnsChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>8</A>
    <B>Event</B>
    <C>AutoSizeChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>9</A>
    <B>Event</B>
    <C>AutoSizeColumnModeChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>10</A>
    <B>Event</B>
    <C>AutoSizeColumnsModeChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>11</A>
    <B>Event</B>
    <C>AutoSizeRowsModeChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>12</A>
    <B>Event</B>
    <C>BackColorChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>13</A>
    <B>Event</B>
    <C>BackgroundColorChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>14</A>
    <B>Event</B>
    <C>BackgroundImageChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>15</A>
    <B>Event</B>
    <C>BackgroundImageLayoutChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>16</A>
    <B>Event</B>
    <C>BindingContextChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>17</A>
    <B>Event</B>
    <C>BorderStyleChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>18</A>
    <B>Event</B>
    <C>CancelRowEdit</C>
  </dtSheet1>
  <dtSheet1>
    <A>19</A>
    <B>Event</B>
    <C>CausesValidationChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>20</A>
    <B>Event</B>
    <C>CellBeginEdit</C>
  </dtSheet1>
  <dtSheet1>
    <A>21</A>
    <B>Event</B>
    <C>CellBorderStyleChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>22</A>
    <B>Event</B>
    <C>CellClick</C>
  </dtSheet1>
  <dtSheet1>
    <A>23</A>
    <B>Event</B>
    <C>CellContentClick</C>
  </dtSheet1>
  <dtSheet1>
    <A>24</A>
    <B>Event</B>
    <C>CellContentDoubleClick</C>
  </dtSheet1>
  <dtSheet1>
    <A>25</A>
    <B>Event</B>
    <C>CellContextMenuStripChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>26</A>
    <B>Event</B>
    <C>CellContextMenuStripNeeded</C>
  </dtSheet1>
  <dtSheet1>
    <A>27</A>
    <B>Event</B>
    <C>CellDoubleClick</C>
  </dtSheet1>
  <dtSheet1>
    <A>28</A>
    <B>Event</B>
    <C>CellEndEdit</C>
  </dtSheet1>
  <dtSheet1>
    <A>29</A>
    <B>Event</B>
    <C>CellEnter</C>
  </dtSheet1>
  <dtSheet1>
    <A>30</A>
    <B>Event</B>
    <C>CellErrorTextChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>31</A>
    <B>Event</B>
    <C>CellErrorTextNeeded</C>
  </dtSheet1>
  <dtSheet1>
    <A>32</A>
    <B>Event</B>
    <C>CellFormatting</C>
  </dtSheet1>
  <dtSheet1>
    <A>33</A>
    <B>Event</B>
    <C>CellLeave</C>
  </dtSheet1>
  <dtSheet1>
    <A>34</A>
    <B>Event</B>
    <C>CellMouseClick</C>
  </dtSheet1>
  <dtSheet1>
    <A>35</A>
    <B>Event</B>
    <C>CellMouseDoubleClick</C>
  </dtSheet1>
  <dtSheet1>
    <A>36</A>
    <B>Event</B>
    <C>CellMouseDown</C>
  </dtSheet1>
  <dtSheet1>
    <A>37</A>
    <B>Event</B>
    <C>CellMouseEnter</C>
  </dtSheet1>
  <dtSheet1>
    <A>38</A>
    <B>Event</B>
    <C>CellMouseLeave</C>
  </dtSheet1>
  <dtSheet1>
    <A>39</A>
    <B>Event</B>
    <C>CellMouseMove</C>
  </dtSheet1>
  <dtSheet1>
    <A>40</A>
    <B>Event</B>
    <C>CellMouseUp</C>
  </dtSheet1>
  <dtSheet1>
    <A>41</A>
    <B>Event</B>
    <C>CellPainting</C>
  </dtSheet1>
  <dtSheet1>
    <A>42</A>
    <B>Event</B>
    <C>CellParsing</C>
  </dtSheet1>
  <dtSheet1>
    <A>43</A>
    <B>Event</B>
    <C>CellStateChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>44</A>
    <B>Event</B>
    <C>CellStyleChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>45</A>
    <B>Event</B>
    <C>CellStyleContentChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>46</A>
    <B>Event</B>
    <C>CellToolTipTextChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>47</A>
    <B>Event</B>
    <C>CellToolTipTextNeeded</C>
  </dtSheet1>
  <dtSheet1>
    <A>48</A>
    <B>Event</B>
    <C>CellValidated</C>
  </dtSheet1>
  <dtSheet1>
    <A>49</A>
    <B>Event</B>
    <C>CellValidating</C>
  </dtSheet1>
  <dtSheet1>
    <A>50</A>
    <B>Event</B>
    <C>CellValueChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>51</A>
    <B>Event</B>
    <C>CellValueNeeded</C>
  </dtSheet1>
  <dtSheet1>
    <A>52</A>
    <B>Event</B>
    <C>CellValuePushed</C>
  </dtSheet1>
  <dtSheet1>
    <A>53</A>
    <B>Event</B>
    <C>ChangeUICues</C>
  </dtSheet1>
  <dtSheet1>
    <A>54</A>
    <B>Event</B>
    <C>Click</C>
  </dtSheet1>
  <dtSheet1>
    <A>55</A>
    <B>Event</B>
    <C>ClientSizeChanged</C>
  </dtSheet1>
  <dtSheet1>
    <A>56</A>
    <B>Event</B>
    <C>ColumnAdded</C>
  </dtSheet1>
  <dtSheet1>
    <A>421</A>
    <B>Property</B>
    <C>WindowTarget</C>
  </dtSheet1>
</NewDataSet>
[/size]

Math

Re: 処理を止める。

#18

投稿記事 by Math » 7年前

[Windows Form] Windows10のみでコンパイル。本格実装しました。--->更に通常の"Form1"をラムダ式で追加。
[DataGridView][DataTable][ReadXml][ラムダ式:ボタンの操作]...+"Form1"
http://csi.nisinippon.com/csdvg3.png
f.bat

コード:

del f.exe
C:\windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe ^
f.cs
f.exe
pause
f.cs

コード:

using System;
using System.Windows.Forms;
using System.Drawing;
using System.Data;

delegate void mes();

public class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
    private void InitializeComponent()
    {
        this.label1 = new Label();
        this.label1.Location = new Point(20, 20);
        this.label1.Text = "DataGridView\nMember List";
        this.label1.BackColor = Color.LightGreen;
        this.Controls.Add(this.label1);
        this.Text = "Form1";
	this.Click += (sender, e) => this.label1.Text = "Form Click!";
this.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
        dg = new DataGridView();
        dt = new DataTable();
        dg.Location = new Point(20, 60);
        this.Controls.Add(dg);
        dg.Anchor = (AnchorStyles)15;
        dt.Columns.Add("A");
        dt.Columns.Add("B");
        dt.Columns.Add("C");
        dg.DataSource = dt;
        dt.TableName="dtSheet1";
        dt.ReadXml("DataGridView.xml");
        dg.AutoSizeColumnsMode = (DataGridViewAutoSizeColumnsMode)8;
    }
    private Label label1;
    DataGridView dg;
    DataTable dt;
}

public class Program
{
    [STAThread]
    static void Main()
    {
        mes d = () => {
                          Form f1 = new Form1();
                          f1.Show();
                      };
        Form f;
        Button b;
        TextBox t;
        f = new Form();
        b = new Button();
        t = new TextBox();
        f.Text = "Form";
        t.Text = "TextBox: ABCDE";
        b.Text = "Button";
        f.Size = new Size(300, 200);
        f.Location = new Point(500, 400);
        t.Location = new Point(30, 20);
        b.Location = new Point(30, 60);
        f.Controls.Add(b);
        f.Controls.Add(t);

        b.Click += (sender, e) => d();

        //------------------------------------------------------------
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("メッセージボックス(他の処理を止める)");
            System.Console.WriteLine("ゴニョゴニョ...");
            f.ShowDialog();
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("終わり");
    }
}

Math

Re: 処理を止める。

#19

投稿記事 by Math » 7年前

[Windows Form] [VidualVasic][DATA binding..] Windows10のみでコンパイル。
[url]http://csi.nisinippon.com/vb333.png[/url
fb.bat

コード:

del fb.exe
C:\windows\Microsoft.NET\Framework64\v4.0.30319\vbc.exe ^
/out:fb.exe ^
fbp.vb ^
fbd.vb ^
fbm.vb
fb.exe
pause
fbd.vb

コード:

Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Namespace NsFormA
  Partial Class FormA
                       Inherits Form

    Private bindingSource1 As BindingSource

    Private B As Button
    Private dgSheet1 As DataGridView
    Private dtSheet1 As DataTable 

    Private Sub InitializeComponent()

        Me.B = New Button()
        Me.Controls.Add(B)
	AddHandler Me.B.Click, AddressOf Button1_Click

        Me.bindingSource1 = New BindingSource()
        Me.BindingSource1.DataSource = GetType(Member)

        Me.dgSheet1 = New DataGridView
        Me.Controls.Add(Me.dgSheet1)

        Me.dtSheet1 = New DataTable
        Me.dtSheet1.Columns.Add("A")
        Me.dtSheet1.Columns.Add("B")
        Me.dtSheet1.Columns.Add("C")
   End Sub
  End Class
End Namespace
fbp.vb

コード:

Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Namespace NsFormA
  public class Member
    Public Property Number As Integer
    Public Property MemberType As String
    Public Property Name As String 
  End Class

  Public Class FormA
    private listM As List(Of Member) 

    Public Sub New()
		InitializeComponent()
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	Me.Height = 300
	Me.Text = "DataGridView"
	Me.B.Text = "Sheet1"
	Me.B.Top = 10
	Me.B.Left = 10

        Me.dgSheet1.Top = 40
        Me.dgSheet1.Left = 10
        Me.dgSheet1.Height=200
        Me.dgSheet1.Width=260
        Me.dgSheet1.Anchor = 
( AnchorStyles.Top or AnchorStyles.Bottom or AnchorStyles.Left or AnchorStyles.Right )

	Me.listM = new List(Of Member) _
		From { New Member() With { .Number=1234,
                                           .Name="AutoResizeColumns",
	                                   .MemberType="Method"
		                                 },
                       New Member() With { .Number=5678,
                                           .Name="ColumnHeadersHeight",
		                          .MemberType="Property"
		                         }
                    }
		Me.bindingSource1.DataSource = Me.listM
		Me.dgSheet1.DataSource = Me.bindingSource1

		dgSheet1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
 	dtSheet1.TableName="dtSheet1"
	dtSheet1.ReadXml("DataGridView.xml")
        Me.dgSheet1.DataSource = Me.dtSheet1
     End Sub
  End Class
End Namespace
fbm.vb

コード:

Option Strict On
Option Explicit On
Imports System
Imports System.Windows.Forms
Namespace NsFormA
    Class Program
        Shared Sub Main()
            Dim f As New FormA()
f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg")
            System.Console.WriteLine("ごにょごにょ...")
            MessageBox.Show("メッセージボックス(他の処理を止める)")
            System.Console.WriteLine("ゴニョゴニョ...")
            f.ShowDialog()
            System.Console.WriteLine("ごにょごにょ...")
            MessageBox.Show("終わり")

  		End Sub
	End Class
End Namespace


Math

Re: 処理を止める。

#21

投稿記事 by Math » 7年前

[Windows Form] [C#版] [DATA binding..] Windows10のみでコンパイル。
(VidualVasicと結果は同じ)[PwerShell_ise でexeのクラス確認]http://csi.nisinippon.com/csps.png
fc.bat

コード:

del fc.exe
C:\windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe ^
/out:fc.exe ^
fcp.cs ^
fcd.cs ^
fcm.cs
fc.exe
pause
fcd.cs

コード:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace NsFormA
{
    partial class FormA
    {

        public BindingSource bindingSource1;

        public Button button1;
	public DataGridView dgSheet1;
	public DataTable dtSheet1;
        private void InitializeComponent()
        {
            // button1
            this.button1 = new Button();
            this.button1.Click += new System.EventHandler(this.button1_Click); 
            // FormA
            this.Controls.Add(this.button1);
            this.Load += new System.EventHandler(this.FormA_Load);

            this.bindingSource1 = new BindingSource();
            this.bindingSource1.DataSource = typeof(Member);

            this.dgSheet1 = new DataGridView();
            this.Controls.Add(this.dgSheet1);

            this.dtSheet1 = new DataTable();
            this.dtSheet1.Columns.Add("A");
            this.dtSheet1.Columns.Add("B");
            this.dtSheet1.Columns.Add("C");
        }
    }
}
fcp.cs

コード:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace NsFormA
{
	public class Member
	{
		public int Number { get; set; }
		public string MemberType { get; set; }		
		public string Name { get; set; }
	}

    public partial class FormA : Form
    {
        public List<Member> listM;

        public FormA()
        {
            InitializeComponent();
        }
        private void FormA_Load(object sender, System.EventArgs e) 
	{
		this.Height = 300;
		this.Text = "DataGridView";
		this.button1.Text = "Sheet1";
		this.button1.Top = 10;
		this.button1.Left = 10;

        	this.dgSheet1.Top = 40;
        	this.dgSheet1.Left = 10;
        	this.dgSheet1.Height=200;
        	this.dgSheet1.Width=260;
        	this.dgSheet1.Anchor =
          (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);

		listM = new List<Member>()
		{
                    new Member() { Number=1234,
                                   Name="AutoResizeColumns",
		                   MemberType="Method"},
                    new Member() { Number=5678,
                                   Name="ColumnHeadersHeight",
		                   MemberType="Property"}
            };
		this.bindingSource1.DataSource = listM;
		this.dgSheet1.DataSource = this.bindingSource1;

		dgSheet1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
        }
	private void button1_Click(object sender, EventArgs e)
        {
 		this.dtSheet1.TableName="dtSheet1";
		this.dtSheet1.ReadXml("DataGridView.xml");
		this.dgSheet1.DataSource = this.dtSheet1;
        }
    }
}
fcm.cs

コード:

using System;
using System.Windows.Forms;
namespace NsFormA
{
    class Program
    {
        static void Main()
        {
            FormA f = new FormA();
f.BackgroundImage = System.Drawing.Image.FromFile("vb1.jpg");
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("メッセージボックス(他の処理を止める)");
            System.Console.WriteLine("ゴニョゴニョ...");
            f.ShowDialog();
            System.Console.WriteLine("ごにょごにょ...");
            MessageBox.Show("終わり");
        }
    }
}
PowerShell_ise スクリプト

コード:


copy fc.exe fc.dll
Add-Type -Path .\fc.dll
[NsFormA.FormA]
$f = New-Object NsFormA.FormA
$f.ShowDialog()

Math

Re: 処理を止める。

#22

投稿記事 by Math » 7年前

[PwerShell_ise のみのWPF..xamlプログラム] Windows10のみでコンパイル。

http://csi.nisinippon.com/wpfps.png

コード:

Add-Type -AssemblyName PresentationFramework
$xaml=@'
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="200" Width="400">
    <Canvas>
        <Rectangle Fill="Red" Height="100" Stroke="Black" Width="100" 
                   Canvas.Left="10" Canvas.Top="10"/>
        <Rectangle Fill="Yellow" Height="100" Stroke="Black" Width="100" 
                   Canvas.Left="115" Canvas.Top="10"/>
        <Rectangle Fill="Blue" Height="100" Stroke="Black" Width="100" 
                   Canvas.Left="220" Canvas.Top="10"/>
    </Canvas>
</Window>
'@
$x = [System.Windows.Markup.XamlReader]::Parse($xaml)
#$f.BackgroundImage=[System.Drawing.Image]::FromFile("vb1.jpg")
[System.Console]::WriteLine("ごにょごにょ...")
[System.Windows.Forms.MessageBox]::Show("メッセージボックス(他の処理を止める)")
[System.Console]::WriteLine("ゴニョゴニョ...")
$x.ShowDialog()
[System.Console]::WriteLine("ごにょごにょ...")
[System.Windows.Forms.MessageBox]::Show("終わり")
exit                                                

Math

Re: 処理を止める。

#23

投稿記事 by Math » 7年前

[VB.WPF.xaml]ビルド..PowerSell_iseで.(.batファイルもok)
http://csi.nisinippon.com/vbxaml.png

PowerSell_ise

コード:

#MSBuild.exe を使ってVisual Studio風に
#プロジェクトとしてビルド(Compile)
#WPF の xaml  

Build vbproj.txt
pause
[System.Console]::WriteLine("ごにょごにょ...")
[System.Windows.Forms.MessageBox]::Show("メッセージボックス(他の処理を止める)")
[System.Console]::WriteLine("ゴニョゴニョ...")
.\bin\Release\App1.exe
[System.Console]::WriteLine("ごにょごにょ...")
[System.Windows.Forms.MessageBox]::Show("終わり")
exit                                                
Build.bat

コード:

C:\windows\Microsoft.NET\Framework64\v4.0.30319\MSbuild.exe ^
vbproj.txt
pause
vbproj.txt

コード:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0"
  xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <AssemblyName>App1</AssemblyName>
    <Platform>x64</Platform>
    <OutputType>WinExe</OutputType>
    <OutputPath>.\bin\Release</OutputPath>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
  </PropertyGroup>

  <ItemGroup>
    <ApplicationDefinition Include="App.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </ApplicationDefinition>

    <Page Include="Window1.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>

    <Compile Include="Window1.xaml.vb">
      <DependentUpon>Window1.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>

    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
    <Reference Include="WindowsBase" />
    <Reference Include="System" />
    <Reference Include="System.Xaml">
      <RequiredTargetFramework>4.0</RequiredTargetFramework>
    </Reference>
  </ItemGroup>

 <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />

  </ItemGroup>
<Import Project=
"$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />

</Project>
App.xaml

コード:

<Application x:Class="Application"
    xmlns=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="Window1.xaml">
    <Application.Resources>
        
    </Application.Resources>
</Application>
Window1.xaml

コード:

<Window x:Class="Window1"
    xmlns=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Button Margin="94,12,109,0" Name="Button1" Height="23"
 	VerticalAlignment="Top">Button</Button>

        <Label Height="28" Margin="82,41,76,0" Name="Label1"
 	VerticalAlignment="Top">Label</Label>

        <TextBox Height="24" Margin="82,83,76,0" Name="TextBox1"
 	VerticalAlignment="Top" />

        <ListBox Height="100" Margin="32,0,0,28" Name="ListBox1"
 	VerticalAlignment="Bottom" 
  HorizontalAlignment="Left" Width="91" />

        <ComboBox Height="31"
  HorizontalAlignment="Right" Margin="0,0,12,97"
  Name="ComboBox1" VerticalAlignment="Bottom" Width="120" />
    </Grid>
</Window>
Window.xaml.vb

コード:

Class Window1 

    Private Sub Button1_Click(ByVal sender As System.Object,
	 ByVal e As System.Windows.RoutedEventArgs) _
Handles Button1.Click
		MsgBox("Hello Word!")
		TextBox1.Text  = "Hello"
        ListBox1.Items.Add("Hello")
        ListBox1.Items.Add("World!")
        ComboBox1.Items.Add("Hello")
        ComboBox1.Items.Add("Word!")
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object,
 ByVal e As System.Windows.Controls.TextChangedEventArgs) _
Handles TextBox1.TextChanged
		MsgBox("TextBox1_TextChanged")
	
    End Sub

    Private Sub ListBox1_SelectionChanged(ByVal sender As System.Object,
 ByVal e As System.Windows.Controls.SelectionChangedEventArgs) _
Handles ListBox1.SelectionChanged
		MsgBox("ListBox1_SelectionChanged")

    End Sub

    Private Sub ComboBox1_SelectionChanged(ByVal sender As System.Object, 
ByVal e As System.Windows.Controls.SelectionChangedEventArgs) _
Handles ComboBox1.SelectionChanged
        MsgBox("ComboBox1_SelectionChanged")
    End Sub
End Class
Window1.g.vb

コード:

#ExternalChecksum("..\..\..\Window1.xaml","{406ea660-64cf-4c82-b6f0-42d48172a799}","84E1AADB295E154EED1D3C9B9DBF40D0")
'------------------------------------------------------------------------------
' <auto-generated>
'     このコードはツールによって生成されました。
'     ランタイム バージョン:4.0.30319.42000
'
'     このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
'     コードが再生成されるときに損失したりします。
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.Diagnostics
Imports System.Windows
Imports System.Windows.Automation
Imports System.Windows.Controls
Imports System.Windows.Controls.Primitives
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Ink
Imports System.Windows.Input
Imports System.Windows.Markup
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Media.Effects
Imports System.Windows.Media.Imaging
Imports System.Windows.Media.Media3D
Imports System.Windows.Media.TextFormatting
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports System.Windows.Shell


'''<summary>
'''Window1
'''</summary>
<Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>  _
Partial Public Class Window1
    Inherits System.Windows.Window
    Implements System.Windows.Markup.IComponentConnector
    
    
    #ExternalSource("..\..\..\Window1.xaml",7)
    <System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")>  _
    Friend WithEvents Button1 As System.Windows.Controls.Button
    
    #End ExternalSource
    
    
    #ExternalSource("..\..\..\Window1.xaml",10)
    <System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")>  _
    Friend WithEvents Label1 As System.Windows.Controls.Label
    
    #End ExternalSource
    
    
    #ExternalSource("..\..\..\Window1.xaml",13)
    <System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")>  _
    Friend WithEvents TextBox1 As System.Windows.Controls.TextBox
    
    #End ExternalSource
    
    
    #ExternalSource("..\..\..\Window1.xaml",16)
    <System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")>  _
    Friend WithEvents ListBox1 As System.Windows.Controls.ListBox
    
    #End ExternalSource
    
    
    #ExternalSource("..\..\..\Window1.xaml",22)
    <System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")>  _
    Friend WithEvents ComboBox1 As System.Windows.Controls.ComboBox
    
    #End ExternalSource
    
    Private _contentLoaded As Boolean
    
    '''<summary>
    '''InitializeComponent
    '''</summary>
    <System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
     System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")>  _
    Public Sub InitializeComponent() Implements System.Windows.Markup.IComponentConnector.InitializeComponent
        If _contentLoaded Then
            Return
        End If
        _contentLoaded = true
        Dim resourceLocater As System.Uri = New System.Uri("/App1;component/window1.xaml", System.UriKind.Relative)
        
        #ExternalSource("..\..\..\Window1.xaml",1)
        System.Windows.Application.LoadComponent(Me, resourceLocater)
        
        #End ExternalSource
    End Sub
    
    <System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
     System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0"),  _
     System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never),  _
     System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes"),  _
     System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity"),  _
     System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")>  _
    Sub System_Windows_Markup_IComponentConnector_Connect(ByVal connectionId As Integer, ByVal target As Object) Implements System.Windows.Markup.IComponentConnector.Connect
        If (connectionId = 1) Then
            Me.Button1 = CType(target,System.Windows.Controls.Button)
            Return
        End If
        If (connectionId = 2) Then
            Me.Label1 = CType(target,System.Windows.Controls.Label)
            Return
        End If
        If (connectionId = 3) Then
            Me.TextBox1 = CType(target,System.Windows.Controls.TextBox)
            Return
        End If
        If (connectionId = 4) Then
            Me.ListBox1 = CType(target,System.Windows.Controls.ListBox)
            Return
        End If
        If (connectionId = 5) Then
            Me.ComboBox1 = CType(target,System.Windows.Controls.ComboBox)
            Return
        End If
        Me._contentLoaded = true
    End Sub
End Class
[/size]

コード:

"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml

コード:

'------------------------------------------------------------------------------
' <auto-generated>
'     このコードはツールによって生成されました。
'     ランタイム バージョン:4.0.30319.42000
'
'     このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
'     コードが再生成されるときに損失したりします。
' </auto-generated>
'------------------------------------------------------------------------------
 
Option Strict Off
Option Explicit On
 
Imports System
Imports System.Diagnostics
Imports System.Windows
Imports System.Windows.Automation
Imports System.Windows.Controls
Imports System.Windows.Controls.Primitives
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Ink
Imports System.Windows.Input
Imports System.Windows.Markup
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Media.Effects
Imports System.Windows.Media.Imaging
Imports System.Windows.Media.Media3D
Imports System.Windows.Media.TextFormatting
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports System.Windows.Shell
 
に変換されますよ

Math

Re: 処理を止める。

#24

投稿記事 by Math » 7年前

[今回得られた中間生成物は下記の通りです。]

コード:

Mode                LastWriteTime         Length Name                          
----                -------------         ------ ----                          
-a----       2017/02/22      0:27           2336 App.g.vb                      
-a----       2017/02/22      0:29          13312 App1.exe                      
-a----       2017/02/22      0:27           1548 App1.g.resources              
-a----       2017/02/22      0:29          24064 App1.pdb                      
-a----       2017/02/22      0:46            163 App1_MarkupCompile.cache      
-a----       2017/02/22      0:29            410 vbproj.txt.FileListAbsolute.tx
                                                 t                             
-a----       2017/02/21     23:45           1453 vbproj.txtResolveAssemblyRefer
                                                 ence.cache                    
-a----       2017/02/22      0:27           1326 Window1.baml                  
-a----       2017/02/22      0:27           5398 Window1.g.vb                  
App.g.vb,Window1.g.vbはxamlをVisual Basicにコンパイルしたもの。Window1.bamlはBAML=Binary Application Markup Languageです。
App1.pdb はデバッグ情報です。App1.exeは最終的な実行ファイルです。(そのままbinにコピーされる)
ここhttp://dixq.net/forum/posting.php?mode= ... =3&t=18870にある通りですよ。(7年前の情報ですね)

でもApp1.exeをWindows10付属のディスアセンブラでみればVisualBasicのソースが簡単にえられます。
http://csi.nisinippon.com/baml.png

全てをVBのプログラムに変換する事が出来ます。
[/size]

Math

Re: 処理を止める。

#25

投稿記事 by Math » 7年前

[訂正]すみません。http://www.atmarkit.co.jp/ait/articles/ ... ws105.html

http://csi.nisinippon.com/bamlda.pngWindows10付属のディスアセンブラ

(上のは私の使っているツールの出力です)

Math

Re: 処理を止める。

#26

投稿記事 by Math » 7年前

[C#,WPF,xaml]Windowsの機能のみ使用します。PowerShell_iseのUnixコマンドを使用します。
http://csi.nisinippon.com/cscon.png
PowerSell_iseスクリプト

コード:


Build csproj.txt
pause
[System.Console]::WriteLine("ごにょごにょ...")
[System.Windows.Forms.MessageBox]::Show("メッセージボックス(他の処理を止める)")
[System.Console]::WriteLine("ゴニョゴニョ...")
.\bin\Release\App1.exe
[System.Console]::WriteLine("ごにょごにょ...")
[System.Windows.Forms.MessageBox]::Show("終わり")
exit
csproj.txt

コード:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0"
  xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <AssemblyName>App1</AssemblyName>
    <Platform>x64</Platform>
    <OutputType>WinExe</OutputType>
    <OutputPath>.\bin\Release</OutputPath>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
  </PropertyGroup>

  <ItemGroup>
    <ApplicationDefinition Include="Application.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </ApplicationDefinition>

    <Page Include="MainWindow.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>

    <Compile Include="MainWindow.xaml.cs">
      <DependentUpon>MainWindow.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>

    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
    <Reference Include="WindowsBase" />
    <Reference Include="System" />
    <Reference Include="System.Xaml">
      <RequiredTargetFramework>4.0</RequiredTargetFramework>
    </Reference>
  </ItemGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

</Project>
Application.xaml

コード:

<Application x:Class="Application"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="MainWindow.xaml">

</Application>
MainWindow.xaml

コード:

<Window x:Class="MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:c="clr-namespace:"

        Title="MainWindow" Height="300" Width="300"
         Loaded="MainWindow_Loaded">
 
  <Window.Resources>
    <c:ColorConverter x:Key="colorConverter" />

    <Style x:Key="sliderStyle" TargetType="Slider">
      <Setter Property="Width" Value="180" />
      <Setter Property="Minimum" Value="0" />
      <Setter Property="Maximum" Value="255" />
      <Setter Property="LargeChange" Value="16" />
      <Setter Property="SmallChange" Value="1" />
      <Setter Property="TickFrequency" Value="16" />
      <Setter Property="TickPlacement" Value="TopLeft" />
      <Setter Property="IsSnapToTickEnabled" Value="True" />
      <Setter Property="Margin" Value="10" />
    </Style>
  </Window.Resources>

  <StackPanel Orientation="Vertical">
    <Slider Name="sliderRed" Style="{StaticResource sliderStyle}" />
    <Slider Name="sliderGreen" Style="{StaticResource sliderStyle}" />
    <Slider Name="sliderBlue" Style="{StaticResource sliderStyle}" />
    <Rectangle Width="200" Height="60" HorizontalAlignment="Center">
      <Rectangle.Fill>
        <SolidColorBrush>
          <SolidColorBrush.Color>
            <MultiBinding Converter="{StaticResource colorConverter}">
              <MultiBinding.Bindings>
                <Binding ElementName="sliderRed" Path="Value" />
                <Binding ElementName="sliderGreen" Path="Value" />
                <Binding ElementName="sliderBlue" Path="Value" />
              </MultiBinding.Bindings>
            </MultiBinding>
          </SolidColorBrush.Color>
        </SolidColorBrush>
      </Rectangle.Fill>
    </Rectangle>
  </StackPanel>
</Window>
MainWindow.xaml.cs

コード:

using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;

using System.Globalization;

public class ColorConverter : IMultiValueConverter
{
  public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
  {
    byte R = (byte)(double)(values[0]);
    byte G = (byte)(double)(values[1]);
    byte B = (byte)(double)(values[2]);

    return Color.FromRgb(R, G, B);
  }

  //-----------------------------------------------------------------------------------------------
  public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
  {
    return null;
  }
} // end of ColorConverter class


public partial class MainWindow : Window
{
	public MainWindow()
	{
		InitializeComponent();
	}
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {

        }
}
[/size]

Math

Re: 処理を止める。

#27

投稿記事 by Math » 7年前

質問者さんもう終わりますが何か質問があればどうぞ。

閉鎖

“C言語何でも質問掲示板” へ戻る