C#提示框写法

18 篇文章 0 订阅

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using C_Global;
using C_Event;

namespace M_FJ
{
    public partial class BrowseMusicName : Form
    {
        public BrowseMusicName()
        {
            InitializeComponent();
        }

        public BrowseMusicName(int musicID,int xPos,int yPos)
        {
            InitializeComponent();

            this._musicID = musicID;
            this._xPos = xPos;
            this._yPos = yPos;
        }

        #region 变量
        private CSocketEvent m_ClientEvent = null;

        C_Global.CEnum.Message_Body[,] musicResult = null;

        private int _musicID = 0;
        private string _serverIP = null;
        private int _xPos = 0;
        private int _yPos = 0;
        int seconds = 0;
        #endregion

        #region 调用函数
        /// <summary>
        /// 创建类库中的窗体
        /// </summary>
        /// <param name="oParent">MDI 程序的父窗体</param>
        /// <param name="oSocket">Socket</param>
        /// <returns>类库中的窗体</returns>
        public Form CreateModule(object oParent, object oEvent)
        {
            this.m_ClientEvent = (CSocketEvent)oEvent;
            if (oParent != null)
            {
                this.MdiParent = (Form)oParent;
                this.Show();
            }
            else
            {
                this.ShowDialog();
            }
            return this;
        }
        #endregion

        #region 函数
        public void InitializeMusicList()
        {
            try
            {

                //C_Global.CEnum.Message_Body[] messageBody = new C_Global.CEnum.Message_Body[2];


                //messageBody[0].eTag = C_Global.CEnum.TagFormat.TLV_STRING;
                //messageBody[0].eName = C_Global.CEnum.TagName.SDO_ServerIP;
                //messageBody[0].oContent = _serverIP;

                //messageBody[1].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER;
                //messageBody[1].eName = C_Global.CEnum.TagName.SDO_MusicID1;
                //messageBody[1].oContent = _musicID;

                //musicResult = m_ClientEvent.RequestResult(C_Global.CEnum.ServiceKey.SDO_MUSICDATA_OWN_QUERY, C_Global.CEnum.Msg_Category.SDO_ADMIN, messageBody);


                CEnum.Message_Body[] mContent = new CEnum.Message_Body[1];

                mContent[0].eName = CEnum.TagName.FJ_Item_GuID;
                mContent[0].eTag = CEnum.TagFormat.TLV_INTEGER;
                mContent[0].oContent = this._musicID;

                //musicResult = m_ClientEvent.RequestResult(C_Global.CEnum.ServiceKey.FJ_ItemName_Query, C_Global.CEnum.Msg_Category.SDO_ADMIN, mContent);
                musicResult = Operation_FJ.GetResult(m_ClientEvent, CEnum.ServiceKey.FJ_ItemName_Query, mContent);

                //检测状态

                if (musicResult[0, 0].eName == C_Global.CEnum.TagName.ERROR_Msg)
                {
                    musicName.Text = "";
                    return;
                }

                musicName.Text = musicResult[0, 0].oContent.ToString();
               
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }
        #endregion

        private void BrowseMusicName_Load(object sender, EventArgs e)
        {
          
           

            if (_xPos > (Screen.GetWorkingArea(this).Width - this.Width))
            {
                _xPos = Screen.GetWorkingArea(this).Width - this.Width;
            }
            if (_yPos > (Screen.GetWorkingArea(this).Height - this.Height))
            {
                _yPos = Screen.GetWorkingArea(this).Height - this.Height;
            }
            this.Location = new Point(_xPos, _yPos);
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void dividerPanel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            seconds += 1;
            if (seconds == 1)
            {
                InitializeMusicList();
                timer1.Enabled = false;
            }
        }
    }


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值