Example #1
0
        public void AddFastBtns(ContractCategoryDic cv, bool ischoose)
        {
            MButton btn = new MButton();

            btn.Text                = cv.categoryName;
            btn.hasChoose           = ischoose;
            btn.hasFrame            = false;
            btn.ForeColor           = COLOR.RGB(MCommonData.fontColor4);
            btn.MouseForeColor      = COLOR.RGB(MCommonData.fontColor2);
            btn.BackColor           = COLOR.RGB(MCommonData.fontColor0);
            btn.MouseBackColor      = COLOR.RGB(MCommonData.fontColor0);
            btn.MouseClickBackColor = COLOR.RGB(MCommonData.fontColor3);
            btn.MouseDown          += Btn_Click;
            btn.Tag = cv;
            btns4.btns.Add(btn);

            MLine vline = new MLine();

            vline.Width     = 1;
            vline.LineColor = COLOR.RGB(MCommonData.LineColor);
            btns4.vlines.Add(vline);
        }
Example #2
0
        protected MUseTable table;     //表格
        #endregion

        /// <summary>
        /// 初始化界面
        /// </summary>
        protected void Initialize()
        {
            #region 窗口阴影
            WinAPI.SetClassLong(this.Handle, WinAPI.GCL_STYLE, WinAPI.GetClassLong(this.Handle, WinAPI.GCL_STYLE) | WinAPI.CS_DropSHADOW); //API函数加载,实现窗体边框阴影效果
            #endregion

            #region 画板初始化
            Logger.LogInfo("画板初始化!");
            RECT defult = new RECT();
            this.board              = new MBorad();
            this.board.Dock         = DockStyle.Fill;
            this.board.Location     = new Point(0, 0);
            this.board.Name         = "cBoard";
            this.board.BackColor    = Color.Black;
            this.board.Click       += Board_Click;
            this.board.DoubleClick += Board_DoubleClick;
            this.board.MouseWheel  += Board_MouseWheel;

            this.Controls.Add(board);
            #endregion

            #region 第一行
            Logger.LogInfo("初始化第一行背景!");
            mrbk           = new MRectangle();
            mrbk.BackColor = COLOR.RGB(MCommonData.fontColor5);
            this.board.AddControl(mrbk);

            #region  钮
            btns1 = new MButtons();

            Logger.LogInfo("初始化第一行行情按钮!");
            MLineButton btnhq = new MLineButton();
            btnhq.Font           = MCommonData.d2Font;
            btnhq.Text           = "行情";
            btnhq.ForeColor      = COLOR.RGB(MCommonData.fontColor1);
            btnhq.MouseForeColor = COLOR.RGB(MCommonData.fontColor2);
            btnhq.hasChoose      = true;
            btnhq.MouseDown     += Btnhq_Click;
            btns1.btns.Add(btnhq);

            Logger.LogInfo("初始化第一行我的资金按钮!");
            MLineButton btnls = new MLineButton();
            btnls.Font           = MCommonData.d2Font;
            btnls.Text           = "我的资金";
            btnls.ForeColor      = COLOR.RGB(MCommonData.fontColor1);
            btnls.MouseForeColor = COLOR.RGB(MCommonData.fontColor2);
            btnls.MouseDown     += Btnls_Click;
            btns1.btns.Add(btnls);

            Logger.LogInfo("初始化第一行基础管理按钮!");
            MLineButton btnjc = new MLineButton();
            btnjc.Font           = MCommonData.d2Font;
            btnjc.Text           = "基础管理";
            btnjc.ForeColor      = COLOR.RGB(MCommonData.fontColor1);
            btnjc.MouseForeColor = COLOR.RGB(MCommonData.fontColor2);
            btnjc.MouseDown     += Btnjc_Click;
            btns1.btns.Add(btnjc);
            this.board.AddControl(btns1);

            btns2 = new MButtons();
            Logger.LogInfo("初始化第一行登录按钮!");
            MButton btnlogin = new MButton();
            btnlogin.MouseClickImage = Resources.icon_login_hover;
            btnlogin.BackgroundImage = Resources.icon_login;;
            btnlogin.MouseEnterImage = Resources.icon_login_hover;
            btnlogin.hasFrame        = false;
            btnlogin.MouseDown      += Btnlogin_MouseDown;;
            btns2.btns.Add(btnlogin);

            Logger.LogInfo("初始化第一行注册按钮!");
            MButton btnregistered = new MButton();
            btnregistered.MouseClickImage = Resources.icon_registered_hover;
            btnregistered.BackgroundImage = Resources.icon_registered;;
            btnregistered.MouseEnterImage = Resources.icon_registered_hover;
            btnregistered.hasFrame        = false;
            btnregistered.MouseDown      += Btnregistered_MouseDown;;
            btns2.btns.Add(btnregistered);
            this.board.AddControl(btns2);

            Logger.LogInfo("初始化第一行登录后状态!");
            lblogin             = new MLabel();
            lblogin.Text        = "您好, ";
            lblogin.ForeColor   = COLOR.RGB(Color.White);
            lblogin.BackColor   = COLOR.RGB(MCommonData.fontColor5);
            lblogin.Font        = MCommonData.d4Font;
            lblogin.LeftAligned = true;
            lblogin.Visible     = false;
            this.board.AddControl(lblogin);

            Logger.LogInfo("初始化第一行注销按钮!");
            btnloginoff                     = new MButton();
            btnloginoff.Text                = "注销";
            btnloginoff.ForeColor           = COLOR.RGB(Color.White);
            btnloginoff.MouseForeColor      = COLOR.RGB(MCommonData.fontColor8);
            btnloginoff.BackColor           = COLOR.RGB(MCommonData.fontColor5);
            btnloginoff.MouseBackColor      = COLOR.RGB(MCommonData.fontColor5);
            btnloginoff.MouseClickBackColor = COLOR.RGB(MCommonData.fontColor5);
            btnloginoff.Font                = MCommonData.d4Font;
            btnloginoff.hasFrame            = false;
            btnloginoff.Visible             = false;
            btnloginoff.MouseDown          += BtnWriteOff_MouseDown;;;
            this.board.AddControl(btnloginoff);


            btns3 = new MButtons();
            Logger.LogInfo("初始化第一行最小化按钮!");
            MButton btnmin = new MButton();
            btnmin.BackgroundImage = Resources.icon_mini;
            btnmin.MouseEnterImage = Resources.icon_mini_hover;
            btnmin.MouseClickImage = Resources.icon_mini_hover;
            btnmin.ImageSIZE       = new SIZE(12, 2);
            btnmin.MouseDown      += Btnmin_Click;
            btns3.btns.Add(btnmin);

            Logger.LogInfo("初始化第一行最大化按钮!");
            MButton btnmax = new MButton();
            btnmax.BackgroundImage = Resources.icon_max;
            btnmax.MouseEnterImage = Resources.icon_max_hover;
            btnmax.MouseClickImage = Resources.icon_max_hover;
            btnmax.MouseDown      += Btnmax_Click;
            btns3.btns.Add(btnmax);

            Logger.LogInfo("初始化第一行关闭按钮!");
            MButton btnclose = new MButton();
            btnclose.BackgroundImage = Resources.icon_close;
            btnclose.MouseEnterImage = Resources.icon_close_hover;
            btnclose.MouseClickImage = Resources.icon_close_hover;
            btnclose.MouseDown      += Btnclose_Click;
            btns3.btns.Add(btnclose);
            this.board.AddControl(btns3);
            #endregion

            #endregion

            #region 第一列
            btns5 = new MButtons();
            Logger.LogInfo("初始化第一列行情!");
            MPolygonButton pbtn1 = new MPolygonButton();
            pbtn1.Text             = "行情";
            pbtn1.Font             = MCommonData.d2Font;
            pbtn1.ForeColor        = COLOR.RGB(MCommonData.fontColor1);
            pbtn1.MouseForeColor   = COLOR.RGB(MCommonData.fontColor2);
            pbtn1.PolygonForeColor = COLOR.RGB(MCommonData.fontColor5);
            pbtn1.hasChoose        = true;
            pbtn1.MouseDown       += Pbtn1_Click;
            btns5.btns.Add(pbtn1);

            Logger.LogInfo("初始化第一列供需发布!");
            MPolygonButton pbtn2 = new MPolygonButton();
            pbtn2.Text             = "供需发布";
            pbtn2.Font             = MCommonData.d2Font;
            pbtn2.ForeColor        = COLOR.RGB(MCommonData.fontColor1);
            pbtn2.MouseForeColor   = COLOR.RGB(MCommonData.fontColor2);
            pbtn2.PolygonForeColor = COLOR.RGB(MCommonData.fontColor5);
            pbtn2.MouseDown       += Pbtn2_Click;
            btns5.btns.Add(pbtn2);

            Logger.LogInfo("初始化第一列K线图!");
            MPolygonButton pbtn3 = new MPolygonButton();
            pbtn3.Text             = "K线图";
            pbtn3.Font             = MCommonData.d2Font;
            pbtn3.ForeColor        = COLOR.RGB(MCommonData.fontColor1);
            pbtn3.MouseForeColor   = COLOR.RGB(MCommonData.fontColor2);
            pbtn3.PolygonForeColor = COLOR.RGB(MCommonData.fontColor5);
            pbtn3.MouseDown       += Pbtn3_Click;
            btns5.btns.Add(pbtn3);

            Logger.LogInfo("初始化第一列资讯!");
            MPolygonButton pbtn4 = new MPolygonButton();
            pbtn4.Text             = "资讯";
            pbtn4.Font             = MCommonData.d2Font;
            pbtn4.ForeColor        = COLOR.RGB(MCommonData.fontColor1);
            pbtn4.MouseForeColor   = COLOR.RGB(MCommonData.fontColor2);
            pbtn4.PolygonForeColor = COLOR.RGB(MCommonData.fontColor5);
            pbtn4.MouseDown       += Pbtn4_Click;
            btns5.btns.Add(pbtn4);
            this.board.AddControl(btns5);
            #endregion

            #region 第二行

            #region 快捷按钮
            Logger.LogInfo("初始化第二行快捷按钮!");
            btns4      = new MButtons();
            btns4.Font = MCommonData.d2Font;
            this.board.AddControl(btns4);
            #endregion

            #region 买卖基价
            lbs1 = new MLabels();
            Logger.LogInfo("初始化买入基价!");
            MLabel lbbuy = new MLabel();
            lbbuy.Text        = "买入基价:";
            lbbuy.ForeColor   = COLOR.RGB(Color.Red);
            lbbuy.BackColor   = -1;
            lbbuy.Font        = MCommonData.d2Font;
            lbbuy.LeftAligned = true;
            lbs1.lbs.Add(lbbuy);

            Logger.LogInfo("初始化买入基价值!");
            MLabel lbbuyvalue = new MLabel();
            lbbuyvalue.Text        = "     ";
            lbbuyvalue.ForeColor   = COLOR.RGB(Color.White);
            lbbuyvalue.BackColor   = -1;
            lbbuyvalue.Font        = MCommonData.d3Font;
            lbbuyvalue.LeftAligned = true;
            lbs1.lbs.Add(lbbuyvalue);

            Logger.LogInfo("初始化卖出基价!");
            MLabel lbsell = new MLabel();
            lbsell.Text        = "卖出基价:";
            lbsell.ForeColor   = COLOR.RGB(Color.Green);
            lbsell.BackColor   = -1;
            lbsell.Font        = MCommonData.d2Font;
            lbsell.LeftAligned = true;
            lbs1.lbs.Add(lbsell);

            Logger.LogInfo("初始化卖出基价值!");
            MLabel lbsellvalue = new MLabel();
            lbsellvalue.Text        = "     ";
            lbsellvalue.ForeColor   = COLOR.RGB(Color.White);
            lbsellvalue.BackColor   = -1;
            lbsellvalue.Font        = MCommonData.d3Font;
            lbsellvalue.LeftAligned = true;
            lbs1.lbs.Add(lbsellvalue);
            this.board.AddControl(lbs1);

            #endregion

            #endregion

            #region 表格

            table = new MUseTable();
            this.board.AddControl(table);

            #endregion

            #region  择框

            Logger.LogInfo("初始化第二行快捷按钮!");
            select = new MSelect();
            select.BackgroundImage               = Resources.select_normal;
            select.MouseClickImage               = Resources.select_press;
            select.MouseEnterImage               = Resources.select_normal;
            select.Font                          = MCommonData.d4Font;
            select.ForeColor                     = COLOR.RGB(MCommonData.fontColor4);
            select.DropDownBoxForeColor          = COLOR.RGB(MCommonData.fontColor5);
            select.DropDownBoxBackColor          = COLOR.RGB(MCommonData.fontColor4);
            select.DropDownBoxRowMouseEnterColor = COLOR.RGB(MCommonData.fontColor13);
            select.Text                          = "请选择";
            select.TextChangeEvent              += Select_TextChangeEvent;
            this.board.AddControl(select);
            #endregion

            Initialized();

            this.SizeChanged += Form1_SizeChanged;

            Draw();
        }