private void butLoadImg_Click(object sender, EventArgs e)
 {
     try
     {
         txtImgName.Text = BigImgResource.ShowImgResourcesSelector(this);
     }
     catch (Exception ex)
     {
         MsgBox.ShowException(ex, this);
     }
 }
Beispiel #2
0
        private void LoadDesign()
        {
            labCallContext.BackColor = Color.Transparent;
            labHead.BackColor        = Color.Transparent;

            this.BackColor = _queueCallDesign.TxtBColor;

            if (string.IsNullOrEmpty(_queueCallDesign.BackgroundImage) == false)
            {
                this.BackgroundImageLayout = ImageLayout.Stretch;
                this.BackgroundImage       = BigImgResource.LoadImg(_queueCallDesign.BackgroundImage);
            }

            if (_queueCallDesign.ShowHeader)
            {
                switch (_queueCallDesign.HeadDockWay)
                {
                case HeadDockWay.hdwTop:
                    labHead.Dock = DockStyle.Top;
                    break;

                case HeadDockWay.hdwLeft:
                    labHead.Dock = DockStyle.Left;
                    break;

                case HeadDockWay.hdwRight:
                    labHead.Dock = DockStyle.Right;
                    break;

                default:
                    labHead.Dock = DockStyle.Bottom;
                    break;
                }

                labHead.ForeColor = _queueCallDesign.HeadFColor;
                labHead.BackColor = _queueCallDesign.HeadBColor;

                float     fontSize = 0;
                FontStyle fs       = FontStyle.Regular;

                try
                {
                    fontSize = _queueCallDesign.HeadFontSize;
                }
                catch { }
                if (fontSize <= 0)
                {
                    fontSize = this.Font.Size;
                }


                if (_queueCallDesign.HeadFontBold)
                {
                    fs = fs | FontStyle.Bold;
                }
                if (_queueCallDesign.HeadFontItalic)
                {
                    fs = fs | FontStyle.Italic;
                }

                Font headFont = new Font(_queueCallDesign.HeadFontName, fontSize, fs);

                labHead.Font = headFont;

                if (string.IsNullOrEmpty(_queueCallDesign.HeadText))
                {
                    labHead.ImageAlign = ContentAlignment.MiddleCenter;
                    labHead.Text       = "";
                }
                else
                {
                    labHead.ImageAlign = ContentAlignment.TopCenter;

                    char[] txtChars = _queueCallDesign.HeadText.ToCharArray();

                    string headText = "";
                    foreach (char chr in txtChars)
                    {
                        if (headText != "")
                        {
                            headText = headText + '\r';
                        }

                        headText = headText + chr;
                    }
                    labHead.Text = headText;
                }

                labHead.Visible = true;



                labCallContext.ForeColor = _queueCallDesign.TxtFColor;
                labCallContext.Text      = "";


                float     txtfontSize = 0;
                FontStyle txtfs       = FontStyle.Regular;

                try
                {
                    txtfontSize = _queueCallDesign.TxtFontSize;
                }
                catch { }
                if (txtfontSize <= 0)
                {
                    txtfontSize = this.Font.Size;
                }


                if (_queueCallDesign.TxtFontBold)
                {
                    txtfs = txtfs | FontStyle.Bold;
                }
                if (_queueCallDesign.TxtFontItalic)
                {
                    txtfs = txtfs | FontStyle.Italic;
                }

                Font txtFont = new Font(_queueCallDesign.TxtFontName, txtfontSize, txtfs);

                labCallContext.Font = txtFont;


                _queueItems.Clear();
                if (_queueCallDesign.QueueItems.Count > 0)
                {
                    _queueItems = new List <QueueItem>(_queueCallDesign.QueueItems);
                }
                else
                {
                    //查询科室包含的队列
                    DataTable dtQueueData = QueueModel.GetQueueInfoByDeptId(_stationInfo.DepartmentId);

                    if (_queueCallDesign.UserRoomReleationQueue && string.IsNullOrEmpty(_stationInfo.RoomId) == false)
                    {
                        foreach (DataRow drQueue in dtQueueData.Rows)
                        {
                            QueueData queData = new QueueData();
                            queData.BindRowData(drQueue);

                            if (queData.包含房间.房间明细.FindIndex(T => T.房间ID == _stationInfo.RoomId) >= 0)
                            {
                                QueueItem qi = new QueueItem();

                                qi.QueueName = drQueue["队列名称"].ToString();
                                qi.QueueId   = drQueue["队列ID"].ToString();

                                _queueItems.Add(qi);
                            }
                        }
                    }
                    else
                    {
                        foreach (DataRow drQueue in dtQueueData.Rows)
                        {
                            QueueItem qi = new QueueItem();

                            qi.QueueName = drQueue["队列名称"].ToString();
                            qi.QueueId   = drQueue["队列ID"].ToString();

                            _queueItems.Add(qi);
                        }
                    }
                }
            }
            else
            {
                labHead.Visible = false;
            }
        }
