Beispiel #1
0
 /// <summary>
 /// 数据对象
 /// </summary>
 /// <param name="info">数据</param>
 /// <param name="type">0为买 1为卖</param>
 public void InsertData(OneListed info, int type)
 {
     // if (info.blackWhiteType != "0")
     {
         MLabels data = new MLabels();
         data.BackColor      = COLOR.RGB(MCommonData.fontColor6);
         data.MouseBackColor = COLOR.RGB(MCommonData.fontColor10);
         UData ud = new UData();
         for (int i = 0; i < 10; i++)
         {
             MLabel ml = new MLabel();
             ml.ForeColor      = COLOR.RGB(MCommonData.fontColor4);
             ml.MouseForeColor = COLOR.RGB(MCommonData.fontColor4);
             ml.BackColor      = -1;
             ml.Font           = MCommonData.d4Font;
             ml.LeftAligned    = true;
             data.lbs.Add(ml);
         }
         data.lbs[6].MouseForeColor = COLOR.RGB(MCommonData.fontColor2);
         data.lbs[6].Underline      = true;
         data.lbs[9].ForeColor      = COLOR.RGB(MCommonData.fontColor8);
         if (type == 0)
         {
             buyData.Add(ud);
         }
         else
         {
             sellData.Add(ud);
         }
         SetData(info, data, ud, type);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 绘制
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(MPaintEventArgs e)
        {
            //if (!Redraw) { return; }
            Image currentImage = image;

            if (currentImage != null)
            {
                if (imageSIZE.cx > 0 && imageSIZE.cy > 0)
                {
                    e.CPaint.DrawImage(image, new RECT(this.Rectangle.left, this.Rectangle.bottom - ImageSIZE.cy, this.Rectangle.left + ImageSIZE.cx, this.Rectangle.bottom));
                }
                else
                {
                    e.CPaint.DrawImage(image, this.Rectangle);
                }
            }
            else if ((Rectangle.right - Rectangle.left) >= 2 && (Rectangle.bottom - Rectangle.top) >= 2)
            {
                if (hasChoose)
                {
                    e.CPaint.FillRect(MouseClickBackColor, Rectangle);
                }
                else if (isMouseEnter)
                {
                    e.CPaint.FillRect(MouseBackColor, Rectangle);
                }
                else
                {
                    e.CPaint.FillRect(BackColor, Rectangle);
                }

                if (hasFrame)
                {
                    //画渐变背景
                    e.CPaint.DrawGradientRect(TopColor, TopColor2, new RECT(Rectangle.left, Rectangle.top, Rectangle.right, Rectangle.bottom / 2), 90);
                    e.CPaint.DrawGradientRect(TopColor, TopColor2, new RECT(Rectangle.left, Rectangle.top + (Rectangle.bottom - Rectangle.top) / 2, Rectangle.right, Rectangle.bottom), 90);
                    //画边框
                    e.CPaint.DrawLine(COLOR.RGB(Color.White), 1, 0, Rectangle.left - 1, Rectangle.top - 1, Rectangle.right + 1, Rectangle.top - 1);
                    e.CPaint.DrawLine(COLOR.RGB(Color.White), 1, 0, Rectangle.left - 1, Rectangle.top - 1, Rectangle.left - 1, Rectangle.bottom + 1);
                    e.CPaint.DrawLine(COLOR.RGB(Color.White), 1, 0, Rectangle.right + 1, Rectangle.top - 1, Rectangle.right + 1, Rectangle.bottom + 1);
                    e.CPaint.DrawLine(COLOR.RGB(Color.White), 1, 0, Rectangle.left - 1, Rectangle.bottom + 1, Rectangle.right + 1, Rectangle.bottom + 1);

                    e.CPaint.DrawLine(COLOR.RGB(166, 166, 166), 1, 0, Rectangle.left + 1, Rectangle.top + 1, Rectangle.right - 1, Rectangle.top + 1);
                    e.CPaint.DrawLine(COLOR.RGB(166, 166, 166), 1, 0, Rectangle.left + 1, Rectangle.top + 1, Rectangle.left + 1, Rectangle.bottom - 1);
                    e.CPaint.DrawLine(COLOR.RGB(166, 166, 166), 1, 0, Rectangle.right - 1, Rectangle.top + 1, Rectangle.right - 1, Rectangle.bottom - 1);
                    e.CPaint.DrawLine(COLOR.RGB(166, 166, 166), 1, 0, Rectangle.left + 1, Rectangle.bottom - 1, Rectangle.right - 1, Rectangle.bottom - 1);
                }
                //文字
                if (this.Text != null && this.Text.Length > 0)
                {
                    e.CPaint.DrawText(this.Text, this.Font, drawForeColor,
                                      new RECT(Rectangle.left + (Rectangle.right - Rectangle.left) / 2 - e.CPaint.TextSize(this.Text, this.Font).cx / 2 + 1
                                               , Rectangle.top + (Rectangle.bottom - Rectangle.top - e.CPaint.TextSize(this.Text, this.Font).cy) / 2 - 1
                                               , Rectangle.right
                                               , Rectangle.bottom));
                }
            }
            //this.Redraw = false;
        }
Beispiel #3
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);
        }
