ResumeLayout() public méthode

public ResumeLayout ( ) : void
Résultat void
        private static void ResumeDrawing(Control parent)
        {
            parent.ResumeLayout();
            SendMessage(parent.Handle, WM_SETREDRAW, true, 0);

            // Force redraw of control now
            parent.Refresh();
        }
Exemple #2
0
 private void ResumeAllLayout(Control start, bool performLayout)
 {
     Control.ControlCollection controls = start.Controls;
     for (int i = 0; i < controls.Count; i++)
     {
         this.ResumeAllLayout(controls[i], performLayout);
     }
     start.ResumeLayout(performLayout);
 }
        // INTERFACE FUNCTIONS
        public void AddToContainer(Control container)
        {
            container.SuspendLayout();

            AddControlsToContainer(container);

            container.ResumeLayout(false);
            container.PerformLayout();
        }
Exemple #4
0
 public void Dtg_Ctl_Sus_Lot(System.Windows.Forms.Control myctl, bool suspend)
 {
     if (suspend)
     {
         myctl.SuspendLayout();
     }
     else
     {
         myctl.ResumeLayout();
     }
 }
 public static void SuspendLayout(Control control, Action action)
 {
     control.SuspendLayout();
     try
     {
         action();
     } 
     finally
     {
         control.ResumeLayout();
     }
 }
 public int CreateLayout(string LayoutFileName, Control rootPanel)
 {
     int height = 0;
     List<Control> controlList = new List<Control>();
     XmlReaderSettings settings = new XmlReaderSettings {
         IgnoreComments = true,
         IgnoreWhitespace = true
     };
     XmlReader xReader = null;
     try
     {
         xReader = XmlReader.Create(LayoutFileName, settings);
         rootPanel.SuspendLayout();
         bool flag = false;
         while (xReader.Read())
         {
             if ((xReader.NodeType == XmlNodeType.Element) & (xReader.LocalName == "layout"))
             {
                 flag = true;
                 if (xReader.GetAttribute("UseDefaultSize") == "True")
                 {
                     Size size = new Size(xReader.GetAttribute("Size"));
                     height = size.Height;
                 }
             }
             else if (flag)
             {
                 this.doCreateLayout(xReader, controlList);
             }
         }
     }
     catch (XmlException exception)
     {
         NaccsException exception2 = new NaccsException(MessageKind.Error, 0x1f8, exception.Message);
         throw exception2;
     }
     catch (Exception exception3)
     {
         NaccsException exception4 = new NaccsException(MessageKind.Error, 510, exception3.Message);
         throw exception4;
     }
     finally
     {
         rootPanel.Controls.AddRange(controlList.ToArray());
         rootPanel.ResumeLayout(true);
         if (xReader != null)
         {
             xReader.Close();
         }
     }
     return height;
 }
Exemple #7
0
        public static void InitBorderTitle(this Control ctrl, Window window, Control child)
        {
            if (window is ActiveWindow)
            {
                ActiveWindow wnd = (ActiveWindow)window;
                if (ctrl.Controls.ContainsKey("LabelTitle")) ctrl.Controls.RemoveByKey("LabelTitle");
                if (wnd.BorderVisible)
                {
                    ctrl.SuspendLayout();
                    child.SuspendLayout();
                    child.Left += wnd.BorderWidth;
                    child.Width -= wnd.BorderWidth << 1;
                    child.Height -= wnd.BorderWidth;

                    System.Windows.Forms.Label title = new System.Windows.Forms.Label();
                    title.AutoSize = false;
                    title.Name = "LabelTitle";
                    title.BackColor = wnd.BorderColorFrienly;
                    title.Font = new Font(wnd.TitleFont, wnd.TitleSize);
                    title.ForeColor = wnd.TitleColorFrienly;
                    title.Text = wnd.TitleText;
                    title.Left = wnd.BorderWidth;
                    title.Top = 0;
                    using (Graphics g = title.CreateGraphics())
                    {
                        title.Size = g.MeasureString(wnd.TitleText, title.Font).ToSize();
                    }
                    title.Width = child.Width;
                    title.AutoEllipsis = true;
                    title.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;

                    ctrl.Controls.Add(title);
                    if (title.Height == 0)
                    {
                        child.Top += wnd.BorderWidth;
                        child.Height -= wnd.BorderWidth;
                    }
                    else
                    {
                        child.Top += title.Height;
                        child.Height -= title.Height;
                    }

                    ctrl.BackColor = wnd.BorderColorFrienly;
                    child.ResumeLayout();
                    ctrl.ResumeLayout();
                    title.Invalidate();
                }
                ctrl.Text = wnd.TitleText;
            }
        }
        public static void Sinalizar(Control hospedeiro)
        {
            SinalizaçãoAcertado sinalização = new SinalizaçãoAcertado();

            sinalização.Location = new Point((hospedeiro.ClientSize.Width - sinalização.Width) / 2, (hospedeiro.ClientSize.Height - sinalização.Height) / 2);

            hospedeiro.SuspendLayout();
            hospedeiro.Controls.Add(sinalização);
            hospedeiro.Visible = true;
            sinalização.BringToFront();
            hospedeiro.ResumeLayout();

            hospedeiro.Resize += new EventHandler(sinalização.Reposicionar);
        }
