如何添加一个不可见的Panel控件以及如何在c#windows窗体中添加winsock控件 [英] How to add an invisible Panel control and how to add winsock controls inside it in c# windows forms

查看:362
本文介绍了如何添加一个不可见的Panel控件以及如何在c#windows窗体中添加winsock控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我的名字是过去2天的固定我一直在打破如何添加隐形面板控件以及如何在c#windows窗体中添加winsock控件?

i有3 winsock我的表单中的控件命名为:form#in c#windows forms。

1st winsock control命名为: Winsock1 ,协议: sckTCPProtocol ,可见: true

名为: sckServer 的第二个winsock控件,协议: sckTCPProtocol ,可见: true

第3个winsock控件名为: axWinsock5 ,协议: sckTCPProtocol ,可见:是真的



我不能在c#windows窗体中使用与 System.Net.Sockets 相关联的类,并且我必须仅使用winsock控件来实现此目的,因为它是我的 BOSS的订单。



我正在创建一个名为: sckClient 的控制数组,并将其初始化为名为的winsock控件: axWinsock5

下面是我的c#代码创建控件arr Form1中的ay(sckClient):

Hi my name is vishal for past 2 days i have been breaking my head on How to add an invisible Panel control and how to add winsock controls inside it in c# windows forms?
i have 3 winsock controls in my form named:Form1 in c# windows forms.
1st winsock control named:Winsock1,Protocol:sckTCPProtocol,visible:true
2nd winsock control named:sckServer,Protocol:sckTCPProtocol,Visible:true
3rd winsock control named:axWinsock5,Protocol:sckTCPProtocol,Visible:true

I cannot use classes associated with System.Net.Sockets in c# windows forms and that i have to use only winsock controls for this purpose since it is my BOSS's orders.

I am at the process of creating a control array named:sckClient and initializing it to my winsock control named: axWinsock5.
Given below is my c# code of creating control array(sckClient) in Form1:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Diagnostics;
namespace DRRS_Socket_Application
{
    public partial class Form1 : Form
    {
        private AxMSWinsockLib.AxWinsock axWinsock1;
        private AxMSWinsockLib.AxWinsock[] sckClient = new AxMSWinsockLib.AxWinsock[20];
public Form1()
        {
            InitializeComponent();
            sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); 
        }
private void Form1_Load(object sender, EventArgs e)
        {
            int x;
            for (x = 0; x < 20; x++)
            {
                sckClient[x]=new AxMSWinsockLib.AxWinsock();
                ((System.ComponentModel.ISupportInitialize)(this.axWinsock5)).BeginInit();
                sckClient[x].Enabled = true;
                axWinsock5.EndInit();
                StartListen();
          }
        }
private void StartListen()
        {
            sckServer.Close();
            sckServer.LocalPort = 25000;
            sckServer.Listen();
        }



我的第一个问题是我正确创建了一个名为: sckClient 的控制数组,并将其初始化为winsock控件名为:< b> axWinsock5 在c#windows窗体中。



我没有质疑这个论坛的人/成员帮助我/慷慨地与我分享他的知识。我只是质疑自己创建了名为: sckClient 的控件数组并将其初始化为winsock控件名为: axWinsock5



我问这个问题是因为在对c#windows窗体中如何正确创建和操作winsock控件的控制数组进行了一些研究之后,我得到了一个意见,我应该创建一个名为: Panel1 的不可见Panel控件,将我的winsock控件( Winsock1 sckServer axWinsock5 )添加到/在 Panel1 和axWinsock5.EndInit();应该在c#windows窗体中的Panel1(面板控件)的EndInit()属性之后。



我正确的方向正确创建控件数组( sckClient )并在c#窗体中以形式( Form1 )将其初始化为winsock控件( axWinsock5 )?

如果是这样的话可以有人如何在我的面板控件中使用我的Winsock控件(Winsock1,sckServer,axWinsock5)在c#windows窗体中如何在c#windows窗体中创建隐形面板控件?

任何人都可以给我一个关于如何在c#windows窗体中使用winsock控件创建一个不可见的面板控件的示例?



任何人都可以帮助我/指导我解决我的问题!任何帮助/指导解决这个问题将不胜感激。


My first question is have i correctly created a control array named:sckClient and initialized it to winsock control named:axWinsock5 in c# windows forms.

I not questioning the person/member of this forum who has helped me / shared his knowledge generously with me. I am just questioning myself that have i created control array named:sckClient and initialized it to winsock control named:axWinsock5?

I am asking this question because after having done some research on how to correctly create and manipulate control array of winsock control in c# windows forms i got an opinion that i should create an invisible Panel control named:Panel1,add my winsock controls(Winsock1,sckServer,axWinsock5) to/inside Panel1 and that axWinsock5.EndInit(); should be after EndInit() property of Panel1(panel control) in c# windows forms.

Am i going in correct direction of correctly creating control array(sckClient) and initializing it to winsock control(axWinsock5) in my form(Form1) in c# windows forms?
If so Can anyone help me please on how to create invisible panel control in c# windows forms with my Winsock controls(Winsock1,sckServer,axWinsock5) inside my panel control in c# windows forms?
Can anyone at least send me a sample on how to create a invisible panel control with winsock controls inside it in c# windows forms?

Can anyone help me/guide me please to solve my problem! Any help/guidance in solving of this problem would be greatly appreciated.

推荐答案

这篇关于如何添加一个不可见的Panel控件以及如何在c#windows窗体中添加winsock控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