Refresh() public method

public Refresh ( ) : void
return void
Exemplo n.º 1
0
        public static void ResumeDrawing(Control c)
        {
            try
            {
                //re-enable drawing
                if (c is TabPage)
                {
                    SendMessage(c.Parent.Handle, WM_SETREDRAW, 1, IntPtr.Zero);
                    //c.Refresh(); // <-- actually redraw
                    c.Parent.Refresh();
                }
                else
                {
                    SendMessage(c.Handle, WM_SETREDRAW, 1, IntPtr.Zero);

                    c.Refresh(); // <-- actually redraw
                }
                suspend = false;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                return;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// draw the profile in the canvas
 /// </summary>
 /// <param name="profile">the profile of the beam system</param>
 public void DrawProfile(IList <Line> profile)
 {
     Initialize(profile);
     CalculateTransform();
     m_canvas.Paint += new PaintEventHandler(this.Paint);
     m_canvas.Refresh();
 }
Exemplo n.º 3
0
        private static void ResumeDrawing(Control parent)
        {
            parent.ResumeLayout();
            SendMessage(parent.Handle, WM_SETREDRAW, true, 0);

            // Force redraw of control now
            parent.Refresh();
        }
Exemplo n.º 4
0
        private static void PositionStickControl(Control control, Point location, GamePadThumbSticks.StickValue value)
        {
            var deltaX = value.X * control.Width * 0.5f;
            var deltaY = value.Y * control.Height * -0.5f;

            control.Location = new Point(location.X + (int)deltaX, location.Y + (int)deltaY);
            control.Refresh();
        }
 public static void ResumeDrawing(Control parent)
 {
     if (_suspended)
     {
         SendMessage(parent.Handle, WmSetredraw, true, 0);
         parent.Refresh();
         _suspended = false;
     }
 }
Exemplo n.º 6
0
 private static async Task DispatchStartAsync(Control control, Bitmap bitmap, byte []buffer)
 {
    
     control.Invoke(new Action(() =>
     {
         ProcessStart(bitmap, buffer);
         control.Refresh();
     }));
 }
Exemplo n.º 7
0
 public static void RefreshControl(Control i_Control)
 {
     if (i_Control.InvokeRequired)
     {
         i_Control.Invoke(new Action<Control>(RefreshControl), i_Control);
     }
     else
     {
         i_Control.Refresh();
     }
 }
        /// <summary>
        /// Starts painting messages and events.
        /// </summary>
        /// <param name="parent">Parent control handle</param>
        public static void ResumeLogic(Control parent)
        {
            if (parent != null)
            {
                // Turn-On events:
                SendMessage(parent.Handle, EM_SETEVENTMASK, 0, EVENTMASK);

                // Turn-On redrawing:
                SendMessage(parent.Handle, WM_SETREDRAW, 1, IntPtr.Zero);

                parent.Refresh();
            }
        }
Exemplo n.º 9
0
        private static async Task DispatchDeltaAsync(Control control, Bitmap bitmap, IProtocolStream stream)
        {
            var buffer = await stream.ReceiveAsync();

            control.Invoke(new Action(() =>
            {
                int len = buffer.DecompressQuick(_bufferUncompressed);

                ProcessDelta(bitmap, _bufferUncompressed, 0, len);

                control.Refresh();
            }));
        }
Exemplo n.º 10
0
 public static void FlashControl(Control control, string message)
 {
     var oldText = control.Text;
     var oldForeColor = control.ForeColor;
     var oldFont = control.Font;
     try {
         control.Text = message;
         control.ForeColor = Color.FromArgb(0x00e00000);
         var newSize = (float)Math.Pow(oldFont.Size, 1.8) / 5.7;  // please don't ask
         control.Font = new Font(oldFont.FontFamily, oldFont.Size * 1.25f, FontStyle.Bold);
         control.Refresh();
         Thread.Sleep(750);
         control.Text = oldText;
     } finally {
         control.Text = oldText;
         control.ForeColor = oldForeColor;
         control.Font = oldFont;
         control.Focus();
     }
 }
Exemplo n.º 11
0
 private void date_click(object sender, EventArgs e)
 {
     System.Windows.Forms.Control con = (System.Windows.Forms.Control)sender;
     if (con.Text == "<")
     {
         var d = Conv.ToDateTime(con.Tag);
         d = d.AddMonths(-1);
         ShowDate(d.Year, d.Month, (System.Windows.Forms.Control)pnlboard.Tag);
     }
     else if (con.Text == ">")
     {
         var d = Conv.ToDateTime(con.Tag);
         d = d.AddMonths(1);
         ShowDate(d.Year, d.Month, (System.Windows.Forms.Control)pnlboard.Tag);
     }
     else
     {
         System.Windows.Forms.Control c = (System.Windows.Forms.Control)pnlboard.Tag;
         c.Text = Conv.ToDateTime(con.Tag).ToString("yyyy-MM-dd");
         c.Refresh();
         pnlboard.Visible = false;
     }
 }
Exemplo n.º 12
0
 private void BlinkControl(Control myControl, int myMsec, int nTimes)
 {
     System.Drawing.Color oldColor = myControl.BackColor;
     for (int x = 1; x <= nTimes; x++)
     {
         myControl.BackColor = System.Drawing.Color.SeaGreen;
         myControl.Refresh();
         Thread.Sleep(myMsec);
         myControl.BackColor = oldColor;
         myControl.Refresh();
         Thread.Sleep(myMsec);
     }
 }
Exemplo n.º 13
0
 public AboutForm(Control parent)
 {
     InitializeComponent();
        Theming.ApplyTheme(this);
        ClientSize = new Size(parent.ClientSize.Width, parent.ClientSize.Height);
        Point point = parent.PointToScreen(new Point(0, 0));
        Left = point.X;
        Top = point.Y;
        AboutText = S._(@"Eraser is an advanced security tool for Windows, which allows you to completely remove sensitive data from your hard drive by overwriting it several times with carefully selected patterns. Eraser is Free software and its source code is released under GNU General Public License.
     Erasure Method Credits:
     Gutmann (35 Pass): Copyright Peter Gutmann & Colin Plumb
     Gutmann Lite (10 pass): Copyright Peter Gutmann & Colin Plumb
     US DoD (7 pass): Copyright United States Department of
     Defense
     US DoD (3 pass): Copyright United States Department of
     Defense
     US Air Force 5020 (3 pass): Copyright United States Department of
     Defense
     US Army AR380-19 (3 pass): Copyright United States Department of
     Defense
     RCMP TSSIT OPS-II (7 pass): Copyright Government of Canada,
     Royal Canadian Mounted Police
     Schneier's Method (7 pass):	Copyright Bruce Schneier
     German VSITR (7 pass): Copyright Germany BSI Verschlusssachen
     -IT-Richtlinien
     British HMG IS5 (3 pass): Copyright British Government
     British HMG IS5 (1 pass): Copyright British Government
     Russian GOST P50739-95 (2 pass): Copyright Government of the Soviet
     Union
     Pseudorandom data (1 pass): Public Domain
     First/Last 16Kb: Copyright The Eraser Project
     Eraser Copyright " + "\u0000" + @" The Eraser Project
     Eraser Project Members:
     " + "\u0000" + @" Sami Tolvanen: Mentor/Initiator
     " + "\u0000" + @" Garrett Trant: Mentor/Researcher
     " + "\u0000" + @" Joel Low: Lead Developer
     " + "\u0000" + @" Kasra Nassiri: Developer/Security Researcher
     " + "\u0000" + @" Dennis van Lith: Designer");
        AboutBitmap = Properties.Resources.AboutDialog;
        AboutBitmap = AboutBitmap.Clone(new Rectangle(0, 0, AboutBitmap.Width,
     AboutBitmap.Height), PixelFormat.DontCare);
        using (Graphics g = Graphics.FromImage(AboutBitmap))
        {
     Font boldFont = new Font(Font, FontStyle.Bold);
     Font underlineFont = new Font(Font, FontStyle.Underline);
     Brush textBrush = new SolidBrush(Color.White);
     PointF eraserPos = new PointF(168, 80);
     SizeF eraserSize = g.MeasureString(S._("Eraser"), boldFont);
     g.DrawString(S._("Eraser"), boldFont, textBrush, eraserPos);
     string versionString = BuildInfo.CustomBuild ?
      S._("{0} (Built: {1:F}, special build)") : S._("{0} (Built: {1:F})");
     g.DrawString(string.Format(CultureInfo.CurrentCulture, versionString,
      Assembly.GetExecutingAssembly().GetName().Version, BuildInfo.BuildDate),
      Font, textBrush, new PointF(eraserPos.X + eraserSize.Width + 3, eraserPos.Y));
     string copyrightText = S._("copyright \u0000 2008-2010 The Eraser Project");
     PointF copyrightPos = new PointF(eraserPos.X, eraserPos.Y + eraserSize.Height);
     SizeF copyrightSize = g.MeasureString(copyrightText, Font);
     g.DrawString(copyrightText, Font, textBrush, copyrightPos);
     string websiteText = "http://eraser.heidi.ie/";
     PointF websitePos = new PointF(copyrightPos.X, copyrightPos.Y + copyrightSize.Height);
     SizeF websiteSize = g.MeasureString(websiteText, Font);
     g.DrawString(websiteText, underlineFont, textBrush, websitePos);
     WebsiteRect = new Rectangle((int)websitePos.X, (int)websitePos.Y,
      (int)websiteSize.Width, (int)websiteSize.Height);
     string disclaimerText = S._("Eraser is free open-source software!");
     PointF disclaimerPos = new PointF(websitePos.X, websitePos.Y + websiteSize.Height * 1.5f);
     g.DrawString(disclaimerText, Font, textBrush, disclaimerPos);
     string donationText = S._("Please help us to continue developing Eraser - donate some coffee!");
     PointF donationPos = new PointF(disclaimerPos.X, disclaimerPos.Y + 170);
     SizeF donationSize = g.MeasureString(donationText, Font);
     g.DrawString(donationText, Font, textBrush, donationPos);
     DonateRect = new Rectangle((int)donationPos.X, (int)donationPos.Y,
      (int)donationSize.Width, (int)donationSize.Height);
        }
        AboutBitmapPos = new Point((ClientSize.Width - AboutBitmap.Width) / 2,
     (ClientSize.Height - AboutBitmap.Height) / 2);
        WebsiteRect.X += AboutBitmapPos.X;
        WebsiteRect.Y += AboutBitmapPos.Y;
        DonateRect.X += AboutBitmapPos.X;
        DonateRect.Y += AboutBitmapPos.Y;
        AboutTextRect = new Rectangle(AboutBitmapPos.X + 19 + 149, AboutBitmapPos.Y + 20 + 147,
     AboutBitmap.Width - 19 - 149 - 20, 130);
        SizeF aboutTextSize = SizeF.Empty;
        using (Bitmap b = new Bitmap(1, 1))
        using (Graphics g = Graphics.FromImage(b))
     aboutTextSize = g.MeasureString(AboutText, Font, AboutTextRect.Width);
        AboutTextBitmap = new Bitmap(AboutTextRect.Width, (int)aboutTextSize.Height);
        using (Graphics g = Graphics.FromImage(AboutTextBitmap))
        {
     g.Clear(Color.FromArgb(0, 0, 0, 0));
     g.DrawString(AboutText, Font, new SolidBrush(Color.White), new RectangleF(
      0.0f, 0.0f, AboutTextRect.Width, aboutTextSize.Height));
        }
        ParentBitmap = new Bitmap(parent.ClientSize.Width, parent.ClientSize.Height);
        using (Graphics dest = Graphics.FromImage(ParentBitmap))
        {
     parent.Refresh();
     Point parentPos = parent.PointToScreen(new Point(0, 0));
     dest.CopyFromScreen(parentPos, new Point(0, 0), parent.ClientSize);
        }
        AboutTextScrollTop = AboutTextRect.Height / 2;
        animationTimer_Tick(null, null);
 }
 public static void ResumeDrawing(System.Windows.Forms.Control _ctrl)
 {
     SendMessage(_ctrl.Handle, WM_SETREDRAW, true, 0);
     _ctrl.Refresh();
 }
Exemplo n.º 15
0
        /*public void designerHost_LoadComplete(object sender, EventArgs e)
        {
            LoadComponentLocation();
        }*/
        private void ViewOperation()
        {
            try
            {
                // designerHost
                //
                designerHost = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
                while (designerHost == null)
                {
                    Thread.Sleep(100);
                    designerHost = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
                }

                // Wait for loading document
                //
                //designerHost.LoadComplete += new EventHandler(designerHost_LoadComplete);
                while (designerHost.Loading)
                {
                    Thread.Sleep(100);
                }

                // view
                //
                view = this.Control;
                while (view == null)
                {
                    Thread.Sleep(100);
                    view = this.Control;
                }
                view.Paint += new PaintEventHandler(view_Paint);
                view.Click += new EventHandler(view_Click);
                this.TrayAutoArrange = false;

                // Add a Rectangle border to every control in design view
                //
                foreach (Control ctrl in view.Controls)
                {
                    ctrl.Paint += new PaintEventHandler(ctrl_Paint);
                }

                // componnetChangeService
                //
                componentChangeService = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                while (componentChangeService == null)
                {
                    Thread.Sleep(100);
                    componentChangeService = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                }

                componentChangeService.ComponentAdded += new ComponentEventHandler(componentChangeService_ComponentAdded);
                componentChangeService.ComponentChanged += new ComponentChangedEventHandler(componentChangeService_ComponentChanged);
                componentChangeService.ComponentRemoved += new ComponentEventHandler(componentChangeService_ComponentRemoved);
                componentChangeService.ComponentRename += new ComponentRenameEventHandler(componentChangeService_ComponentRename);

                // Load Relations
                //
                relations = new ArrayList();

                Type componentType = typeof(System.ComponentModel.Component);
            // Reload relations if loading fails
            StartLoadRelation:
                try
                {
                    foreach (IComponent comp in designerHost.Container.Components)
                    {
                        string src = comp.ToString();
                        if (src.IndexOf(' ') != -1)
                        {
                            src = src.Substring(0, src.IndexOf(' '));
                        }
                        Control source = GetViewedControl(src);
                        if (source == null)
                        {
                            continue;
                        }

                        Type t = comp.GetType();
                        PropertyInfo[] properties = t.GetProperties();
                        foreach (PropertyInfo property in properties)
                        {
                            // A property can be System.Object-Type that have relation with other component
                            // Such as ComboBox.DataSource
                            //
                            //if (property.PropertyType.GetInterface("System.ComponentModel.IComponent") == null)
                            //{
                            //    continue;
                            //}

                            // To filter properties such as TextBox.Text
                            if (property.PropertyType.FullName == "System.String")
                            {
                                continue;
                            }

                            // To filter collections properties
                            if (property.PropertyType.GetInterface("System.Collections.ICollection") != null)
                            {
                                continue;
                            }

                            if (!property.CanWrite)
                            {
                                continue;
                            }

                            MethodInfo mi = property.GetGetMethod();
                            //// To filter write-only properties
                            //if (mi == null)
                            //{
                            //    continue;
                            //}

                            // To filter indexer perperties
                            if (mi.GetParameters().GetLength(0) != 0)
                            {
                                continue;
                            }

                            // To filter properties with no value
                            if (property.GetValue(comp, null) == null)
                            {
                                continue;
                            }

                            // To filter Connection Properties
                            if (property.GetValue(comp, null) is System.Data.IDbConnection)
                            {
                                continue;
                            }

                            string dst = property.GetValue(comp, null).ToString();
                            if (dst.IndexOf(' ') != -1)
                            {
                                dst = dst.Substring(0, dst.IndexOf(' '));
                            }

                            if (src == dst)
                            {
                                continue;
                            }

                            Control destination = GetViewedControl(dst);
                            if (source != null && destination != null)
                            {
                                relations.Add(new Relation(this, src, dst));
                            }
                        }
                        // A special case for InfoTransaction
                        //if (comp is InfoTransaction)
                        //{
                        //    InfoTransaction infoTrans = comp as InfoTransaction;
                        //    foreach (Transaction trans in infoTrans.Transactions)
                        //    {
                        //        if (trans.AutoNumber != null && trans.AutoNumber.Site != null)
                        //        {
                        //            string dst = trans.AutoNumber.Site.Name;
                        //            if (dst.IndexOf(' ') != -1)
                        //            {
                        //                dst = dst.Substring(0, dst.IndexOf(' '));
                        //            }
                        //            Control destination = GetViewedControl(dst);
                        //            if (destination != null)
                        //            {
                        //                relations.Add(new Relation(this, src, dst));
                        //            }
                        //        }
                        //    }
                        //}
                    }
                }
                catch
                {
                    relations.Clear();
                    goto StartLoadRelation;
                }

                view.Refresh();
            }
            catch (Exception err)
            {
                language = CliUtils.fClientLang;
                string sMess = SysMsg.GetSystemMessage(language, ThisModuleName, ThisComponentName, "msg_Exception");
                MessageBox.Show(string.Format(sMess, ThisComponentName, "ViewOperation", err.Message));
            }
        }
Exemplo n.º 16
0
 public static void ResumeDrawing(Control parent)
 {
     NativeWinApi.SendMessage(parent.Handle, NativeWinApi.Messages.WM_SETREDRAW, new IntPtr(1), IntPtr.Zero);
     parent.Refresh();
 }
Exemplo n.º 17
0
		/// <summary>
		/// Start() combines Print() and Save() to do all of the work
		/// </summary>
		/// <param name="Ctrl">Control (form or other) that is to be printed or saved</param>
		/// <param name="bPrint">Desides whether to print (true) or save (false)</param>
		/// <param name="fImage">System.Drawing.Imaging.ImageFormat by which the bitmap
		/// has to be saved (printing uses png format as standard)</param>
		/// <param name="f8bitPixel">decides how to convert bitmap to 8 bit ColorDepth</param>
		/// <param name="sPrinterName">the name of the printer that is to be used</param>
		/// <param name="aMargins">the page margins that are to be used</param>
		/// <param name="bPortrait">Printing as portrait (true) or landscape (false)</param>
		/// <param name="sFileName">String with the complete filename to which the bitmap
		/// is to be saved (used only if bPrint == true)</param>
		private static void Start(Control Ctrl, bool bPrint,
				//	formatings
				ImageFormat fImage, ColorDepthReduction f8bitPixel, 
				//  additional parameters for printing
				string sPrinterName, Margins aMargins, bool bPortrait,
				//  additional parameter for saving
				string sFileName
			)
		{

			//  add required standard parameters if necessary
			if (fImage == null)
				fImage = ImageFormat.Png;
			if (bPrint) {
				if (sPrinterName == null)
					sPrinterName = "";
				//  orientation and margins are set to the printer standard automatically
			} else {
				#region NET 2.0 a shorter way to check string.IsNullOrEmpty(sFileName)
				//  NET 2.0 - you can use next 'if'-query as follows:
				//      if (String.IsNullOrEmpty(sFileName))
				//      pay attention: String.IsNullOrEmpty() is new in NET 2.0
				//  NET 1.1 - you must use next 'if'-query as follows:
				//      if ((sFileName == null) || (sFileName == ""))
				#endregion
				//  no filename => user's folder, control's name, imageformat as extension
				if ((sFileName == null) || (sFileName == "")) {
					sFileName = System.IO.Path.Combine(
						Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
						Ctrl.Name + "." + fImage.ToString() );
				}
			}

			//  check possible errors, otherwise execute
			if (Ctrl == null) 	//  reserved for further checks
			{
				if (Ctrl == null)
					MessageBox.Show("Control is not defined", "FormPrint.Start");
				else
					MessageBox.Show("Any other error", "FormPrint.Start");
			} else {
				//  create the private formprint class cls
				cls = new FormPrint(Ctrl, bPrint, fImage, f8bitPixel, 
					sPrinterName, aMargins,  bPortrait, sFileName);
				//  execute the required printing resp. saving method
				try {
					if (bPrint) {
						cls.StartPrinting();
					} else {
						cls.StartSaving();
					}
				} finally {
					//  free resources
					cls.bmp.Dispose();
					cls.bmp = null;
					//  in some situations, the next command is useful
					Ctrl.Refresh();
				}
			}
		}
 public static void ResumeDrawing(Control parent)
 {
     SendMessage(parent.Handle, WM_SETREDRAW, true, 0);
     parent.Refresh();
 }
Exemplo n.º 19
0
 protected void CrossThreadRefresh(Control c)
 {
     if (this.InvokeRequired)
     {
         CrossThreadRefreshDelegate d = new CrossThreadRefreshDelegate(this.CrossThreadRefresh);
         this.Invoke(d, new Object[] { c });
     }
     else
     {
         c.Refresh();
     }
 }
Exemplo n.º 20
0
 private void FlashControl(Control control, Color color)
 {
     Color prevColor = control.BackColor;
     try
     {
         control.BackColor = color;
         control.Refresh();
         Thread.Sleep(25);
     }
     finally
     {
         control.BackColor = prevColor;
         control.Refresh();
     }
 }
        private void UpdateControl(Control ctrl)
        {
            if (ctrl == null)
            {
                return;
            }

            IMetroControl metroControl = ctrl as IMetroControl;
            if (metroControl != null)
            {
                ApplyTheme(metroControl);
            }

            IMetroComponent metroComponent = ctrl as IMetroComponent;
            if (metroComponent != null)
            {
                ApplyTheme(metroComponent);
            }

            TabControl tabControl = ctrl as TabControl;
            if (tabControl != null)
            {
                foreach (TabPage tp in ((TabControl)ctrl).TabPages)
                {
                    UpdateControl(tp);
                }
            }

            if (ctrl.Controls != null)
            {
                foreach (Control child in ctrl.Controls)
                {
                    UpdateControl(child);
                }
            }

            if (ctrl.ContextMenuStrip != null)
            {
                UpdateControl(ctrl.ContextMenuStrip);
            }

            ctrl.Refresh();
        }
Exemplo n.º 22
0
 /// <summary>
 /// 恢复控件刷新
 /// </summary>
 /// <param name="yourCtr">your Control</param>
 public static void SetControlUnfreeze(System.Windows.Forms.Control yourCtr)
 {
     UnsafeNativeMethods.SendMessage(yourCtr.Handle, WM_SETREDRAW, 1, IntPtr.Zero);
     yourCtr.Refresh();
 }
Exemplo n.º 23
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");
		}
Exemplo n.º 24
0
 public static void ResumeDrawing(System.Windows.Forms.Control parent)
 {
     SendMessage(parent.Handle, WM_SETREDRAW, true, 0);
     parent.Refresh();
 }
Exemplo n.º 25
0
 public static void ResumeDrawing(System.Windows.Forms.Control control)
 {
     SendMessage(control.Handle, WM_SETSalmonRAW, true, 0);
     control.Refresh();
 }
Exemplo n.º 26
0
 protected virtual void Invalidate(Control containerControl)
 {
     if (this.DesignMode)
     {
         if (containerControl is Form && !(containerControl is RadialMenuPopup))
         {
             if (IsHandleValid(containerControl))
                 InvalidateFormCaption(containerControl);
             containerControl.Refresh();
         }
         else
         {
             if (containerControl.InvokeRequired)
                 containerControl.BeginInvoke(new MethodInvoker(delegate { containerControl.Invalidate(); }));
             else
                 containerControl.Invalidate();
         }
     }
     else
     {
         if (containerControl is Form && !(containerControl is RadialMenuPopup))
         {
             if (IsHandleValid(containerControl))
                 InvalidateFormCaption(containerControl);
         }
         else
         {
             if (containerControl.InvokeRequired)
                 containerControl.BeginInvoke(new MethodInvoker(delegate { containerControl.Invalidate(GetInvalidateBounds(), true); }));
             else
                 containerControl.Invalidate(GetInvalidateBounds(), true);
         }
     }
 }
Exemplo n.º 27
0
 public static void ResumeDrawing(Control parent)
 {
     SendMessage(parent.Handle, (uint)WM_SETREDRAW, (System.UIntPtr)1, (System.IntPtr)0);
     parent.Refresh();
 }
    private static void ResumeDrawing(Control target, bool redraw)
    {
      SendMessage(target.Handle, WM_SETREDRAW, 1, 0);

      if (redraw)
      {
        target.Refresh();
      }
    }
Exemplo n.º 29
0
 public static void ResumePainting(Control control)
 {
     if (!control.IsDisposed)
     {
         SendMessage(control.Handle, WM_SETREDRAW, 1, 0);
         control.Refresh();
     }
 }
Exemplo n.º 30
0
 private void ForceRefresh(Control c)
 {
     c.Invalidate();
     c.Update();
     c.Refresh();
 }
Exemplo n.º 31
0
 public void _control_SizeChanged(object sender, EventArgs e)
 {
     initSize();
     backControl.Refresh();
 }
Exemplo n.º 32
0
		public void PubMethodTest7()
		{
			Control r1 = new Control();
			r1.RightToLeft = RightToLeft.Yes ;
			r1.ResetRightToLeft() ;
			Assert.AreEqual(RightToLeft.No , r1.RightToLeft , "#81");
			r1.ImeMode = ImeMode.Off ;
			r1.ResetImeMode () ;
			Assert.AreEqual(ImeMode.NoControl , r1.ImeMode , "#82");
			r1.ForeColor= SystemColors.GrayText ;
			r1.ResetForeColor() ;
			Assert.AreEqual(SystemColors.ControlText , r1.ForeColor , "#83");
			//r1.Font = Font.FromHdc();
			r1.ResetFont () ;
			//Assert.AreEqual(FontFamily.GenericSansSerif , r1.Font , "#83");
			r1.Cursor = Cursors.Hand ;
			r1.ResetCursor () ;
			Assert.AreEqual(Cursors.Default , r1.Cursor , "#83");
			//r1.DataBindings = System.Windows.Forms.Binding ;
			//r1.ResetBindings() ;
			//Assert.AreEqual(ControlBindingsCollection , r1.DataBindings  , "#83");
			r1.BackColor = Color.Black ;
			r1.ResetBackColor() ;
			Assert.AreEqual( SystemColors.Control , r1.BackColor  , "#84");
			r1.BackColor = Color.Black ;
			r1.Refresh() ;
			Assert.AreEqual( null , r1.Region , "#85");
			Rectangle M = new Rectangle(10, 20, 30 ,40);
			r1.RectangleToScreen(M) ;
			Assert.AreEqual( null , r1.Region , "#86");
		}
Exemplo n.º 33
0
        private void RefreshPanel(Control pictureBox)
        {
            ((PictureBox)pictureBox).Image = bitmap;
            if (pictureBox.InvokeRequired)
            {

                SetControlValueCallback d = new SetControlValueCallback(RefreshPanel);
                pictureBox.Invoke(d, new object[] { pictureBox });

            }
            else
            {

                pictureBox.Refresh();
            }
            //pictureBox.Update();
        }
Exemplo n.º 34
0
 private static void DrawingChartInclude(string chartTitle, Control control, DataSet dataSet, ChartType chartType, int minNumber, int maxNumber, int scale, string unit)
 {
     if (control.Height < 230 || control.Width < 230)
     {
         Func.Msg("容器宽度或长度设置过小!(宽度和长度必须>=230)");
         return;
     }
     if (control.GetType().Name.Equals("Form") || control.GetType().Name.Equals("TabPage") || control.GetType().Name.Equals("GroupBox") || control.GetType().Name.Equals("Panel"))
     {
         for (int i = 0; i < chart.Count; i++)
         {
             if (control == (Control)chart[i].crtObj)
             {
                 chart.RemoveChart(i);
                 break;
             }
         }
         chart.AddChart(chartTitle, control, chartType, dataSet, minNumber, maxNumber, scale, unit);
         control.Paint += new PaintEventHandler(control_Paint);
         control.Disposed += new EventHandler(control_Disposed);
         control.Refresh();
     }
     else
     {
         Func.Msg("该容器不是Form,TabPage,GroupBox,Panel类型!");
         return;
     }
 }
Exemplo n.º 35
0
 /// <summary>
 /// Invoke方式刷新控件
 /// </summary>
 public static void InvokeRefresh(Control control)
 {
     if (control.InvokeRequired)
     {
         control.Invoke(new MethodInvoker(delegate() { InvokeRefresh(control); }));
     }
     else
     {
         control.Refresh();
     }
 }
Exemplo n.º 36
0
 private void setTextAndRefresh(System.Windows.Forms.Control ctrl, string txt)
 {
     ctrl.Text = txt;
     ctrl.Refresh();
 }
Exemplo n.º 37
0
 public static void ResumeDrawing(Control c) {
     SendMessage(c.Handle, WM_SETREDRAW, true, 0);
     c.Refresh();
 }
Exemplo n.º 38
0
 public static void ResumeDrawing(Control control)
 {
     Native.SendMessage(control.Handle, (uint) Native.Message.WM_SETREDRAW, new IntPtr(1), IntPtr.Zero);
     control.Refresh();
 }