예제 #1
0
        public Form1()
        {
            InitializeComponent();

            isSearchTextBoxEmpty = true;
            isChatTextBoxNotFocusedAndEmpty = true;
            isMyNameNotFocusedAndEmpty = true;

            isIDAvailable = false;
            isRegister = false;

            backgroundColor = System.Drawing.Color.PaleTurquoise;
            lightColor = System.Drawing.Color.Azure;
            darkColor = System.Drawing.Color.LightSeaGreen;
            //loadTheme();

            emoticonButtonNum = 32;
            emoticonImages = new System.Drawing.Image[emoticonButtonNum];
            for (int i = 0; i < emoticonButtonNum; ++i)
            {
                emoticonImages[i] = (Image)Properties.Resources.ResourceManager.GetObject("_" + (i+1).ToString());
            }
            genEmoticonButtons();

            defaultUserImage = global::chatRoomClient.Properties.Resources.defaultImage;
            chatImage = global::chatRoomClient.Properties.Resources.chatBlack;
            folderImage = global::chatRoomClient.Properties.Resources.folder;
            micImage = global::chatRoomClient.Properties.Resources.mic;

            msgHandler = parseReceiveMessage;

            client = chatSocket.connect();
            client.newListener(parseReceiveMessage);

            userListTable.Visible = false;
            this.ActiveControl = myNameTextBox;     //focus on myName
        }
예제 #2
0
        public userGUI(int id, String sid, chatSocket clnt)
        {
            client = clnt;

            ID = id;
            sID = sid;

            userPic = new PictureBox();
            infoPanel = new TableLayoutPanel();
            sIDLabel = new Label();
            buttonHandle = new FlowLayoutPanel();
            chatButton = new Button();
            fileButton = new Button();
            micButton = new Button();
            addButton = new Button();

            userPic.BackColor = Color.White;
            userPic.BackgroundImage = global::chatRoomClient.Properties.Resources.defaultImage;
            userPic.BackgroundImageLayout = ImageLayout.Zoom;
            userPic.BackColor = Color.Transparent;
            userPic.Dock = DockStyle.Fill;
            userPic.Location = new Point(0, 0);
            userPic.Margin = new Padding(0);
            userPic.Size = new Size(48, 48);
            userPic.SizeMode = PictureBoxSizeMode.Zoom;

            infoPanel.ColumnCount = 1;
            infoPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
            infoPanel.Controls.Add(this.buttonHandle, 0, 1);
            infoPanel.Controls.Add(this.sIDLabel, 0, 0);
            infoPanel.Location = new Point(48, 0);
            infoPanel.Margin = new Padding(0);
            infoPanel.RowCount = 2;
            infoPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
            infoPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
            infoPanel.Size = new Size(199, 48);

            sIDLabel.AutoSize = true;
            sIDLabel.Dock = DockStyle.Fill;
            sIDLabel.Font = new Font("微軟正黑體", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(136)));
            //sIDLabel.Location = new Point(3, 3);
            sIDLabel.Margin = new Padding(0);
            sIDLabel.Size = new Size(193, 18);
            this.sIDLabel.Text = sID;

            buttonHandle.Dock = DockStyle.Fill;
            buttonHandle.Location = new Point(0, 24);
            buttonHandle.Margin = new Padding(0);
            buttonHandle.Size = new Size(199, 24);

            initializeButton(chatButton, global::chatRoomClient.Properties.Resources.chatBlack);
            initializeButton(fileButton, global::chatRoomClient.Properties.Resources.folder);
            initializeButton(micButton, global::chatRoomClient.Properties.Resources.mic);
            initializeButton(addButton, global::chatRoomClient.Properties.Resources.plus);
            buttonHandle.Controls.Add(chatButton);
            buttonHandle.Controls.Add(fileButton);
            buttonHandle.Controls.Add(micButton);
            buttonHandle.Controls.Add(addButton);

            chatButton.Click += new EventHandler(this.chatButton_Click);
            fileButton.Click += new EventHandler(this.fileButton_Click);
            micButton.Click += new EventHandler(this.micButton_Click);
            addButton.Click += new EventHandler(this.addButton_Click);

            /*
            chatButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            chatButton.Location = new System.Drawing.Point(3, 3);
            chatButton.Size = new System.Drawing.Size(16, 16);
            chatButton.UseVisualStyleBackColor = true;
            chatButton.Click += new System.EventHandler(this.chatButton_Click);

            fileButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            fileButton.Location = new System.Drawing.Point(25, 3);
            fileButton.Size = new System.Drawing.Size(16, 16);
            fileButton.UseVisualStyleBackColor = true;
            */
        }