Exemple #9
0
        public PluginTabPage(PluginInfo pluginInfo, Control plugin, PluginTabPage parentTab)
            : base(pluginInfo.Name)
        {
            plugin.SuspendLayout();
            plugin.Dock = DockStyle.Fill;

            Info = pluginInfo;
            Plugin = plugin;
            FromTab = parentTab;

            Controls.Add(plugin);
            Name = pluginInfo.Name;
            plugin.ResumeLayout();
        }
Exemple #10
0
        public TKWindow(Size displayDimensions, GlyphPalette palette, Control context)
            : base(displayDimensions, palette)
        {
            if (context == null)
            {
                form = new TKForm();
                form.ClientSize = displayDimensions;
                form.FormClosing += new FormClosingEventHandler(Form_FormClosing);
                form.Show();

                context = form;
            }

            context.SuspendLayout();
            Control.Dock = DockStyle.Fill;
            Control.BackColor = Color.Blue;
            Control.VSync = false;
            Control.Resize += new EventHandler(Control_Resize);
            Control.Paint += new PaintEventHandler(Control_Paint);

            Control.Location = new Point(0, 0);
            Control.Size = context.ClientSize;

            context.Controls.Add(Control);
            context.ResumeLayout(false);

            paletteId = GL.GenTexture();
            Bitmap bmp = palette.SourceBitmap;
            GL.BindTexture(TextureTarget.Texture2D, paletteId);
            BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, bmp_data.Width, bmp_data.Height, 0,
                OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);

            bmp.UnlockBits(bmp_data);

            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

            base.Resize += new EmptyDelegate(TKWindow_Resize);
            this.WindowSize = Control.Size;

            GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f);
            GL.Disable(EnableCap.DepthTest);
            GL.Disable(EnableCap.CullFace);
        }
Exemple #11
0
        protected override void SetVisibleCore(bool visible)
        {
            // This is needed, because if you try and set set visible to true before the parent is visible,
            // we will get called back into here, and set it back to false, since the parent is not visible.
            if (inSetVisibleCore)
            {
                return;
            }

            inSetVisibleCore = true;
            Control.SuspendLayout();
            try {
                Control.Visible = visible;
            }
            finally {
                Control.ResumeLayout(false);
                // this will go ahead and perform layout.
                base.SetVisibleCore(visible);
                inSetVisibleCore = false;
            }
        }
 private void AddFilterControl(Control filterControl)
 {
     filterControl.SuspendLayout();
     UserControl userControl = filterControl as UserControl;
     if (userControl != null)
     {
         BasicFormLocalizer argument = SettingsManager.GetArgument<BasicFormLocalizer>(ArgumentKey.FormLocalizer);
         if (argument != null)
         {
             argument.Localize(userControl);
         }
     }
     filterControl.Margin = new Padding(0);
     if (filterControl is IFilterControl)
     {
         this.InitializeFilterControl((IFilterControl) filterControl);
     }
     filterControl.ResumeLayout();
     this.flpFilters.Controls.Add(filterControl);
     this.flpFilters.Controls.SetChildIndex(this.tsNewCondition, this.flpFilters.Controls.Count);
     this.tsNewCondition.TabIndex = this.flpFilters.Controls.Count - 1;
 }
        /// <devdoc>
        ///     Recursively resumes all layout.
        /// </devdoc>
        internal void ResumeAllLayout(Control start, bool performLayout) {

            ControlCollection controlsCollection = start.Controls;
            // This may have changed the sizes of our children.
            // PERFNOTE: This is more efficient than using Foreach.  Foreach
            // forces the creation of an array subset enum each time we
            // enumerate
            for(int i = 0; i < controlsCollection.Count; i++) {
                ResumeAllLayout(controlsCollection[i], performLayout);
            }

            start.ResumeLayout(performLayout);
        }
        /// <summary>
        ///     De huidige geladen controls moeten de nieuwe resource (taal) gebruiken.
        /// </summary>
        /// <param name="ctrl">De control die we willen bijwerken.</param>
        /// <param name="res">De resources die we gebruiken bij de control.</param>
        private void RefreshControls(Control ctrl, ComponentResourceManager res)
        {
            ctrl.SuspendLayout();

            res.ApplyResources(ctrl, ctrl.Name, _currentLanguage);
            foreach (Control subCtrl in ctrl.Controls)
                RefreshControls(subCtrl, res);

            ctrl.ResumeLayout();
        }