Beispiel #3
0
        private void LoadDesign()
        {
            labContext.BackColor = Color.Transparent;

            this.BackColor = _labDesign.BackColor;

            labContext.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
            labContext.ForeColor = _labDesign.ForeColor;
            labContext.Text      = _labDesign.LabText;


            if (string.IsNullOrEmpty(_labDesign.BackgroundImage) == false)
            {
                this.BackgroundImageLayout = _labDesign.BackgroundImageLayout;
                this.BackgroundImage       = BigImgResource.LoadImg(_labDesign.BackgroundImage);
            }
            else
            {
                this.BackgroundImage = null;
            }

            if (string.IsNullOrEmpty(_labDesign.TextIcon) == false)
            {
                labContext.Appearance.Image = Img24Resource.LoadImg(_labDesign.TextIcon);
            }
            else
            {
                labContext.Appearance.Image = null;
            }


            float fontSize = 0;

            try
            {
                fontSize = _labDesign.FontSize;
            }
            catch { }
            if (fontSize <= 0)
            {
                fontSize = this.Font.Size;
            }

            FontStyle fs = FontStyle.Regular;

            if (_labDesign.IsBold)
            {
                fs = fs | FontStyle.Bold;
            }
            if (_labDesign.IsItalic)
            {
                fs = fs | FontStyle.Italic;
            }



            Font ft = new Font(_labDesign.FontName, fontSize, fs);

            labContext.Font = ft;


            switch (_labDesign.TextPostion)
            {
            case PostionType.ipTop:
                labContext.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                labContext.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Top;
                break;

            case PostionType.ipLeft:
                labContext.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
                labContext.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                break;

            case PostionType.ipRight:
                labContext.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
                labContext.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                break;

            case PostionType.ipBottom:
                labContext.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                labContext.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Bottom;
                break;

            case PostionType.ipCenter:
                labContext.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                labContext.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                break;


            default:
                break;
            }


            switch (_labDesign.IconPostion)
            {
            case PostionType.ipTop:
                labContext.ImageAlignToText = DevExpress.XtraEditors.ImageAlignToText.TopCenter;
                break;

            case PostionType.ipLeft:
                labContext.ImageAlignToText = DevExpress.XtraEditors.ImageAlignToText.LeftCenter;
                break;

            case PostionType.ipRight:
                labContext.ImageAlignToText = DevExpress.XtraEditors.ImageAlignToText.RightCenter;
                break;

            case PostionType.ipBottom:
                labContext.ImageAlignToText = DevExpress.XtraEditors.ImageAlignToText.BottomCenter;
                break;

            case PostionType.ipCenter:
                labContext.ImageAlignToText = DevExpress.XtraEditors.ImageAlignToText.LeftCenter;
                break;


            default:
                break;
            }
        }
        //private Dictionary<string, Label> _missList = null;
        private void InitQueueLayout(List <QueueItem> queueItems)
        {
            tableLayoutPanel1.Controls.Clear();

            tableLayoutPanel1.RowCount    = 1;
            tableLayoutPanel1.ColumnCount = (_queueShowDesign.IsShowLastCall) ? 3 : 2;

            tableLayoutPanel1.ColumnStyles.Clear();
            tableLayoutPanel1.RowStyles.Clear();

            if (string.IsNullOrEmpty(_queueShowDesign.BackgroundImage) == false)
            {
                tableLayoutPanel1.BackgroundImageLayout = ImageLayout.Stretch;

                //根据队列数量载入对应的背景图像
                FileInfo fi = new FileInfo(Dir.GetAppResourceDir() + @"\" + _queueShowDesign.BackgroundImage);

                string styleName = fi.Name.Replace(fi.Extension, "") + queueItems.Count + fi.Extension;
                string styleFile = fi.DirectoryName + @"\" + styleName;

                if (File.Exists(styleFile))
                {
                    tableLayoutPanel1.BackgroundImage = BigImgResource.LoadImg(styleName);
                }
                else
                {
                    tableLayoutPanel1.BackgroundImage = BigImgResource.LoadImg(_queueShowDesign.BackgroundImage);
                }
            }

            if (_callList == null)
            {
                _callList = new Dictionary <string, Label>();
            }
            if (_waitList == null)
            {
                _waitList = new Dictionary <string, LabelControl>();
            }
            //if (_missList == null) _missList = new Dictionary<string, Label>();

            _callList.Clear();
            _waitList.Clear();
            //_missList.Clear();

            if (queueItems == null || queueItems.Count <= 0)
            {
                return;
            }

            tableLayoutPanel1.RowCount = queueItems.Count;

            if (tableLayoutPanel1.ColumnCount >= 1 && _queueShowDesign.Column1Width > 0)
            {
                tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, _queueShowDesign.Column1Width));
            }

            if (tableLayoutPanel1.ColumnCount >= 2 && _queueShowDesign.Column2Width > 0)
            {
                tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, _queueShowDesign.Column2Width));
            }

            if (tableLayoutPanel1.ColumnCount >= 3 && _queueShowDesign.Column3Width > 0)
            {
                tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, _queueShowDesign.Column3Width));
            }


            float fontSize = 0;

            try
            {
                fontSize = _queueShowDesign.HeadFontSize;
            }
            catch { }
            if (fontSize <= 0)
            {
                fontSize = this.Font.Size;
            }

            FontStyle fs = FontStyle.Regular;

            if (_queueShowDesign.HeadBold)
            {
                fs = fs | FontStyle.Bold;
            }
            if (_queueShowDesign.HeadItalic)
            {
                fs = fs | FontStyle.Italic;
            }

            Font headFont = new Font(_queueShowDesign.HeadFontName, fontSize, fs);

            int colIndex = 0;

            for (int i = 0; i < queueItems.Count; i++)
            {
                tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, this.Height / queueItems.Count));

                string queueName = queueItems[i].QueueName;


                colIndex = 0;
                //添加行头文本
                Label lab = new Label();

                lab.BackColor = Color.Transparent;
                lab.TextAlign = ContentAlignment.MiddleLeft;
                lab.Text      = "(" + (i + 1) + ")" + queueName;
                lab.Tag       = queueName;
                lab.AutoSize  = false;
                lab.Dock      = DockStyle.Fill;

                lab.ForeColor = _queueShowDesign.ForeColor;
                lab.Font      = headFont;


                tableLayoutPanel1.Controls.Add(lab, colIndex, i);

                ////添加呼叫状态文本
                if (_queueShowDesign.IsShowLastCall)
                {
                    colIndex = colIndex + 1;
                    Label labCall = new Label();

                    labCall.BackColor = Color.Transparent;
                    labCall.TextAlign = ContentAlignment.MiddleLeft;
                    labCall.Tag       = queueName;
                    labCall.AutoSize  = false;
                    labCall.Dock      = DockStyle.Fill;

                    if (_queueShowDesign.IsShowCallIcon)
                    {
                        labCall.Image      = Properties.Resources.calling;
                        labCall.ImageAlign = ContentAlignment.MiddleLeft;
                    }

                    labCall.ForeColor = _queueShowDesign.ForeColor;
                    labCall.Font      = this.Font;

                    tableLayoutPanel1.Controls.Add(labCall, colIndex, i);

                    _callList.Add(queueName, labCall);
                }

                colIndex = colIndex + 1;
                //添加排队状态文本
                LabelControl labWait = new LabelControl();

                labWait.BackColor    = Color.Transparent;
                labWait.AutoSizeMode = LabelAutoSizeMode.None;
                labWait.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
                labWait.Tag      = queueName;
                labWait.AutoSize = false;
                labWait.Dock     = DockStyle.Fill;

                if (_queueShowDesign.IsShowQueueIcon)
                {
                    labWait.Appearance.Image = Properties.Resources.wait;
                    labWait.ImageAlignToText = ImageAlignToText.LeftCenter;
                }

                labWait.ForeColor = _queueShowDesign.ForeColor;
                labWait.Font      = this.Font;

                tableLayoutPanel1.Controls.Add(labWait, colIndex, i);

                _waitList.Add(queueName, labWait);

                //if (_queueShowDesign.IsShowMiss)
                //{
                //    //添加过号状态文本
                //    Label labMiss = new Label();

                //    labMiss.BackColor = Color.Transparent;
                //    labMiss.TextAlign = ContentAlignment.MiddleLeft;
                //    labMiss.Tag = queueName;
                //    labMiss.AutoSize = false;
                //    labMiss.Dock = DockStyle.Fill;

                //    labMiss.ForeColor = _queueShowDesign.ForeColor;
                //    labMiss.Font = this.Font;

                //    tableLayoutPanel1.Controls.Add(labMiss, 2, i);

                //    _missList.Add(queueName, labMiss);
                //}
            }
        }