Пример #1
0
        // 编辑LABEL文字
        protected void EditLabel(MLabel label)
        {
            Point   pt      = label.Parent.PointToScreen(label.Location);
            TabPage tabpage = tabControl1.TabPages[CurrentDocumentsDesignIndex];

            pt = tabpage.PointToClient(pt);
            pt.Offset(1, -2);
            _textBox.Location    = pt;
            _textBox.Width       = label.Width;
            _textBox.Height      = label.Height;
            _textBox.Font        = label.Font;
            _textBox.BorderStyle = BorderStyle.FixedSingle;

            _textBox.Visible   = true;
            _textBox.Tag       = label;
            _textBox.Multiline = label.MultiLine;
            if (_textBox.Multiline)
            {
                _textBox.AcceptsReturn = true;
            }
            else
            {
                _textBox.AcceptsReturn = false;
            }
            _textBox.BringToFront();
            _textBox.Focus();
            _textBox.Text           = label.Text;
            _textBox.SelectionStart = _textBox.Text.Length;
        }
Пример #2
0
        // 编辑自定义控件
        protected void EditCustomControl(CustomControl csctrl)
        {
            Point   pt      = csctrl.Parent.PointToScreen(csctrl.Location);
            TabPage tabpage = tabControl1.TabPages[CurrentDocumentsDesignIndex];

            pt = tabpage.PointToClient(pt);
            pt.Offset(1, -2);
            _textBox.Location    = pt;
            _textBox.Width       = csctrl.Width;
            _textBox.Height      = csctrl.Height;
            _textBox.Font        = csctrl.Font;
            _textBox.BorderStyle = BorderStyle.FixedSingle;

            bool hasFiled  = false;
            int  itemCount = csctrl.DefaultItems.Count;

            if (csctrl.SourceTableName != null && csctrl.SourceTableName.ToUpper() == "MED_CUSTOM_DATA")
            {
                hasFiled = true;
                itemCount++;
            }

            string[] strLines = new string[itemCount];
            for (int i = 0; i < csctrl.DefaultItems.Count; i++)
            {
                strLines[i] = string.Format("{0}[#{1}#]", csctrl.DefaultItems[i].ItemName, csctrl.DefaultItems[i].ItemValue);
            }

            if (hasFiled)
            {
                strLines[strLines.Length - 1] = "(@" + csctrl.FieldName + ")";
            }

            _textBox.Lines = strLines;

            _textBox.Visible       = true;
            _textBox.Tag           = csctrl;
            _textBox.Multiline     = true;
            _textBox.AcceptsReturn = true;

            _textBox.BringToFront();
            _textBox.Focus();
            _textBox.SelectionStart = _textBox.Text.Length;
        }
Пример #3
0
 private void OnHeaderRightClick(TabPage tabPage)
 {
     mnuContext.Show(tabPage, tabPage.PointToClient(Cursor.Position));
 }