コード例 #1
0
        /// <summary>
        /// 设置股票账户资金
        /// </summary>
        /// <param name="tradeResult"></param>
        private void SetSecurityTradingAccount(String stockCaptialResult)
        {
            m_securityTradingAccount = null;
            if (stockCaptialResult == null || stockCaptialResult.Length == 0)
            {
                return;
            }
            SecurityTradingAccount stockTradingAccount = SecurityTradingAccount.ConvertToStockTradingAccount(stockCaptialResult);

            if (stockTradingAccount == null)
            {
                return;
            }
            m_securityTradingAccount = stockTradingAccount;
            LabelA lblCapitalBalance = m_mainFrame.GetLabel("lblCapitalBalance");

            if (lblCapitalBalance != null)
            {
                lblCapitalBalance.Text = stockTradingAccount.m_capitalBalance.ToString();
            }
            LabelA lblFrozenCash = m_mainFrame.GetLabel("lblFrozenCash");

            if (lblFrozenCash != null)
            {
                lblFrozenCash.Text = stockTradingAccount.m_frozenCash.ToString();
            }
            LabelA lblAvailable = m_mainFrame.GetLabel("lblAvailable");

            if (lblAvailable != null)
            {
                lblAvailable.Text = stockTradingAccount.m_available.ToString();
            }
            LabelA lblWithdrawQuota = m_mainFrame.GetLabel("lblWithdrawQuota");

            if (lblWithdrawQuota != null)
            {
                lblWithdrawQuota.Text = stockTradingAccount.m_withdrawQuota.ToString();
            }
            LabelA lblStockValue = m_mainFrame.GetLabel("lblStockValue");

            if (lblStockValue != null)
            {
                lblStockValue.Text = stockTradingAccount.m_stockValue.ToString();
            }
            LabelA lblTotalCapital = m_mainFrame.GetLabel("lblTotalCapital");

            if (lblTotalCapital != null)
            {
                lblTotalCapital.Text = stockTradingAccount.m_totalCapital.ToString();
            }

            DivA divCapital = m_mainFrame.GetDiv("divCapital");

            divCapital.Invalidate();
        }
コード例 #2
0
ファイル: MainFrame.cs プロジェクト: owchart/iteam
        public static extern bool SetForegroundWindow(IntPtr hWnd);//设置此窗体为活动窗体

        /// <summary>
        /// 加载XML
        /// </summary>
        /// <param name="xmlPath">XML路径</param>
        public override void Load(String xmlPath)
        {
            LoadFile(xmlPath, null);
            DataCenter.MainUI   = this;
            m_mainDiv           = Native.GetControls()[0] as DivA;
            m_mainDiv.BackColor = COLOR.CONTROL;
            ControlPaintEvent paintLayoutEvent = new ControlPaintEvent(PaintLayoutDiv);

            m_mainDiv.RegisterEvent(paintLayoutEvent, EVENTID.PAINT);
            m_mainDiv.RegisterEvent(new ControlInvokeEvent(Invoke), EVENTID.INVOKE);
            DataCenter.ServerChatService.RegisterListener(DataCenter.ChatRequestID, new ListenerMessageCallBack(ChatMessageCallBack));
            m_gridHosts = GetGrid("gridHosts");
            m_gridHosts.GridLineColor = COLOR.CONTROLBORDER;
            GridRowStyle rowStyle = new GridRowStyle();

            rowStyle.HoveredBackColor  = CDraw.PCOLORS_HOVEREDROWCOLOR;
            rowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR;
            rowStyle.SelectedForeColor = CDraw.PCOLORS_FORECOLOR4;
            rowStyle.Font        = new FONT("微软雅黑", 12, false, false, false);
            m_gridHosts.RowStyle = rowStyle;
            GridRowStyle alternateRowStyle = new GridRowStyle();

            alternateRowStyle.BackColor         = CDraw.PCOLORS_ALTERNATEROWCOLOR;
            alternateRowStyle.HoveredBackColor  = CDraw.PCOLORS_HOVEREDROWCOLOR;
            alternateRowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR;
            alternateRowStyle.SelectedForeColor = CDraw.PCOLORS_FORECOLOR4;
            alternateRowStyle.Font        = new FONT("微软雅黑", 12, false, false, false);
            m_gridHosts.AlternateRowStyle = alternateRowStyle;
            m_gridGroups                   = GetGrid("gridGroups");
            m_gridGroups.RowStyle          = rowStyle;
            m_gridGroups.AlternateRowStyle = alternateRowStyle;
            m_gridGroups.RegisterEvent(new GridCellMouseEvent(GridCellClick), EVENTID.GRIDCELLCLICK);
            RegisterEvents(m_mainDiv);
            //全节点服务器
            if (DataCenter.IsFull)
            {
                DataCenter.UserID   = DataCenter.HostInfo.m_localHost + ":" + CStr.ConvertIntToStr(DataCenter.HostInfo.m_localPort);
                DataCenter.UserName = DataCenter.UserID;
                Thread thread = new Thread(new ThreadStart(StartConnect));
                thread.Start();
            }
            else
            {
                UserCookie cookie = new UserCookie();
                if (DataCenter.UserCookieService.GetCookie("USERINFO2", ref cookie) > 0)
                {
                    String[] strs = cookie.m_value.Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    GetTextBox("txtPhone").Text    = strs[0];
                    GetTextBox("txtUserName").Text = strs[1];
                    GetTextBox("txtPort").Text     = strs[2];
                }
            }
            m_chatGroups = ChatGroup.ReadGroups();
            BindGroups();
        }
