找回密碼 或 安全提問
 註冊
|註冊|登錄

伊莉討論區

搜索
感激所有對伊莉作出奉獻的人儲值後自動升級用戶組安全提問(回答) 和 永久尊貴會員 事宜
三上上原亞衣julia出包王女259luxu柯南按摩
新竹我推的勇者召喚sdjs 189falloutabw 121room

休閒聊天興趣交流學術文化旅遊交流飲食交流家庭事務PC GAMETV GAME
熱門線上其他線上感情感性寵物交流家族門派動漫交流貼圖分享BL/GL
音樂世界影視娛樂女性頻道潮流資訊BT下載區GB下載區下載分享短片
電腦資訊數碼產品手機交流交易廣場網站事務長篇小說體育運動時事經濟
上班一族博彩娛樂

桃園龜山 女騎士煞不

衝進中橫水溝 紅牌重

快艇正妹豪乳吸睛

(4月新番)[繁]為美好

✡ 斗破蒼穹 年番/鬥

[簡]Unnamed Memory
C & C++ 語言C# 語言Visual Basic 語言PHP 語言JAVA 語言
查看: 4123|回復: 1
打印上一主題下一主題

[求助]請問一下有關C# CALL LABVIEW[複製鏈接]

Rank: 1

帖子
277
積分
194 點
潛水值
29337 米
跳轉到指定樓層
樓主
發表於 2011-2-27 04:00 PM|只看該作者|倒序瀏覽
本帖最後由 b06003740095 於 2011-2-27 04:11 PM 編輯

