Beispiel #1
0
 /// <summary>
 /// 设计器支持所需的方法 - 不要使用代码编辑器修改
 /// 此方法的内容。
 /// </summary>
 private void InitializeComponent()
 {
     this.richTextBoxEx1 = new Neusoft.FrameWork.WinForms.Controls.RichTextBox();
     this.SuspendLayout();
     //
     // richTextBoxEx1
     //
     this.richTextBoxEx1.Dock          = System.Windows.Forms.DockStyle.Fill;
     this.richTextBoxEx1.Font          = new System.Drawing.Font("楷体_GB2312", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
     this.richTextBoxEx1.HideSelection = false;
     this.richTextBoxEx1.Location      = new System.Drawing.Point(0, 0);
     this.richTextBoxEx1.Name          = "richTextBoxEx1";
     this.richTextBoxEx1.Size          = new System.Drawing.Size(408, 296);
     this.richTextBoxEx1.SuperText     = "";
     this.richTextBoxEx1.TabIndex      = 0;
     this.richTextBoxEx1.Text          = "";
     //this.richTextBoxEx1.名称 = "richTextBoxEx1";
     //this.richTextBoxEx1.是否组 = false;
     //this.richTextBoxEx1.组 = "无";
     this.richTextBoxEx1.TextChanged += new System.EventHandler(this.richTextBoxEx1_TextChanged);
     //
     // ucEMRInput
     //
     this.Controls.Add(this.richTextBoxEx1);
     this.Font  = new System.Drawing.Font("楷体_GB2312", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
     this.Name  = "ucEMRInput";
     this.Size  = new System.Drawing.Size(408, 296);
     this.Load += new System.EventHandler(this.frmTestEMRInput_Load);
     this.ResumeLayout(false);
 }
Beispiel #2
0
        /// <summary>
        /// 画控件
        /// </summary>
        /// <param name="c"></param>
        /// <param name="g"></param>
        /// <param name="allTop"></param>
        protected void DrawControl(Control c, RichTextBox g, int allTop)
        {
            //控件不显示不画
            if (c.Visible == false)
            {
                return;
            }

            #region
            string strType = c.GetType().ToString().Substring(c.GetType().ToString().LastIndexOf(".") + 1);

            int ControlLeft   = c.Left + offsetX;
            int ControlTop    = allTop + offsetY;
            int ControlWidth  = c.Width;
            int ControlHeight = c.Height;

            //ButtonState bState =ButtonState.All;
            int iFill             = 0;
            int ControlBackWidth  = 0;
            int ControlBackHeight = 0;


            ControlBackWidth  = c.Width - (iFill * 2);
            ControlBackHeight = c.Height - (iFill * 2);

            int ControlBackLeft = c.Left + iFill + offsetX;
            int ControlBackTop  = allTop + iFill + offsetY;


            if (iFill < 0)
            {
                //ControlBackWidth = c.Width;//-(iFill*2);
                ControlBackHeight = c.Height;
            }

            //如果控件高度小于零
            if (ControlBackHeight <= 0)
            {
                ControlBackHeight = c.Height;
            }
            //如果控件宽度
            if (ControlBackWidth <= 0)
            {
                ControlBackWidth = c.Width;
            }

            int ControlForeLeft = c.Left + iFill + 2 + offsetX;
            int ControlForeTop  = allTop + iFill + 3 + offsetY;

            #endregion
            try
            {
                //是表格不画子控件
                if (c.Parent != null && c.Parent.GetType().ToString() == "classControl.ucGrid")
                {
                    return;
                }
            }
            catch {}

            //非打印控件
            if (c.Tag != null && c.Tag.ToString() == "EMRGRIDLINE")
            {
                return;
            }

            if (strType == "GroupBox" || strType == "emrGroupBox")
            {
            }
            else if (strType == "PictureBox" || strType == "emrPictureBox" || strType == "emrImage")
            {
            }
            else if (strType == "Panel" || strType == "emrPanel")
            {
            }
            else if (strType == "TabPage" || strType == "TabControl")
            {
            }
            else if (strType == "emrLine")
            {
                string strLine = "-";
                this.DrawString(strLine.PadRight(ControlBackWidth), c.Font, c.BackColor, ControlForeLeft, ControlForeTop + ControlHeight);
            }
            else if (strType == "RichTextBox" || strType == "emrMultiLineTextBox")
            {
                Neusoft.FrameWork.WinForms.Controls.RichTextBox linkRTB = c as Neusoft.FrameWork.WinForms.Controls.RichTextBox;

                RichTextBox t = c as RichTextBox;

                string oldText = t.Text;
                //如果是linkRTB
                if (linkRTB != null)
                {
                    oldText = linkRTB.SuperText;
                    t.Text  = linkRTB.Text;
                }


                t.Text = t.Text.TrimEnd();
                t.Text = t.Text.TrimEnd('\n');

                RectangleF r;
                int        x = 0, y = 0;
                int        ioffsetY = t.GetPositionFromCharIndex(0).Y;
                y = t.GetPositionFromCharIndex(t.TextLength - 1).Y - ioffsetY;
                t.Select(0, 0);
                t.ScrollToCaret();
                Graphics mg = this.CreateGraphics();
                #region 多行文本框

                {
                    if (y + (int)mg.MeasureString("李", t.Font).Height + 2 > ControlHeight)
                    {
                        ControlHeight = y + (int)mg.MeasureString("李", t.Font).Height + 2;
                        //this.allOffsetY = ControlHeight - c.Height;
                    }
                    //忘记为什么从最后开始计算
                    for (int iTextLength = 0; iTextLength < t.TextLength; iTextLength++)      //for(int iTextLength =t.TextLength-1;iTextLength>=0;iTextLength--)
                    {
                        t.Select(0, 0);
                        Point point = t.GetPositionFromCharIndex(iTextLength);
                        x = point.X;
                        y = point.Y;
                        y = y - ioffsetY;
                        t.Select(iTextLength, 1);
                        r = new RectangleF(ControlForeLeft + x, ControlForeTop + y, mg.MeasureString(t.SelectedText, t.Font).Width, mg.MeasureString(t.SelectedText, t.Font).Height);
                        this.DrawString(t.SelectedText, t.SelectionFont, t.SelectionColor, (int)r.Left, (int)r.Bottom);
                    }
                }

                #endregion

                if (linkRTB != null)
                {
                    linkRTB.SuperText = oldText;
                }
            }
            else if (strType == "FpSpread")
            {
                #region farpoint
                //				FarPoint.Win.Spread.FpSpread t = c as FarPoint.Win.Spread.FpSpread;
                //
                //				Rectangle rect = new Rectangle(ControlLeft ,ControlTop ,ControlWidth,ControlHeight);//ControlWidth,ControlHeight );
                //				FarPoint.Win.Spread.PrintInfo printinfo = new FarPoint.Win.Spread.PrintInfo();
                //				for(int iSheet=0;iSheet<t.Sheets.Count;iSheet++)
                //				{
                //
                //					printinfo.ShowRowHeaders = t.Sheets[iSheet].RowHeader.Visible;
                //					printinfo.ShowColumnHeaders = t.Sheets[iSheet].ColumnHeader.Visible;
                //					t.Sheets[iSheet].PrintInfo = printinfo;
                //				}
                //				int iCount = t.GetOwnerPrintPageCount(g,rect,0);
                //				if(maxpage <iCount) maxpage =iCount; //为多个farpoint打印用的
                //				if(addpage ==0 && maxpage == iCount)
                //				{
                //					addpage = 1;
                //				}
                //				if(addpage<=iCount)
                //				{
                //					t.OwnerPrintDraw(g,rect,0,addpage);
                //					addpage++;
                //				}
                //				if(addpage>maxpage)
                //				{
                //					addpage = 0;
                //				}
                #endregion
            }
            else if (strType.IndexOf("SpreadView") >= 0 || strType == "HScrollBar" || strType == "VScrollBar" || strType.IndexOf("ScrollBar") >= 0)     //strType.IndexOf("SpreadView")>=0 || strType.IndexOf("ScrollBar")>=0)//去掉fpscroll
            {
            }
            else if (strType == "DataGrid")
            {
            }

            else if (strType == "Button")
            {
            }
            else if (strType == ("emrGrid") || strType == "ucGrid")
            {
            }
            else if (strType == "Form")
            {
            }
            else if (strType == "ucDiseaseRecord")
            {
            }
            else
            {
                if (c.Text != "")
                {
                    this.DrawString(c.Text, c.Font, c.ForeColor, ControlForeLeft, ControlForeTop + ControlHeight);
                }
            }
        }