コード例 #3
0
        /// <summary>
        /// 重绘层
        /// </summary>
        /// <param name="sender">调用者</param>
        /// <param name="paint">绘图对象</param>
        /// <param name="clicpRect">裁剪区域</param>
        private void PaintDiv(Object sender, CPaint paint, RECT clicpRect)
        {
            DivA div = sender as DivA;
            int  width = div.Width, height = div.Height;
            RECT drawRect = new RECT(0, 0, width, height);

            if (m_mode == 5)
            {
                paint.FillGradientRect(COLOR.ARGB(200, 255, 40, 24), COLOR.ARGB(200, 255, 255, 40), drawRect, 0, m_tick % 360);
            }
            else
            {
                paint.FillGradientRect(COLOR.ARGB(200, 90, 120, 24), COLOR.ARGB(200, 122, 156, 40), drawRect, 0, 0);
            }
            RECT bounds        = m_lblTime.Bounds;
            RECT fullBloodRect = new RECT(bounds.left, bounds.bottom, bounds.left + 400, bounds.bottom + 15);

            paint.FillRect(COLOR.ARGB(255, 0, 0), fullBloodRect);
            int  bloodWidth = (int)(m_currentTick / m_totalTick * 400);
            RECT bloodRect  = new RECT(bounds.left, bounds.bottom, bounds.left + bloodWidth, bounds.bottom + 15);

            if (bloodWidth < 40)
            {
                paint.FillRect(COLOR.ARGB(255, 150, 0), bloodRect);
            }
            else if (bloodWidth < 120)
            {
                paint.FillRect(COLOR.ARGB(255, 200, 0), bloodRect);
            }
            else
            {
                paint.FillRect(COLOR.ARGB(255, 255, 0), bloodRect);
            }
            if (m_currentQuestion != null && m_currentQuestion.m_type == "极限")
            {
                String[] strs   = m_txtAnswer.Text.Split(new String[] { "\r" }, StringSplitOptions.RemoveEmptyEntries);
                int      cCount = 0;
                foreach (String str in strs)
                {
                    if (str == "for(int i = 0; i < 100; i++)")
                    {
                        cCount++;
                    }
                }
                String strLine = cCount.ToString();
                FONT   tFont   = new FONT("微软雅黑", 100, true, false, true);
                SIZE   tSize   = paint.TextSize(strLine, tFont);
                RECT   tRect   = new RECT();
                tRect.left   = (width - tSize.cx) / 2;
                tRect.top    = (height - tSize.cy) / 2;
                tRect.right  = tRect.left + tSize.cx;
                tRect.bottom = tRect.top + tSize.cy;
                paint.DrawText(strLine, COLOR.ARGB(200, 255, 255, 255), tFont, tRect);
            }
        }