就是我想要用C#的Windows Form做一個 可以呼叫   labview的程式labview的主要是擷取X光的攝影機所拍到的醫學影像,我需要把影像
CALL進去c#裡面,不知道該怎麼做


  1. public Form1()

  2. {

  3. //

  4. // Required for Windows Form Designer support

  5. //

  6. InitializeComponent();


  7. //

  8. // TODO: Add any constructor code after InitializeComponent call

  9. //

  10. }


  11. /// <summary>

  12. /// Clean up any resources being used.

  13. /// </summary>

  14. protected override void Dispose( bool disposing )

  15. {

  16. if( disposing )

  17. {

  18. if (components != null)

  19. {

  20. components.Dispose();

  21. }

  22. }

  23. base.Dispose( disposing );

  24. }


  25. #region Windows Form Designer generated code

  26. /// <summary>

  27. /// Required method for Designer support - do not modify

  28. /// the contents of this method with the code editor.

  29. /// </summary>

  30. private void InitializeComponent()

  31. {

  32. this.OpenLV = new System.Windows.Forms.Button();

  33. this.RunVI = new System.Windows.Forms.Button();

  34. this.QuitLV = new System.Windows.Forms.Button();

  35. this.textBox1 = new System.Windows.Forms.TextBox();

  36. this.textBox2 = new System.Windows.Forms.TextBox();

  37. this.label2 = new System.Windows.Forms.Label();

  38. this.label3 = new System.Windows.Forms.Label();

  39. this.checkBox1 = new System.Windows.Forms.CheckBox();

  40. this.SuspendLayout();

  41. //

  42. // OpenLV

  43. //

  44. this.OpenLV.Location = new System.Drawing.Point(16, 24);

  45. this.OpenLV.Name = "OpenLV";

  46. this.OpenLV.Size = new System.Drawing.Size(120, 40);

  47. this.OpenLV.TabIndex = 0;

  48. this.OpenLV.Text = "Launch LabVIEW";

  49. this.OpenLV.Click += new System.EventHandler(this.OpenLV_Click);

  50. //

  51. // RunVI

  52. //

  53. this.RunVI.Enabled = false;

  54. this.RunVI.Location = new System.Drawing.Point(16, 80);

  55. this.RunVI.Name = "RunVI";

  56. this.RunVI.Size = new System.Drawing.Size(120, 40);

  57. this.RunVI.TabIndex = 1;

  58. this.RunVI.Text = "Run VI";

  59. this.RunVI.Click += new System.EventHandler(this.RunVI_Click);

  60. //

  61. // QuitLV

  62. //

  63. this.QuitLV.Enabled = false;

  64. this.QuitLV.Location = new System.Drawing.Point(16, 144);

  65. this.QuitLV.Name = "QuitLV";

  66. this.QuitLV.Size = new System.Drawing.Size(120, 40);

  67. this.QuitLV.TabIndex = 2;

  68. this.QuitLV.Text = "Exit LabVIEW";

  69. this.QuitLV.Click += new System.EventHandler(this.QuitLV_Click);

  70. //

  71. // textBox1

  72. //

  73. this.textBox1.Location = new System.Drawing.Point(168, 88);

  74. this.textBox1.Name = "textBox1";

  75. this.textBox1.Size = new System.Drawing.Size(152, 20);

  76. this.textBox1.TabIndex = 3;

  77. this.textBox1.Text = "";

  78. //

  79. // textBox2

  80. //

  81. this.textBox2.Location = new System.Drawing.Point(168, 160);

  82. this.textBox2.Name = "textBox2";

  83. this.textBox2.Size = new System.Drawing.Size(152, 20);

  84. this.textBox2.TabIndex = 4;

  85. this.textBox2.Text = "";

  86. //

  87. // label2

  88. //

  89. this.label2.Location = new System.Drawing.Point(168, 48);

  90. this.label2.Name = "label2";

  91. this.label2.Size = new System.Drawing.Size(136, 40);

  92. this.label2.TabIndex = 8;

  93. this.label2.Text = "Enter an arithmetic expression.  Recognized operators are +,-,*,/,%,(,)";

  94. //

  95. // label3

  96. //

  97. this.label3.Location = new System.Drawing.Point(168, 136);

  98. this.label3.Name = "label3";

  99. this.label3.Size = new System.Drawing.Size(136, 24);

  100. this.label3.TabIndex = 9;

  101. this.label3.Text = "Result";

  102. //

  103. // checkBox1

  104. //

  105. this.checkBox1.Location = new System.Drawing.Point(168, 16);

  106. this.checkBox1.Name = "checkBox1";

  107. this.checkBox1.Size = new System.Drawing.Size(136, 32);

  108. this.checkBox1.TabIndex = 10;

  109. this.checkBox1.Text = "Display VI front panel";

  110. //

  111. // Form1

  112. //

  113. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

  114. this.ClientSize = new System.Drawing.Size(368, 213);

  115. this.Controls.AddRange(new System.Windows.Forms.Control[] {

  116.   this.checkBox1,

  117.   this.label3,

  118.   this.label2,

  119.   this.textBox2,

  120.   this.textBox1,

  121.   this.QuitLV,

  122.   this.RunVI,

  123.   this.OpenLV});

  124. this.Name = "Form1";

  125. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;

  126. this.Text = "LabVIEW Server";

  127. this.ResumeLayout(false);


  128. }

  129. #endregion


  130. /// <summary>

  131. /// The main entry point for the application.

  132. /// </summary>

  133. [STAThread]

  134. static void Main()

  135. {

  136. System.Windows.Forms.Application.Run(new Form1());

  137. }


  138. private void OpenLV_Click(object sender, System.EventArgs e)

  139. {

  140. //Instantiate a reference to LabVIEW

  141. lv = new LabVIEW.ApplicationClass();



  142. //Set the path to the VI

  143. string vipath=lv.ApplicationDirectory.ToString() + @"\Examples\General\Strings.llb\Parse Arithmetic Expression.vi";



  144. //Get reference to that VI

  145. vi= lv.GetVIReference(vipath,"",true);



  146. OpenLV.Enabled=false;

  147. RunVI.Enabled=true;

  148. QuitLV.Enabled=true;


  149. }


  150. private void RunVI_Click(object sender, System.EventArgs e)

  151. {


  152. /*

  153. * Initialize the variables and define the strings corresponding to

  154. * the VI connector labels. Note the strings are case sensitive

  155. **/


  156. string[] str1 = new String[2];

  157. str1[0]="Arithmetic Expression";

  158. str1[1]="Result";



  159. //The wrapper function expects to be passed a object type by reference.

  160. //We pass the string array to the object type here

  161. object param1 = (object)str1;


  162. //Define the variable that will pass the expression to be evaluated to

  163. //LabVIEW and typecast it to type object


  164. object[] str2 = new object[2];

  165. str2[0]=textBox1.Text.ToString();

  166. object param2= (object)str2;



  167. //Check if front panel of VI should be displayed


  168. if(checkBox1.Checked==false)

  169. vi.ShowFPOnCall=false;

  170. else

  171. vi.ShowFPOnCall=true;



  172. //Call the VI

  173. vi.Call(ref param1,ref param2);


  174. //Display the result

  175. textBox2.Text=((object[])param2)[1].ToString();



  176. }


  177. private void QuitLV_Click(object sender, System.EventArgs e)

  178. {

  179. //Close LabVIEW

  180. if(lv!=null)

  181. lv.Quit();


  182. OpenLV.Enabled=true;

  183. RunVI.Enabled=false;

  184. QuitLV.Enabled=false;



  185. }

  186. }
  187. }
複製代碼

這是一個網路上看到的範例
可是我現在只能做到把labivew打開
但是沒辦法把裡面的影像拿出來...
瀏覽完整內容,請先 註冊登入會員
分享分享0收藏收藏0支持支持0

使用道具檢舉

帖子
175
積分
16 點
潛水值
645 米
頭香
發表於 2011-3-7 02:11 PM|只看該作者
如果瀏覽伊莉時速度太慢或無法連接,可以使用其他分流瀏覽伊莉,www01.eyny.com(02,03)。

使用道具檢舉

您需要登錄後才可以回帖 登錄 | 註冊

Powered by Discuz!

© Comsenz Inc.

重要聲明:本討論區是以即時上載留言的方式運作,對所有留言的真實性、完整性及立場等,不負任何法律責任。而一切留言之言論只代表留言者個人意見,並非本網站之立場,用戶不應信賴內容,並應自行判斷內容之真實性。於有關情形下,用戶應尋求專業意見(如涉及醫療、法律或投資等問題)。 由於本討論區受到「即時上載留言」運作方式所規限,故不能完全監察所有留言,若讀者發現有留言出現問題,請聯絡我們。有權刪除任何留言及拒絕任何人士上載留言,同時亦有不刪除留言的權利。切勿上傳和撰寫 侵犯版權(未經授權)、粗言穢語、誹謗、渲染色情暴力或人身攻擊的言論,敬請自律。本網站保留一切法律權利。
回頂部