小编lew*_*wis的帖子

'Timer'错误是'System.Windows.Forms.Timer'和'System.Threading.Timer'之间的模糊引用

我显示错误:

'Timer'是'System.Windows.Forms.Timer'和'System.Threading.Timer'之间的模糊引用 
当我添加时钟代码

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 System.Net.Sockets;
using System.Threading;
using System.Security.Cryptography;


namespace SocketClient
{

    public partial class SocketClient : Form
    {
        System.Net.Sockets.TcpClient clientSocket = new System.Net.Sockets.TcpClient();
        NetworkStream serverStream = default(NetworkStream);
        string readData = null;


        public SocketClient()
        {
            InitializeComponent();
            Timer timer = new Timer();
            timer.Tick += new EventHandler(TimerOnTick);
            timer.Interval = 1000;
            timer.Start();
        }



        private void TimerOnTick(object sender, EventArgs ea)
        {
            Invalidate();
        }

        protected override void OnPaint(PaintEventArgs pea) …
Run Code Online (Sandbox Code Playgroud)

c#

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

c# ×1