コード例 #4
0
        /// <summary>
        /// 创建内部控件
        /// </summary>
        /// <param name="parent">父控件</param>
        /// <param name="clsid">控件标识</param>
        /// <returns>内部控件</returns>
        public override ControlA CreateInternalControl(ControlA parent, String clsid)
        {
            //日历控件
            CalendarA calendar = parent as CalendarA;

            if (calendar != null)
            {
                if (clsid == "datetitle")
                {
                    return(new DateTitle(calendar));
                }
                else if (clsid == "headdiv")
                {
                    HeadDiv headDiv = new HeadDiv(calendar);
                    headDiv.Width = parent.Width;
                    headDiv.Dock  = DockStyleA.Top;
                    return(headDiv);
                }
                else if (clsid == "lastbutton")
                {
                    return(new ArrowButton(calendar));
                }
                else if (clsid == "nextbutton")
                {
                    ArrowButton nextBtn = new ArrowButton(calendar);
                    nextBtn.ToLast = false;
                    return(nextBtn);
                }
            }
            //分割层
            SplitLayoutDivA splitLayoutDiv = parent as SplitLayoutDivA;

            if (splitLayoutDiv != null)
            {
                if (clsid == "splitter")
                {
                    ButtonA splitter = new ButtonA();
                    splitter.BackColor = CDraw.PCOLORS_BACKCOLOR;
                    splitter.Size      = new SIZE(5, 5);
                    return(splitter);
                }
            }
            //滚动条
            ScrollBarA scrollBar = parent as ScrollBarA;

            if (scrollBar != null)
            {
                scrollBar.BackColor = COLOR.EMPTY;
                if (clsid == "addbutton")
                {
                    RibbonButton addButton = new RibbonButton();
                    addButton.Size = new SIZE(15, 15);
                    if (scrollBar is HScrollBarA)
                    {
                        addButton.ArrowType = 2;
                    }
                    else if (scrollBar is VScrollBarA)
                    {
                        addButton.ArrowType = 4;
                    }
                    return(addButton);
                }
                else if (clsid == "backbutton")
                {
                    ButtonA backButton = new ButtonA();
                    return(backButton);
                }
                else if (clsid == "scrollbutton")
                {
                    ButtonA scrollButton = new ButtonA();
                    scrollButton.AllowDrag   = true;
                    scrollButton.BackColor   = CDraw.PCOLORS_BACKCOLOR;
                    scrollButton.BorderColor = CDraw.PCOLORS_LINECOLOR3;
                    return(scrollButton);
                }
                else if (clsid == "reducebutton")
                {
                    RibbonButton reduceButton = new RibbonButton();
                    reduceButton.Size = new SIZE(15, 15);
                    if (scrollBar is HScrollBarA)
                    {
                        reduceButton.ArrowType = 1;
                    }
                    else if (scrollBar is VScrollBarA)
                    {
                        reduceButton.ArrowType = 3;
                    }
                    return(reduceButton);
                }
            }
            //页夹
            TabPageA tabPage = parent as TabPageA;

            if (tabPage != null)
            {
                if (clsid == "headerbutton")
                {
                    RibbonButton button = new RibbonButton();
                    button.AllowDrag = true;
                    SIZE size = new SIZE(100, 20);
                    button.Size = size;
                    return(button);
                }
            }
            //下拉列表
            ComboBoxA comboBox = parent as ComboBoxA;

            if (comboBox != null)
            {
                if (clsid == "dropdownbutton")
                {
                    RibbonButton dropDownButton = new RibbonButton();
                    dropDownButton.ArrowType     = 4;
                    dropDownButton.DisplayOffset = false;
                    int   width    = comboBox.Width;
                    int   height   = comboBox.Height;
                    POINT location = new POINT(width - 20, 0);
                    dropDownButton.Location = location;
                    SIZE size = new SIZE(20, height);
                    dropDownButton.Size = size;
                    return(dropDownButton);
                }
                else if (clsid == "dropdownmenu")
                {
                    ComboBoxMenu comboBoxMenu = new ComboBoxMenu();
                    comboBoxMenu.ComboBox = comboBox;
                    comboBoxMenu.Popup    = true;
                    SIZE size = new SIZE(100, 200);
                    comboBoxMenu.Size = size;
                    return(comboBoxMenu);
                }
            }
            //日期选择
            DatePickerA datePicker = parent as DatePickerA;

            if (datePicker != null)
            {
                if (clsid == "dropdownbutton")
                {
                    RibbonButton dropDownButton = new RibbonButton();
                    dropDownButton.ArrowType     = 4;
                    dropDownButton.DisplayOffset = false;
                    int   width    = datePicker.Width;
                    int   height   = datePicker.Height;
                    POINT location = new POINT(width - 16, 0);
                    dropDownButton.Location = location;
                    SIZE size = new SIZE(16, height);
                    dropDownButton.Size = size;
                    return(dropDownButton);
                }
                else if (clsid == "dropdownmenu")
                {
                    MenuA dropDownMenu = new MenuA();
                    dropDownMenu.Padding = new PADDING(1);
                    dropDownMenu.Popup   = true;
                    SIZE size = new SIZE(200, 200);
                    dropDownMenu.Size = size;
                    return(dropDownMenu);
                }
            }
            //数字选择
            SpinA spin = parent as SpinA;

            if (spin != null)
            {
                if (clsid == "downbutton")
                {
                    RibbonButton downButton = new RibbonButton();
                    downButton.ArrowType     = 4;
                    downButton.DisplayOffset = false;
                    SIZE size = new SIZE(16, 16);
                    downButton.Size = size;
                    return(downButton);
                }
                else if (clsid == "upbutton")
                {
                    RibbonButton upButton = new RibbonButton();
                    upButton.ArrowType     = 3;
                    upButton.DisplayOffset = false;
                    SIZE size = new SIZE(16, 16);
                    upButton.Size = size;
                    return(upButton);
                }
            }
            //容器层
            DivA div = parent as DivA;

            if (div != null)
            {
                if (clsid == "hscrollbar")
                {
                    HScrollBarA hScrollBar = new HScrollBarA();
                    hScrollBar.Visible = false;
                    hScrollBar.Size    = new SIZE(15, 15);
                    return(hScrollBar);
                }
                else if (clsid == "vscrollbar")
                {
                    VScrollBarA vScrollBar = new VScrollBarA();
                    vScrollBar.Visible = false;
                    vScrollBar.Size    = new SIZE(15, 15);
                    return(vScrollBar);
                }
            }
            //表格
            GridA grid = parent as GridA;

            if (grid != null)
            {
                if (clsid == "edittextbox")
                {
                    TextBoxA textBox = new TextBoxA();
                    textBox.BackColor = CDraw.PCOLORS_BACKCOLOR;
                    return(textBox);
                }
            }
            return(null);
        }