Beispiel #4
0
 /// <summary>
 /// 全部刷新
 /// </summary>
 public void Draw()
 {
     try
     {
         RECT rect = new RECT(0, 0, this.Width, this.Height);
         cp.FillRect(COLOR.RGB(this.BackColor), rect);
         if (this.BackgroundImage != null)
         {
             cp.DrawImage(this.BackgroundImage, rect);
         }
         foreach (MControlBase cb in objectsNeedToBeDraw)
         {
             if (cb.Visible)
             {
                 cb.DoPaint(args);
             }
         }
         cp.EndPaint();
     }
     catch
     {
     }
 }
Beispiel #5
0
 /// <summary>
 /// 全部刷新
 /// </summary>
 public void Draw()
 {
     try
     {
         RECT rect = new RECT(0, 0, this.Width, this.Height);
         cp.FillRect(COLOR.RGB(this.BackColor), rect);
         if (this.BackgroundImage != null)
         {
             cp.DrawImage(this.BackgroundImage, rect);
         }
         foreach (MControlBase cb in objectsNeedToBeDraw)
         {
             if (cb.Visible)
             {
                 cb.DoPaint(args);
             }
         }
         cp.EndPaint();
     }
     catch (Exception ex)
     {
         MessageBox.Show("MBoardDraw() CatchEx:{1}", ex.Message);
     }
 }
Beispiel #6
0
        protected int offset2 = 0;                            //下偏移量
        public MUseTable()
        {
            #region 表格

            image3 = new MImage();
            image3.BackgroundImage = Resources.tips;
            image3.Visible         = false;

            #region 标题栏
            //列头:标记,序号,采购/销售,等级,升贴水,绝对价格,数量,仓库,公司,备注,发布时间
            tableHeader                = new MLabels();
            tableHeader.BackColor      = COLOR.RGB(MCommonData.fontColor5);
            tableHeader.MouseBackColor = COLOR.RGB(MCommonData.fontColor5);
            for (int i = 0; i < 11; i++)
            {
                MLabel ml = new MLabel();
                ml.Font        = MCommonData.d2Font;
                ml.ForeColor   = COLOR.RGB(MCommonData.fontColor4);
                ml.BackColor   = -1;
                ml.LeftAligned = true;
                tableHeader.lbs.Add(ml);
            }

            tableHeader.lbs[0].Text  = "标记";
            tableHeader.lbs[1].Text  = "采购/销售";
            tableHeader.lbs[2].Text  = "等级";
            tableHeader.lbs[3].Text  = "参考合约";
            tableHeader.lbs[4].Text  = "升贴水\r\n(元/吨)";
            tableHeader.lbs[5].Text  = "绝对价格\r\n(元/吨)";
            tableHeader.lbs[6].Text  = "数量\r\n(吨)";
            tableHeader.lbs[7].Text  = "仓库";
            tableHeader.lbs[8].Text  = "公司";
            tableHeader.lbs[9].Text  = "备注";
            tableHeader.lbs[10].Text = "发布时间";

            #region 表格数据

            //横线
            line1           = new MLine();
            line1.Width     = 1;
            line1.LineColor = COLOR.RGB(MCommonData.fontColor2);

            #endregion

            //标记图片
            image2 = new MImage();
            image2.BackgroundImage = Resources.mark;

            #endregion

            //上表背景
            mrt1           = new MRectangle();
            mrt1.BackColor = COLOR.RGB(MCommonData.fontColor6);

            //下表背景
            mrt2           = new MRectangle();
            mrt2.BackColor = COLOR.RGB(MCommonData.fontColor6);

            #region 滚动条
            scrollbar1                     = new MVScrollBar();
            scrollbar1.BackColor           = COLOR.RGB(MCommonData.fontColor6);
            scrollbar1.MouseBackColor      = COLOR.RGB(MCommonData.fontColor6);
            scrollbar1.MouseClickBackColor = COLOR.RGB(MCommonData.fontColor6);
            scrollbar1.ForeColor           = COLOR.RGB(MCommonData.fontColor14);
            scrollbar1.MouseForeColor      = COLOR.RGB(MCommonData.fontColor15);
            scrollbar1.ValueChanged       += Scrollbar1_ValueChanged;
            scrollbar1.MinInitialized     += Scrollbar1_MinInitialized;

            scrollbar2                     = new MVScrollBar();
            scrollbar2.BackColor           = COLOR.RGB(MCommonData.fontColor6);
            scrollbar2.MouseBackColor      = COLOR.RGB(MCommonData.fontColor6);
            scrollbar2.MouseClickBackColor = COLOR.RGB(MCommonData.fontColor6);
            scrollbar2.ForeColor           = COLOR.RGB(MCommonData.fontColor14);
            scrollbar2.MouseForeColor      = COLOR.RGB(MCommonData.fontColor15);
            scrollbar2.ValueChanged       += Scrollbar2_ValueChanged;
            scrollbar2.MinInitialized     += Scrollbar2_MinInitialized;
            #endregion

            #endregion
        }
Beispiel #7
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();
        }