Exemple #15
0
		public void TestPublicMethods ()
		{
			// Public Methods that force Handle creation:
			// - CreateControl ()
			// - CreateGraphics ()
			// - GetChildAtPoint ()
			// - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created
			// - PointToClient ()
			// - PointToScreen ()
			// - RectangleToClient ()
			// - RectangleToScreen ()
			Control c = new Control ();
			
			c.BringToFront ();
			Assert.IsFalse (c.IsHandleCreated, "A1");
			c.Contains (new Control ());
			Assert.IsFalse (c.IsHandleCreated, "A2");
			c.CreateControl ();
			Assert.IsTrue (c.IsHandleCreated, "A3");
			c = new Control ();
			Graphics g = c.CreateGraphics ();
			g.Dispose ();
			Assert.IsTrue (c.IsHandleCreated, "A4");
			c = new Control ();
			c.Dispose ();
			Assert.IsFalse (c.IsHandleCreated, "A5");
			c = new Control ();
			//DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None);
			//Assert.IsFalse (c.IsHandleCreated, "A6");
			//Assert.AreEqual (DragDropEffects.None, d, "A6b");
			//Bitmap b = new Bitmap (100, 100);
			//c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100));
			//Assert.IsFalse (c.IsHandleCreated, "A7");
			//b.Dispose ();
			c.FindForm ();
			Assert.IsFalse (c.IsHandleCreated, "A8");
			c.Focus ();
			Assert.IsFalse (c.IsHandleCreated, "A9");

			c.GetChildAtPoint (new Point (10, 10));
			Assert.IsTrue (c.IsHandleCreated, "A10");
			c.GetContainerControl ();
			c = new Control ();
			Assert.IsFalse (c.IsHandleCreated, "A11");
			c.GetNextControl (new Control (), true);
			Assert.IsFalse (c.IsHandleCreated, "A12");
#if NET_2_0
			c.GetPreferredSize (Size.Empty);
			Assert.IsFalse (c.IsHandleCreated, "A13");
#endif
			c.Hide ();
			Assert.IsFalse (c.IsHandleCreated, "A14");
			c.Invalidate ();
			Assert.IsFalse (c.IsHandleCreated, "A15");
			//c.Invoke (new InvokeDelegate (InvokeMethod));
			//Assert.IsFalse (c.IsHandleCreated, "A16");
			c.PerformLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A17");
			c.PointToClient (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A18");
			c = new Control ();
			c.PointToScreen (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A19");
			c = new Control ();
			//c.PreProcessControlMessage   ???
			//c.PreProcessMessage          ???
			c.RectangleToClient (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A20");
			c = new Control ();
			c.RectangleToScreen (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A21");
			c = new Control ();
			c.Refresh ();
			Assert.IsFalse (c.IsHandleCreated, "A22");
			c.ResetBackColor ();
			Assert.IsFalse (c.IsHandleCreated, "A23");
			c.ResetBindings ();
			Assert.IsFalse (c.IsHandleCreated, "A24");
			c.ResetCursor ();
			Assert.IsFalse (c.IsHandleCreated, "A25");
			c.ResetFont ();
			Assert.IsFalse (c.IsHandleCreated, "A26");
			c.ResetForeColor ();
			Assert.IsFalse (c.IsHandleCreated, "A27");
			c.ResetImeMode ();
			Assert.IsFalse (c.IsHandleCreated, "A28");
			c.ResetRightToLeft ();
			Assert.IsFalse (c.IsHandleCreated, "A29");
			c.ResetText ();
			Assert.IsFalse (c.IsHandleCreated, "A30");
			c.SuspendLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A31");
			c.ResumeLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A32");
#if NET_2_0
			c.Scale (new SizeF (1.5f, 1.5f));
			Assert.IsFalse (c.IsHandleCreated, "A33");
#endif
			c.Select ();
			Assert.IsFalse (c.IsHandleCreated, "A34");
			c.SelectNextControl (new Control (), true, true, true, true);
			Assert.IsFalse (c.IsHandleCreated, "A35");
			c.SetBounds (0, 0, 100, 100);
			Assert.IsFalse (c.IsHandleCreated, "A36");
			c.Update ();
			Assert.IsFalse (c.IsHandleCreated, "A37");
		}
Exemple #16
0
		public void Bug82805 ()
		{
			Control c1 = new Control ();
			c1.Size = new Size (100, 100);
			Control c2 = new Control ();
			c2.Size = new Size (100, 100);

			c2.SuspendLayout ();
			c1.Anchor = AnchorStyles.Left | AnchorStyles.Right;
			c2.Controls.Add (c1);
			c2.Size = new Size (200, 200);
			c2.ResumeLayout ();

			Assert.AreEqual (200, c1.Width, "A1");
		}
Exemple #17
0
 public static void CallControlResumeLayout(Control c, object[] obj)
 {
     c.ResumeLayout((bool)obj[0]);
 }
Exemple #18
0
		/// <summary>
		/// Convenience helper method to apply component resources for a top-level <see cref="UserControl"/>
		/// or <see cref="Form"/> and its descendants using the current application UI culture.
		/// </summary>
		/// <param name="control">A top-level <see cref="Control"/> that has an associated resource (RESX) file.</param>
		public static void ApplyControlResources(Control control)
		{
			Platform.CheckForNullReference(control, "control");
			control.SuspendLayout();
			try
			{
				// use the resource manager associated with the control class
				var resourceManager = new ComponentResourceManager(control.GetType());
				var cultureInfo = Application.CurrentUICulture;

				// apply any resources to child controls first
				ApplyChildControlResources(resourceManager, cultureInfo, control);

				// apply the resources associated with ourself using the special key "$this"
				resourceManager.ApplyResources(control, "$this", cultureInfo);
			}
			finally
			{
				control.ResumeLayout(true);
			}
		}
 private void ResumeAllLayout(Control start, bool performLayout)
 {
     Control.ControlCollection controls = start.Controls;
     for (int i = 0; i < controls.Count; i++)
     {
         this.ResumeAllLayout(controls[i], performLayout);
     }
     start.ResumeLayout(performLayout);
 }
        // -------------------------------------------------------------------
        /// <summary>
        /// 本クラスの初期化
        /// </summary>
        /// <param name="_ctrl"></param>
        private void InitializeBase(Control _ctrl)
        {
            _ctrl.SuspendLayout();

            // プロパティ
            this.BuildBindings = OnBuildBindingsDefault;

            // フィールド
            this.ctrl = _ctrl;
            this.bsource = new BindingSource();

            // イベント
            bsource.DataSourceChanged += bsource_DataSourceChanged;

            _ctrl.ResumeLayout();
        }
		public static void CallControlResumeLayout(Control c, object[] obj)
		{
			c.ResumeLayout((bool)obj[0]);
		}
		private void UnwireFromChildren(Control control)
		{
			control.SuspendLayout();
			Debug.Assert(control != null);
			control.ControlAdded -= OnControlAdded;
			control.ControlRemoved -= OnControlRemoved;
			control.Disposed -= OnControlDisposed;
			//Debug.WriteLine("Unwiring from children of " + control.Name);
			foreach (Control child in control.Controls)
			{
				UnwireFromControl(child);
				UnwireFromChildren(child);
			}
			control.ResumeLayout();
		}
		private void WireToChildren(Control control)
		{
			control.SuspendLayout();
			Debug.Assert(control != null);
			//Debug.WriteLine("Wiring to children of " + control.Name);
			control.ControlAdded += OnControlAdded;
			control.ControlRemoved += OnControlRemoved;
			control.Disposed += OnControlDisposed;
			foreach (Control child in control.Controls)
			{
				WireToControlAndChildren(child);
			}
			control.ResumeLayout();
		}
 /// <summary>
 /// 
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="userControl"></param>
 public override void AddUseControls(Control parent, IWindow userControl)
 {
     if (parent != null && userControl != null)
     {
         parent.SuspendLayout();
         base.AddUseControls(parent, userControl);
         parent.ResumeLayout();
     }
 }
Exemple #25
0
 public static void ResizeChilds(Control c)
 {
     c.SuspendLayout();
     ResizeChildsInt(c, true);
     c.ResumeLayout();
 } 
Exemple #26
0
 // Public methods.
 /// <summary>
 /// Sets the font for the specified window control.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="font">The parent font.</param>
 public static void SetFont(Control control, Font font = null)
 {
     // If the control is null, exit.
     if (null == control) return;
     // If the font cannot be changed, return.
     if (!Window.fontChange) return;
     // Suspend the control layout.
     control.SuspendLayout();
     // Get the font of the current control.
     Font oldFont = control.Font;
     // The new font for the current control.
     Font newFont;
     // If the parent font has the same (or smaller) size and style as the old font.
     if (null != font ? (oldFont.Size == font.Size) && (oldFont.Style == font.Style) : false)
     {
         // Use the same font as the parent.
         newFont = font;
     }
     else if (null != font ? (Window.defaultFont.Size == font.Size) && (Window.defaultFont.Style == font.Style) : false)
     {
         // Use the default font.
         newFont = Window.defaultFont;
     }
     else
     {
         // Create a new font for the current control.
         newFont = new Font(Window.fontDefaultFamily, oldFont.Size, oldFont.Style);
     }
     // For all child controls.
     foreach (Control child in control.Controls)
     {
         // If the child font is in the replace list.
         if (Window.fontReplaceList.IndexOf(child.Font.Name) > -1)
         {
             // Set the font for the child control.
             Window.SetFont(child);
         }
     }
     // Set the font for the current control.
     control.Font = newFont;
     // Resume the control layout.
     control.ResumeLayout(false);
 }
Exemple #27
0
        internal static void TranslateInterface(Control form, string lang)
        {
            // Check to see if a the translation file exists in the same folder as the executable
            string externalLangPath = "lang_" + lang + ".txt";
            string[] rawlist;
            if (File.Exists(externalLangPath))
                rawlist = File.ReadAllLines(externalLangPath);
            else
            {
                object txt = Properties.Resources.ResourceManager.GetObject("lang_" + lang);
                if (txt == null) return; // Translation file does not exist as a resource; abort this function and don't translate UI.
                rawlist = ((string)txt).Split(new[] { "\n" }, StringSplitOptions.None);
                rawlist = rawlist.Select(i => i.Trim()).ToArray(); // Remove trailing spaces
            }

            List<string> stringdata = new List<string>();
            int start = -1;
            for (int i = 0; i < rawlist.Length; i++)
            {
                // Find our starting point
                if (!rawlist[i].Contains("! " + form.Name)) continue;
                start = i;
                break;
            }
            if (start < 0)
                return;

            // Rename Window Title
            string[] WindowName = rawlist[start].Split(new[] { " = " }, StringSplitOptions.None);
            if (WindowName.Length > 1) form.Text = WindowName[1];

            // Fetch controls to rename
            for (int i = start + 1; i < rawlist.Length; i++)
            {
                if (rawlist[i].Length == 0) continue; // Skip Over Empty Lines, errhandled
                if (rawlist[i][0] == '-') continue; // Keep translating if line is a comment line
                if (rawlist[i][0] == '!') // Stop if we have reached the end of translation
                    break;
                stringdata.Add(rawlist[i]); // Add the entry to process later.
            }

            if (stringdata.Count == 0)
                return;

            // Find control then change display Text.
            form.SuspendLayout();
            foreach (string str in stringdata)
            {
                string[] SplitString = str.Split(new[] { " = " }, StringSplitOptions.None);
                if (SplitString.Length < 2)
                    continue;

                object c = FindControl(SplitString[0], form.Controls); // Find control within Form's controls
                if (c == null) // Not found
                    continue;

                string text = SplitString[1]; // Text to set Control.Text to...

                if (c is Control)
                    (c as Control).Text = text;
                else if (c is ToolStripItem)
                    (c as ToolStripItem).Text = text;
            }
            form.ResumeLayout();
        }
Exemple #28
0
 /**
  * Copy Visual Studio's layout semantics.
  */
 public static void DoLayout(Control parent)
 {
     DoDeepLayout(parent);
     parent.ResumeLayout(false);
 }
        //Deserialize individual base windows and there child control
        public static void DeserializeWindowXML(string fileName, Control baseFrame, XmlNode parentXMLNode)
        {
            DataSet dataset = new DataSet();
            XmlDocument doc = new XmlDocument();
            XmlNode currentXmlNode = null;
            Dictionary<string, EIBNode> listNode = new Dictionary<string, EIBNode>();
            try
            {

                // disabling re-drawing of treeview till all nodes are added
                baseFrame.SuspendLayout();
                fileName = fileName + ".xml";
                if (parentXMLNode == null)
                {
                    doc.Load(fileName);
                    currentXmlNode = doc.FirstChild;
                }
                else
                {
                    currentXmlNode = parentXMLNode;
                }
                baseFrame.Controls.Clear();
                if (currentXmlNode.Name == FormDesignerConstants.BaseWindow)
                {
                    // loading node attributes
                    UpdateControlProperties(baseFrame, currentXmlNode);
                }
                //Iterate all nodes

                foreach (XmlNode xmlNode in currentXmlNode.ChildNodes)
                {
                    if (xmlNode.NodeType == XmlNodeType.Element)
                    {
                        if (xmlNode.Name == FormDesignerConstants.NodeControl)
                        {
                            EIBNode.counter++;

                            EIBNode eibNode = new EIBNode();
                            UpdateControlProperties(eibNode, xmlNode);
                            eibNode.nodeIdText.Text = xmlNode.Attributes["id"].Value.ToString();
                            eibNode.startNodeCheck.Checked = (xmlNode.Attributes["isstart"].Value.ToLower().Equals("true"));
                           // baseFrame.Controls.Add(eibNode);
                            listNode.Add(eibNode.nodeIdText.Text, eibNode);
                            //EIBNode newNode = new EIBNode();
                           // UpdateControlProperties(newNode, xmlNode);
                           // newNode.nodeIdText.Text = xmlNode["workflownode"].Attributes["id"].Value.ToString();
                           // newNode.startNodeCheck.Checked = (xmlNode["workflownode"].Attributes["isstart"].Value.ToLower().Equals("true"));
                            //XmlNode xmlWorkFlowNode = getXMLNodeWithName(xmlNode,"workflownode")
                            //xmlNode[
                            eibNode.WorkFlowNode= Desearializeworkflownodexml(xmlNode);
                            eibNode.workflowNode.WorkFlowNodeId = eibNode.nodeIdText.Text;
                            eibNode.nodeIdText.Enabled = false;
                            ((BaseWindow)baseFrame.Parent).WorkflowNodes.Add(eibNode.workflowNode.WorkFlowNodeId, eibNode);
                            baseFrame.Controls.Add(eibNode);

                        }
                        if (xmlNode.Name == "connector")
                        {
                            try
                            {
                                //EIBNodeConnector.counter++;
                                EIBNodeConnector newNode = new EIBNodeConnector();
                                XmlNode xmlNodeconnector = xmlNode;
                                UpdateControlProperties(newNode, xmlNodeconnector);
                                XmlNode connectorNode = xmlNodeconnector;
                                //XmlNode fromNodeName = connectorNode["from"].Attributes["id"];
                                //XmlNode toNodeName = connectorNode["to"].Attributes["id"];
                                string fromNodeName = connectorNode["from"].Attributes["id"].Value;
                                string toNodeName = connectorNode["to"].Attributes["id"].Value;
                                EIBNode fromNode = listNode[fromNodeName];
                                EIBNode toNode = listNode[toNodeName];
                                Graphics g = null;
                                Bitmap bmpBack = new Bitmap(baseFrame.Width, baseFrame.Height);
                                Graphics.FromImage(bmpBack).Clear(baseFrame.BackColor);
                                baseFrame.BackgroundImage = (Bitmap)bmpBack.Clone();
                                g = Graphics.FromImage(baseFrame.BackgroundImage);
                                int centerMarkX = (fromNode.Center.X + toNode.Center.X) / 2;
                                int centerMarkY = (fromNode.Center.Y + toNode.Center.Y) / 2;
                                newNode.centerMark.Location = new Point(centerMarkX - 4, centerMarkY - 4);
                                newNode.InitiateSettings((EIBPanel)baseFrame);
                                newNode.Mark1 = fromNode;
                                newNode.Mark2 = toNode;
                                newNode.createLine();
                                baseFrame.Controls.Add(newNode.centerMark);
                                g.DrawLine(new Pen(Color.RoyalBlue, (float)2), fromNode.Center.X, fromNode.Center.Y, centerMarkX, centerMarkY);
                                g.DrawLine(new Pen(Color.RoyalBlue, (float)2), toNode.Center.X, toNode.Center.Y, centerMarkX, centerMarkY);
                                baseFrame.Controls.Add(newNode);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Connector xml Modified.");
                            }
                        }
                     }
                }
                //Iterate all nodes connector
                /*foreach (XmlNode xmlNodeconnector in currentXmlNode.ChildNodes)
                {
                    if (xmlNodeconnector.NodeType == XmlNodeType.Element)
                    {

                    }
                 }*/
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show("Basewindow.xml not Found");
            }
            finally
            {
                baseFrame.ResumeLayout();
                // enabling redrawing of treeview after all nodes are added
                baseFrame.Invalidate();
            }
        }
Exemple #30
0
 private void RefreshResources(Control ctrl, ComponentResourceManager res, System.Globalization.CultureInfo CurrentLocale)
 {
     ctrl.SuspendLayout();
     res.ApplyResources(ctrl, ctrl.Name, CurrentLocale);
     foreach (Control control in ctrl.Controls)
         RefreshResources(control, res,CurrentLocale); // recursion
     ctrl.ResumeLayout(false);
 }
        //Deserialize individual base windows and there child control
        public static void DeserializeWindowXML(string fileName, Control baseFrame, XmlNode parentXMLNode)
        {
            DataSet dataset = new DataSet();
            int nextTop = 0, nextLeft = 0;
            int maxHeight = 0, maxWidth = 0;
            int ParentWidth;
            Dictionary<string, EIBTable> listTable = new Dictionary<string, EIBTable>();
            try
            {
                ParentWidth = baseFrame.Width;
                // disabling re-drawing of treeview till all nodes are added
                baseFrame.SuspendLayout();
                fileName = fileName + ".xml";
                string datasetName = System.IO.Path.GetFileNameWithoutExtension(fileName);
                List<string> M2MList = new List<string>();
                dataset = DatabaseXMLServices.ReadSchema(datasetName, fileName,M2MList);
                //dataset.ReadXml(fileName);
                baseFrame.Controls.Clear();
                ((BaseWindow)baseFrame.Parent).DatabaseDataSet = dataset;
                foreach (DataTable table in dataset.Tables)
                {
                    EIBTable.counter++;
                    EIBTable newNode = new EIBTable();
                    newNode.TableData = table;
                    newNode.Height = 160;
                    newNode.Width = 200;
                    newNode.DatabaseDataSet = dataset;
                    newNode.Name = table.TableName;
                    listTable.Add(newNode.Name, newNode);
                    newNode.ControlName = table.TableName;
                    newNode.tableName.Text = table.TableName;
                    if (M2MList.Contains(table.TableName))
                    {
                        newNode.M2M = true;
                    }
                    else
                    {
                        newNode.M2M = false;
                    }
                    newNode.Top = nextTop;
                    newNode.Left = nextLeft;
                    UpdateControlProperties(newNode);
                    newNode.AutoSize = false;
                    baseFrame.Controls.Add(newNode);
                    if (newNode.Height > maxHeight)
                    {
                        maxHeight = newNode.Height;
                    }
                    if (newNode.Width > maxWidth)
                    {
                        maxWidth = newNode.Width;
                    }
                    if ((nextLeft + newNode.Width + maxWidth) >= ParentWidth)
                    {
                        nextTop += maxHeight;
                        nextLeft = 0;
                    }
                    else
                    {
                        nextLeft += newNode.Width;
                    }
                    foreach (DataColumn column in table.Columns)
                    {
                        ListViewItem lvItem = new ListViewItem(column.ColumnName);
                        if (column.DataType.Name == typeof(string).Name)
                        {
                            int iCap;
                            bool isVarChar = Int32.TryParse(column.Caption,out iCap);
                            if (isVarChar)
                                lvItem.SubItems.Add(column.DataType.Name);
                            else
                                lvItem.SubItems.Add(Designer.Database.DatabaseConstants.LongTextType);
                        }
                        else
                        {
                            lvItem.SubItems.Add(column.DataType.Name);
                        }
                        string autoIncrement = null;
                        if (column.AutoIncrement)
                        {
                            autoIncrement = "Yes";
                        }
                        else
                        {
                            autoIncrement = "No";
                        }
                        lvItem.SubItems.Add(autoIncrement);
                        string uniqueKey = null;
                        if (column.Unique)
                        {
                            uniqueKey = "Yes";
                        }
                        else
                        {
                            uniqueKey = "No";
                        }
                        lvItem.SubItems.Add(uniqueKey);
                        int iCaption;
                        if (column.Caption != null && (!column.Caption.Trim().Equals("")) && Int32.TryParse(column.Caption,out iCaption))
                        {
                            lvItem.SubItems.Add(column.Caption);
                        }
                        else
                        {
                            lvItem.SubItems.Add("");
                        }
                        if (column.Unique)
                        {
                            lvItem.SubItems.Add("Not Null");
                        }
                        else
                        {
                            lvItem.SubItems.Add((column.AllowDBNull ? "Null" : "Not Null"));
                        }

                        newNode.lvDatabase.Items.Add(lvItem);
                    }
                }
                foreach (DataRelation relation in dataset.Relations)
                {
                    EIBTableConnector tableConnector = new EIBTableConnector();
                    tableConnector.InitiateSettings((EIBPanel)baseFrame);
                    tableConnector.Mark1 = (EIBTable)listTable[relation.ParentTable.TableName];
                    tableConnector.Mark2 = (EIBTable)listTable[relation.ChildTable.TableName];
                    tableConnector.createLine();
                    baseFrame.Controls.Add(tableConnector);
                }
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show("Basewindow.xml not Found");
            }
            catch (XmlException)
            {
                MessageBox.Show("DataPattern xml is changed.");
            }
            finally
            {
                // enabling redrawing of treeview after all nodes are added
                baseFrame.ResumeLayout();
                baseFrame.Invalidate();
            }
        }
Exemple #32
0
 //refresh all the sub-controls of the form recursively
 private void RefreshFormResources(Control ctrl, ComponentResourceManager res)
 {
     ctrl.SuspendLayout();
     res.ApplyResources(ctrl, ctrl.Name, CurrentLocale);
     foreach (Control c in ctrl.Controls)
         RefreshFormResources(c, res); // recursion
     ctrl.ResumeLayout(false);
 }
Exemple #33
0
        /////////////////////////////////////////////////////////////////
        // PRIVATE METHODS
        /////////////////////////////////////////////////////////////////
        //
        // Attaches a pick box to the sender Control
        //
        internal void SelectControl(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
                return;

            if (m_control is Control)
            {
                m_control.Cursor = UIEventManager.pickBox[(IEIBControl)m_control].oldCursor;

                //Remove event any pre-existing event handlers appended by this class
                m_control.MouseDown -= new MouseEventHandler(this.ctl_MouseDown);
                m_control.MouseMove -= new MouseEventHandler(this.ctl_MouseMove);
                m_control.MouseUp -= new MouseEventHandler(this.ctl_MouseUp);
                m_control.KeyDown -= new KeyEventHandler(this.ctl_KeyDown);
                m_control.KeyUp -= new KeyEventHandler(this.ctl_KeyUp);
                m_control.CursorChanged -= new EventHandler(m_control_CursorChanged);
                m_control = null;
            }

            m_control = (Control)sender;
            m_control.SuspendLayout();
            //Add event handlers for moving the selected control around
            m_control.MouseDown += new MouseEventHandler(this.ctl_MouseDown);
            m_control.MouseMove += new MouseEventHandler(this.ctl_MouseMove);
            m_control.MouseUp += new MouseEventHandler(this.ctl_MouseUp);
            m_control.KeyDown += new KeyEventHandler(this.ctl_KeyDown);
            m_control.KeyUp += new KeyEventHandler(this.ctl_KeyUp);

            //Add sizing handles to Control's container (Form or PictureBox)
            for (int i = 0; i < 8; i++)
            {
                m_control.Parent.Controls.Add(lbl[i]);
                lbl[i].BringToFront();
            }

            //Position sizing handles around Control
            MoveHandles();

            //Display sizing handles
            ShowHandles();

            oldCursor = m_control.Cursor;
            m_control.Cursor = Cursors.SizeAll;
            m_control.CursorChanged += new EventHandler(m_control_CursorChanged);
            /*if (!((m_control is EIBFormDesigner.Controls.EIBPicture) || (m_control is EIBFormDesigner.Controls.EIBPanel)))
            {
                m_control.Cursor = Cursors.SizeAll;
            }*/
            m_control.ResumeLayout();
            //m_control.Invalidate();
        }
Exemple #34
0
		public void RelationTest() {
			Control c1;
			Control c2;

			c1 = new Control();
			c2 = new Control();

			Assert.AreEqual(true , c1.Visible , "Rel1");
			Assert.AreEqual(false, c1.Contains(c2) , "Rel2");
			Assert.AreEqual("System.Windows.Forms.Control", c1.ToString() , "Rel3");

			c1.Controls.Add(c2);
			Assert.AreEqual(true , c2.Visible , "Rel4");
			Assert.AreEqual(true, c1.Contains(c2) , "Rel5");

			c1.Anchor = AnchorStyles.Top;
			c1.SuspendLayout ();
			c1.Anchor = AnchorStyles.Left ;
			c1.ResumeLayout ();
			Assert.AreEqual(AnchorStyles.Left , c1.Anchor, "Rel6");

			c1.SetBounds(10, 20, 30, 40) ;
			Assert.AreEqual(new Rectangle(10, 20, 30, 40), c1.Bounds, "Rel7");

			Assert.AreEqual(c1, c2.Parent, "Rel8");
		}