⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contactinfocontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
字号:
namespace Imps.Client.Pc
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    public class ContactInfoControl : UserControl
    {
        private Color _BorderColor = Color.FromArgb(0xa4, 170, 220);
        private string _fetionNo;
        private System.Drawing.Image _image;
        private int _imageHeight = 0x60;
        private int _imagePadding = 8;
        private int _imageWidth = 0x60;
        private string _mobileNo;
        private Rectangle _recPicture;
        private string _toolTipText;
        private IContainer components;
        private TextBox txtFetionNo;
        private TextBox txtMobileNo;

        public event EventHandler<MouseEventArgs> PictureMouseClick;

        public ContactInfoControl()
        {
            this.InitializeComponent();
            base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
            this.BackColor = Color.White;
            this.MobileNo = string.Empty;
            this.FetionNo = string.Empty;
            base.MouseMove += new MouseEventHandler(this.ContactInfoControl_MouseMove);
            base.MouseClick += new MouseEventHandler(this.ContactInfoControl_MouseClick);
        }

        private void ContactInfoControl_MouseClick(object sender, MouseEventArgs e)
        {
            if ((this.PictureMouseClick != null) && this._recPicture.Contains(e.Location))
            {
                this.PictureMouseClick(sender, e);
            }
        }

        private void ContactInfoControl_MouseMove(object sender, MouseEventArgs e)
        {
            if (this._recPicture.Contains(e.Location))
            {
                this.Cursor = Cursors.Hand;
            }
            else
            {
                this.Cursor = Cursors.Default;
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.txtMobileNo = new TextBox();
            this.txtFetionNo = new TextBox();
            base.SuspendLayout();
            this.txtMobileNo.BackColor = Color.White;
            this.txtMobileNo.BorderStyle = BorderStyle.None;
            this.txtMobileNo.ForeColor = Color.Gray;
            this.txtMobileNo.Location = new Point(7, 0x75);
            this.txtMobileNo.Name = "txtMobileNo";
            this.txtMobileNo.ReadOnly = true;
            this.txtMobileNo.Size = new Size(110, 13);
            this.txtMobileNo.TabIndex = 2;
            this.txtMobileNo.Text = "手机号:13810261800";
            this.txtFetionNo.BackColor = Color.White;
            this.txtFetionNo.BorderStyle = BorderStyle.None;
            this.txtFetionNo.ForeColor = Color.Gray;
            this.txtFetionNo.Location = new Point(7, 0x88);
            this.txtFetionNo.Name = "txtFetionNo";
            this.txtFetionNo.ReadOnly = true;
            this.txtFetionNo.Size = new Size(110, 13);
            this.txtFetionNo.TabIndex = 2;
            this.txtFetionNo.Text = "飞信号:123456789";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            this.BackColor = Color.Transparent;
            base.Controls.Add(this.txtFetionNo);
            base.Controls.Add(this.txtMobileNo);
            base.Name = "ContactInfoControl";
            base.Size = new Size(0x76, 0x9c);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            using (Pen pen = new Pen(this._BorderColor))
            {
                e.Graphics.DrawRectangle(pen, 0, 0, base.Width - 1, base.Height - 1);
                this._recPicture = new Rectangle(this._imagePadding, this._imagePadding, this._imageWidth + 6, this._imageHeight + 6);
                e.Graphics.DrawRectangle(pen, this._recPicture);
            }
            if (this._image != null)
            {
                e.Graphics.DrawImage(this._image, this._imagePadding + 3, this._imagePadding + 3, this._imageWidth, this._imageHeight);
            }
        }

        public Color BorderColor
        {
            get
            {
                return this._BorderColor;
            }
            set
            {
                this._BorderColor = value;
            }
        }

        public string FetionNo
        {
            get
            {
                return this._fetionNo;
            }
            set
            {
                this._fetionNo = value;
                this.txtFetionNo.Text = "飞信号:" + this._fetionNo;
            }
        }

        public System.Drawing.Image Image
        {
            get
            {
                return this._image;
            }
            set
            {
                this._image = value;
                base.Invalidate();
            }
        }

        public string MobileNo
        {
            get
            {
                return this._mobileNo;
            }
            set
            {
                this._mobileNo = value;
                this.txtMobileNo.Text = "手机号:" + this._mobileNo;
            }
        }

        public string ToolTipText
        {
            get
            {
                return this._toolTipText;
            }
            set
            {
                this._toolTipText = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -