⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hisformitemform.cs

📁 .net 开发的基础框架
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using SPRFrame;
using Sybase.DataWindow;

namespace HPIResource.HisForm
{
    public partial class HisFormItemForm : Form
    {
        private FormItem_List _item;

        public HisFormItemForm()
        {
            InitializeComponent();
        }

        private void HisFormItemForm_Load(object sender, EventArgs e)
        {
            string s = SPRF.PARM.ToString(); // 传入参数:A-B,A表示form_id,B表示item_id

            int form_id = Convert.ToInt32(s.Substring(0,s.LastIndexOf('-')));
            int item_id = Convert.ToInt32(s.Substring(s.LastIndexOf('-') + 1, s.Length - 1 - s.LastIndexOf('-')));

            _item = new FormItem_List();
            _item.SetDataById(form_id,item_id);
            _item.Retrieve();

            this.dw_item.LibraryList = _item.LibraryList;
            this.dw_item.DataWindowObject = _item.DataWindowObject;
            _item.ShareData(dw_item);

            if (_item.RowCount == 1)
            {
                SetValue();
            }
            else
            {               
                _item.InsertRow(0);
                _item.SetRow(1);
                _item.FORM_ID = form_id;
            }
        }

        // 根据项目数据设置控件的初始值
        private void SetValue()
        {
            string ss = _item.SYNTAX_VIEW;
            int iPos;
            string ls_tmp;
            if (_item.TYPE == "1")
            {
                //-----------------------------------------------
                iPos = ss.IndexOf(" protect='0~t");
                ls_tmp = ss.Substring(iPos + 13, 1);
                if (ls_tmp == "0")
                {
                    cbx_Protect.Checked = true;
                }
                else
                {
                    cbx_Protect.Checked = false;
                }
                //-----------------------------------------------
                iPos = ss.IndexOf(" visible='");
                ls_tmp = ss.Substring(iPos + 10, 1);
                if (ls_tmp == "1")
                {
                    cbx_Visible.Checked = true;
                }
                else
                {
                    cbx_Visible.Checked = false;
                }
                //-----------------------------------------------
                iPos = ss.IndexOf(" x='");
                ls_tmp = ss.Substring(iPos + 4, ss.Length - iPos - 4);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                nUD_X.Value = Convert.ToInt32(ls_tmp);
                //-----------------------------------------------
                iPos = ss.IndexOf(" y='");
                ls_tmp = ss.Substring(iPos + 4, ss.Length - iPos - 4);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                nUD_Y.Value = Convert.ToInt32(ls_tmp);
                //-----------------------------------------------
                iPos = ss.IndexOf(" width='");
                ls_tmp = ss.Substring(iPos + 8, ss.Length - iPos - 8);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                nUD_Width.Value = Convert.ToInt32(ls_tmp);
                //-----------------------------------------------
                iPos = ss.IndexOf(" height='");
                ls_tmp = ss.Substring(iPos + 9, ss.Length - iPos - 9);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                nUD_Height.Value = Convert.ToInt32(ls_tmp);
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.face='");
                ls_tmp = ss.Substring(iPos + 12, ss.Length - iPos - 12);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                cbB_font.Text = ls_tmp;
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.height='-");
                ls_tmp = ss.Substring(iPos + 15, ss.Length - iPos - 15);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                cbB_Size.Text = ls_tmp;
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.weight='");
                ls_tmp = ss.Substring(iPos + 14, ss.Length - iPos - 14);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                if (ls_tmp == "700")
                {
                    cbx_Font_B.Checked = true;
                }
                else
                {
                    cbx_Font_B.Checked = false;
                }
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.italic='");
                ls_tmp = ss.Substring(iPos + 14, ss.Length - iPos - 14);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                if (ls_tmp == "1")
                {
                    cbx_Font_I.Checked = true;
                }
                else
                {
                    cbx_Font_I.Checked = false;
                }
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.underline='");
                ls_tmp = ss.Substring(iPos + 17, ss.Length - iPos - 17);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                if (ls_tmp == "1")
                {
                    cbx_Font_L.Checked = true;
                }
                else
                {
                    cbx_Font_L.Checked = false;
                }
                return;
            }
            if (_item.TYPE == "2")
            {
                //-----------------------------------------------
                iPos = ss.IndexOf(" x='");
                ls_tmp = ss.Substring(iPos + 4, ss.Length - iPos - 4);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                nUD_X.Value = Convert.ToInt32(ls_tmp);
                //-----------------------------------------------
                iPos = ss.IndexOf(" y='");
                ls_tmp = ss.Substring(iPos + 4, ss.Length - iPos - 4);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                nUD_Y.Value = Convert.ToInt32(ls_tmp);
                //-----------------------------------------------
                iPos = ss.IndexOf(" width='");
                ls_tmp = ss.Substring(iPos + 8, ss.Length - iPos - 8);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                nUD_Width.Value = Convert.ToInt32(ls_tmp);
                //-----------------------------------------------
                iPos = ss.IndexOf(" height='");
                ls_tmp = ss.Substring(iPos + 9, ss.Length - iPos - 9);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                nUD_Height.Value = Convert.ToInt32(ls_tmp);
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.face='");
                ls_tmp = ss.Substring(iPos + 12, ss.Length - iPos - 12);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                cbB_font.Text = ls_tmp;
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.height='-");
                ls_tmp = ss.Substring(iPos + 15, ss.Length - iPos - 15);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                cbB_Size.Text = ls_tmp;
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.weight='");
                ls_tmp = ss.Substring(iPos + 14, ss.Length - iPos - 14);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                if (ls_tmp == "700")
                {
                    cbx_Font_B.Checked = true;
                }
                else
                {
                    cbx_Font_B.Checked = false;
                }
                //-----------------------------------------------
                iPos = ss.IndexOf(" font.italic='");
                ls_tmp = ss.Substring(iPos + 14, ss.Length - iPos - 14);
                iPos = ls_tmp.IndexOf("'");
                ls_tmp = ls_tmp.Substring(0, iPos);
                if (ls_tmp == "1")
                {
                    cbx_Font_I.Checked = true;
                }
                else
                {
                    cbx_Font_I.Checked = false;
                }
                //-----------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -