VB控件在C#中的使用Word文档下载推荐.docx
- 文档编号:21049520
- 上传时间:2023-01-27
- 格式:DOCX
- 页数:13
- 大小:104.83KB
VB控件在C#中的使用Word文档下载推荐.docx
《VB控件在C#中的使用Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《VB控件在C#中的使用Word文档下载推荐.docx(13页珍藏版)》请在冰豆网上搜索。
10.{
11.
///
<
summary>
12.
Form1
的摘要说明。
13.
/summary>
14.
public
class
frmTest
:
System.Windows.Forms.Form
15.
{
16.
private
System.Windows.Forms.Button
cmdConn;
17.
System.Windows.Forms.PictureBox
picFlag;
18.
AxCP243TCPS.AxCP243Client
cp243;
19.
cmdClose;
20.
System.Windows.Forms.TextBox
txtData;
21.
System.Windows.Forms.CheckBox
chkAuto;
22.
System.Windows.Forms.Timer
timer1;
23.
cmdRead;
24.
System.Windows.Forms.Label
label1;
25.
txtIP;
26.
label2;
27.
txtAddr;
28.
cmdWrite;
29.
System.ComponentModel.IContainer
components;
30.
31.
frmTest()
32.
33.
//
34.
//
Windows
窗体设计器支持所必需的
35.
36.
InitializeComponent();
37.
38.
39.
TODO:
在
InitializeComponent
调用后添加任何构造函数代码
40.
41.
}
42.
43.
44.
清理所有正在使用的资源。
45.
46.
protected
override
void
Dispose(
bool
disposing
)
47.
48.
if(
49.
50.
if
(components
!
=
null)
51.
52.
components.Dispose();
53.
54.
55.
base.Dispose(
);
56.
57.
58.
#region
窗体设计器生成的代码
59.
60.
设计器支持所需的方法
-
不要使用代码编辑器修改
61.
此方法的内容。
62.
63.
InitializeComponent()
64.
65.
ponents
new
System.ComponentModel.Container();
66.
System.Resources.ResourceManager
resources
System.Resources.ResourceManager(typeof(frmTest));
67.
this.cp243
AxCP243TCPS.AxCP243Client();
68.
this.cmdConn
System.Windows.Forms.Button();
69.
this.picFlag
System.Windows.Forms.PictureBox();
70.
this.cmdClose
71.
this.txtData
System.Windows.Forms.TextBox();
72.
this.chkAuto
System.Windows.Forms.CheckBox();
73.
this.timer1
System.Windows.Forms.Timer(ponents);
74.
this.cmdRead
75.
this.label1
System.Windows.Forms.Label();
76.
this.txtIP
77.
this.label2
78.
this.txtAddr
79.
this.cmdWrite
80.
((System.ComponentModel.ISupportInitialize)(this.cp243)).BeginInit();
81.
this.SuspendLayout();
82.
83.
cp243
84.
85.
this.cp243.Enabled
true;
86.
this.cp243.Location
System.Drawing.Point(168,
40);
87.
this.cp243.Name
"
cp243"
88.
this.cp243.OcxState
((System.Windows.Forms.AxHost.State)(resources.GetObject("
cp243.OcxState"
)));
89.
this.cp243.Size
System.Drawing.Size(143,
101);
90.
this.cp243.TabIndex
0;
91.
92.
cmdConn
93.
94.
this.cmdConn.Location
System.Drawing.Point(240,
8);
95.
this.cmdConn.Name
cmdConn"
96.
this.cmdConn.Size
System.Drawing.Size(56,
24);
97.
this.cmdConn.TabIndex
1;
98.
this.cmdConn.Text
连接"
99.
this.cmdConn.Click
+=
System.EventHandler(this.cmdConn_Click);
100.
101.
picFlag
102.
103.
this.picFlag.BackColor
System.Drawing.Color.Red;
104.
this.picFlag.BorderStyle
System.Windows.Forms.BorderStyle.FixedSingle;
105.
this.picFlag.Location
System.Drawing.Point(8,
106.
this.picFlag.Name
picFlag"
107.
this.picFlag.Size
System.Drawing.Size(24,
108.
this.picFlag.TabIndex
2;
109.
this.picFlag.TabStop
false;
110.
111.
cmdClose
112.
113.
this.cmdClose.Location
System.Drawing.Point(304,
114.
this.cmdClose.Name
cmdClose"
115.
this.cmdClose.Size
116.
this.cmdClose.TabIndex
3;
117.
this.cmdClose.Text
断开"
118.
this.cmdClose.Click
System.EventHandler(this.cmdClose_Click);
119.
120.
txtData
121.
122.
this.txtData.Location
System.Drawing.Point(88,
176);
123.
this.txtData.Name
txtData"
124.
this.txtData.Size
System.Drawing.Size(272,
21);
125.
this.txtData.TabIndex
4;
126.
this.txtData.Text
127.
128.
chkAuto
129.
130.
this.chkAuto.Location
144);
131.
this.chkAuto.Name
chkAuto"
132.
this.chkAuto.Size
System.Drawing.Size(64,
133.
this.chkAuto.TabIndex
5;
134.
this.chkAuto.Text
连续读"
135.
this.chkAuto.CheckedChanged
System.EventHandler(this.chkAuto_CheckedChanged);
136.
137.
timer1
138.
139.
this.timer1.Interval
500;
140.
this.timer1.Tick
System.EventHandler(this.timer1_Tick);
141.
142.
cmdRead
143.
144.
this.cmdRead.Location
System.Drawing.Point(16,
145.
this.cmdRead.Name
cmdRead"
146.
this.cmdRead.Size
147.
this.cmdRead.TabIndex
6;
148.
this.cmdRead.Text
读"
149.
this.cmdRead.Click
System.EventHandler(this.cmdRead_Click);
150.
151.
label1
152.
153.
this.label1.Location
System.Drawing.Point(40,
13);
154.
this.label1.Name
label1"
155.
this.label1.Size
System.Drawing.Size(112,
16);
156.
this.label1.TabIndex
7;
157.
this.label1.Text
IP"
158.
159.
txtIP
160.
161.
this.txtIP.Location
System.Drawing.Point(64,
10);
162.
this.txtIP.Name
txtIP"
163.
this.txtIP.Size
System.Drawing.Size(152,
164.
this.txtIP.TabIndex
8;
165.
this.txtIP.Text
192.168.0.166"
166.
167.
label2
168.
169.
this.label2.Location
181);
170.
this.label2.Name
label2"
171.
this.label2.Size
System.Drawing.Size(40,
172.
this.label2.TabIndex
9;
173.
this.label2.Text
地址"
174.
175.
txtAddr
176.
177.
this.txtAddr.Location
System.Drawing.Point(48,
178.
this.txtAddr.Name
txtAddr"
179.
this.txtAddr.Size
System.Drawing.Size(32,
180.
this.txtAddr.TabIndex
10;
181.
this.txtAddr.Text
0"
182.
183.
cmdWrite
184.
185.
this.cmdWrite.Location
186.
this.cmdWrite.Name
cmdWrite"
187.
this.cmdWrite.Size
188.
this.cmdWrite.TabIndex
11;
189.
this.cmdWrite.Text
写"
190.
this.cmdWrite.Click
System.EventHandler(this.cmdWrite_Click);
191.
192.
frmTest
193.
194.
this.AutoScale
195.
this.AutoScaleBaseSize
System.Drawing.Size(6,
14);
196.
this.ClientSize
System.Drawing.Size(376,
214);
197.
this.Controls.Add(this.cmdWrite);
198.
this.Controls.Add(this.txtAddr);
199.
this.Controls.Add(this.label2);
200.
this.Controls.Add(this.txtIP);
201.
this.Controls.Add(this.label1);
202.
this.Controls.Add(this.cmdRead);
203.
this.Controls.Add(this.chkAuto);
204.
this.Controls.Add(this.txtData);
205.
this.Controls.Add(this.cmdClose);
206.
this.Controls.Add(this.picFlag);
207.
this.Controls.Add(this.cmdConn);
208.
this.Controls.Add(this.cp243);
209.
this.Name
frmTest"
210.
this.StartPosition
System.Windows.Forms.FormStartPosition.CenterScreen;
211.
this.Text
CP243测试"
212.
this.TopMost
213.
this.Load
System.EventHandler(this.frmTest_Load);
214.
((System.ComponentModel.ISupportInitialize)(this.cp243)).EndInit();
215.
this.ResumeLayout(false);
216.
217.
218.
#endregion
219.
220.
221.
应用程序的主入口点。
222.
223.
[STAThread]
224.
static
Main()
225.
226.
Application.Run(new
frmTest());
227.
228.
229.
cmdConn_Click(object
sender,
System.EventArgs
e)
230.
231.
int
lngRet;
232.
string
strIP=txtIP.Text;
233.
intPort=102;
234.
//cp243.RemoteHost=str;
235.
//cp243.RemotePort
=intPort;
236.
lngRet=cp243.OpenConnect(ref(strIP),ref(intPort));
237.
if(lngRet==0)
238.
{
239.
picFlag.BackColor=System.Drawing.Color.Green;
240.
241.
else
242.
243.
picFlag.BackColor=System.Drawing.Color.Red
244.
245.
246.
247.
248.
cmdClose_Click(obj
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- VB 控件 C# 中的 使用