Exemplo n.º 1
0
        public MyForm CreateForm(int beginline, int endline, string[] lines)
        {
            MyForm  frm = new MyForm();
            General g   = new General();

            try
            {
                string key = "Begin VB.Form ";
                int    pos = lines[beginline].IndexOf(key) + key.Length;

                string name = lines[beginline].Substring(pos).Trim();
                g.Name = name;


                g.Sizex = VBtoNET.GetProperty("ClientWidth", beginline, endline, lines);
                g.Sizey = VBtoNET.GetProperty("ClientHeight", beginline, endline, lines);

                g.Text = VBtoNET.GetProperty("Caption", beginline, endline, lines);
                if (String.IsNullOrEmpty(g.Text))
                {
                    g.Text = name;
                }

                g.FixSizes(g);
                frm.General = g;
            }
            catch (Exception e)
            {
                MessageBox.Show("General error - did you load a VB6 form?");
                return(null);
            }
            return(frm);
        }
Exemplo n.º 2
0
        public static General PopulateGeneral(string key, string[] lines, int beginline, int endline)
        {
            General g = new General();

            int pos = lines[beginline].IndexOf(key) + key.Length;

            string name = lines[beginline].Substring(pos).Trim();

            // check if its a control array - same name
            string index = VBtoNET.GetProperty(" Index", beginline, endline, lines);

            if (!String.IsNullOrEmpty(index))
            {
                // its an array
                g.ArrayName = name + "(" + index + ")";
                name        = name + index; // odd but guarantees uniqueness
            }

            //controlNameList.Add(name);
            g.Name = name;

            g.Sizey     = VBtoNET.GetProperty("Height", beginline, endline, lines);
            g.Locationx = VBtoNET.GetProperty("Left", beginline, endline, lines);
            g.Tabindex  = VBtoNET.GetProperty("TabIndex", beginline, endline, lines);
            g.Locationy = VBtoNET.GetProperty("Top", beginline, endline, lines);
            g.Sizex     = VBtoNET.GetProperty("Width", beginline, endline, lines);
            g.Text      = VBtoNET.GetProperty("Caption", beginline, endline, lines);

            g = g.FixSizes(g);
            return(g);
        }
Exemplo n.º 3
0
        private Dictionary <string, string> PopulateControlNamesList(int beginline, int endline, string[] lines, List <MyTabpage> tabList)
        {
            controlNameMap = new Dictionary <string, string>();
            for (int i = 0; i < tabList.Count; i++)
            {
                for (int j = 0; j < 99; j++)
                {
                    string key   = VBtoNET.GetProperty("Tab(" + i.ToString() + ").Control(" + j.ToString() + ")", beginline, endline, lines);
                    string value = tabList[i].General.Name;
                    if (!String.IsNullOrEmpty(key))
                    {
                        //if (VBtoNET.controlNameList.Contains(key)) {
                        //    // its an array
                        //    key = key + beginline.ToString(); // odd but guarantees uniqueness

                        //}
                        controlNameMap.Add(key, value);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            return(controlNameMap);
        }
Exemplo n.º 4
0
        public MyTabControl Create(int beginline, int endline, string[] lines)
        {
            MyTabControl o   = new MyTabControl();
            string       key = "Begin TabDlg.SSTab ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            // tab pages
            int tabPageNum = Int16.Parse(VBtoNET.GetProperty("Tabs", beginline, endline, lines));


            for (int i = 0; i < tabPageNum; i++)
            {
                MyTabpage page = new MyTabpage();

                page.General = new General();

                page.General.Name            = o.General.Name + "TabPage" + i.ToString();
                page.General.Text            = VBtoNET.GetProperty("TabCaption(" + i.ToString() + ")", beginline, endline, lines);
                page.Padding                 = 3;
                page.General.Tabindex        = i.ToString();
                page.UseVisualStyleBackColor = true;
                // these needs to be fixed a bit, i'm not sure what the size and location should be
                page.General.Locationx = "4";
                page.General.Locationy = "22";
                int sizex = Int16.Parse(o.General.Sizex) - 8;
                int sizey = Int16.Parse(o.General.Sizey) - 26;
                page.General.Sizex = sizex.ToString();
                page.General.Sizey = sizey.ToString();
                o.tabList.Add(page);
            }

            o.ControlNameMap = PopulateControlNamesList(beginline, endline, lines, o.tabList);

            return(o);
        }
Exemplo n.º 5
0
        public MyCombobox Create(int beginline, int endline, string[] lines)
        {
            MyCombobox o = new MyCombobox();

            string key = "Begin MSDBCtls.DBCombo ";

            o.General    = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            o.dataSource = VBtoNET.GetProperty("DataSource", beginline, endline, lines);
            o.dataField  = VBtoNET.GetProperty("DataField", beginline, endline, lines);

            return(o);
        }
Exemplo n.º 6
0
        public MyTextbox Create(int beginline, int endline, string[] lines)
        {
            MyTextbox o   = new MyTextbox();
            string    key = "Begin VB.TextBox ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            string multi = VBtoNET.GetProperty("MultiLine", beginline, endline, lines);

            if (multi.Contains("-1"))
            {
                o.Multiline = true;
            }
            o.dataSource = VBtoNET.GetProperty("DataSource", beginline, endline, lines);
            o.dataField  = VBtoNET.GetProperty("DataField", beginline, endline, lines);

            return(o);
        }
Exemplo n.º 7
0
        public MyTabControl Create(int beginline, int endline, string[] lines)
        {
            MyTabControl o   = new MyTabControl();
            string       key = "Begin TabDlg.SSTab ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            // tab pages
            string tabPageNumStr = VBtoNET.GetProperty("Tabs", beginline, endline, lines);
            int    tabPageCount  = 0;

            if (tabPageNumStr == "")
            {
                bool foundTab = true;
                // can't find the tabs property
                for (int tabnum = 0; tabnum < 20; tabnum++)
                {
                    if (!foundTab)
                    {
                        break;
                    }
                    for (int i = beginline; i < endline; i++)
                    {
                        string s = lines[i];
                        if (s.Contains("Tab(" + tabnum.ToString()))
                        {
                            tabPageCount++;
                            break;
                        }
                        if (i == endline - 1)
                        {
                            foundTab = false;
                            break;
                        }
                    }
                }
            }
            else
            {
                tabPageCount = Int16.Parse(tabPageNumStr);
            }


            for (int i = 0; i < tabPageCount; i++)
            {
                MyTabpage page = new MyTabpage();

                page.General = new General();

                page.General.Name            = o.General.Name + "TabPage" + i.ToString();
                page.General.Text            = VBtoNET.GetProperty("TabCaption(" + i.ToString() + ")", beginline, endline, lines);
                page.Padding                 = 3;
                page.General.Tabindex        = i.ToString();
                page.UseVisualStyleBackColor = true;
                // these needs to be fixed a bit, i'm not sure what the size and location should be
                page.General.Locationx = "4";
                page.General.Locationy = "22";
                int sizex = Int16.Parse(o.General.Sizex) - 8;
                int sizey = Int16.Parse(o.General.Sizey) - 26;
                page.General.Sizex = sizex.ToString();
                page.General.Sizey = sizey.ToString();
                o.tabList.Add(page);
            }

            o.ControlNameMap = PopulateControlNamesList(beginline, endline, lines, o.tabList);

            return(o);
        }