2011-01-05 8 views
1

HI、Windowsフォームアプリ:フォームオーダーを設定するには?

私はWindowsフォームアプリが初めてで、プロトタイプアプリケーションを1つ作成しようとしています。私はデータ入力フォームを設計し、ビジネスロジックをコード化しました。今、私はウェルカムフォームからデータ入力フォームを開こうとしています。しかし、私が「ようこそ」フォームを実行するたびに、私のデータ入力フォームが実行されます(これはウェルカムフォームの前に作成されます)。フォームの実行順序はどこで設定できますか?ここで

はあなたのソリューションで

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; 
using iTextSharp.text; 
using iTextSharp.text.pdf; 
using System.IO; 

namespace PrototypeApp 
{ 
public partial class Form1 : Form 
{ 
    public Form1() 
    { 
     InitializeComponent(); 
    } 

    private void button3_Click(object sender, EventArgs e) 
    { 
     string pdfTemplate = "C:\\app\\End_Of_Project_Client_Evaluation_Template.pdf"; 
     string newFile = "C:\\app\\End_Of_Project_Client_Evaluation_Template_update.pdf"; 

     PdfReader reader = new PdfReader(pdfTemplate); 
     PdfStamper pdfStamper = new PdfStamper(reader, new FileStream(newFile, FileMode.Create)); 


     AcroFields fields = pdfStamper.AcroFields; 

     fields.SetField("client", txtClient.Text); 
     fields.SetField("project", txtProject.Text); 
     fields.SetField("project_area", txtArea.Text); 
     fields.SetField("project_no", txtLandProjectNo.Text); 
     fields.SetField("suggestions", txtSuggestions.Text); 
     fields.SetField("project_strength", txtStrengths.Text); 
     fields.SetField("other_suggestions", txtComments.Text); 


     pdfStamper.FormFlattening = false; 

     // close the pdf 
     pdfStamper.Close(); 

     MessageBox.Show("Pdf document successfully updated!!"); 

    } 

} 

}

答えて

2

、Form1のコードであるあなたは、ファイルを持っているのProgram.csを呼び出し、それを開き、次の行を変更します。

Application.Run(new Form1()); 

Application.Run(new WelcomeForm()); 

ここで、WelcomeFormはウェルカムUIクラスの名前です。この変更により、アプリケーションの起動時にフォームが表示され、その後、必要に応じて他のフォームを開始するコードを追加できます。

+0

これは私が探していたものです:)もう一つ、ウェルカムスクリーンメニューのform1をリンクした後、form1をクリックすると新しいウィンドウが開きます。メニューの下にあるウェルカムスクリーンそのものを開く方法。これを達成するために、フレームの種類の制御を配置する必要がありますか? – Rishi

+1

@リシ、簡単で汚い解決策の1つは、すべてのコントロールをウェルカムスクリーンに追加し、ウィンドウのサイズを変更することです。メニューのみが表示されるように高さを設定し、クリックするとすべてが表示されるように高さを拡張します。 –

関連する問題