当前位置: 首页>>代码示例>>C#>>正文


C# Control.Refresh方法代码示例

本文整理汇总了C#中System.Windows.Forms.Control.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# Control.Refresh方法的具体用法?C# Control.Refresh怎么用?C# Control.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Control的用法示例。


在下文中一共展示了Control.Refresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResumeDrawing

        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;
            }
        }
开发者ID:wshanshan,项目名称:DDD,代码行数:25,代码来源:DrawingUtility.cs

示例2: ResumeDrawing

        private static void ResumeDrawing(Control parent)
        {
            parent.ResumeLayout();
            SendMessage(parent.Handle, WM_SETREDRAW, true, 0);

            // Force redraw of control now
            parent.Refresh();
        }
开发者ID:rjch-au,项目名称:WSUSAdminAssistant,代码行数:8,代码来源:frmMain.cs

示例3: PositionStickControl

        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();
        }
开发者ID:danielZhangZhen,项目名称:XInputDotNet,代码行数:8,代码来源:MainForm.cs

示例4: ResumeDrawing

 public static void ResumeDrawing(Control parent)
 {
     if (_suspended)
     {
         SendMessage(parent.Handle, WmSetredraw, true, 0);
         parent.Refresh();
         _suspended = false;
     }
 }
开发者ID:nijikilling,项目名称:ImaginationDatabase,代码行数:9,代码来源:RedrawControl.cs

示例5: DispatchStartAsync

 private static async Task DispatchStartAsync(Control control, Bitmap bitmap, byte []buffer)
 {
    
     control.Invoke(new Action(() =>
     {
         ProcessStart(bitmap, buffer);
         control.Refresh();
     }));
 }
开发者ID:itapi,项目名称:Hansha-Test,代码行数:9,代码来源:Form1.cs

示例6: RefreshControl

 public static void RefreshControl(Control i_Control)
 {
     if (i_Control.InvokeRequired)
     {
         i_Control.Invoke(new Action<Control>(RefreshControl), i_Control);
     }
     else
     {
         i_Control.Refresh();
     }
 }
开发者ID:rajeshwarn,项目名称:dp_ex4,代码行数:11,代码来源:Utils.cs

示例7: ResumeLogic

        /// <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();
            }
        }
开发者ID:xieguigang,项目名称:Reference_SharedLib,代码行数:17,代码来源:CustomControlsLogic.cs

示例8: DispatchDeltaAsync

        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();
            }));
        }
开发者ID:Deathspike,项目名称:Hansha,代码行数:13,代码来源:TestProtocolCore.cs

示例9: FlashControl

 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();
     }
 }
开发者ID:zildjohn01,项目名称:Polyriser,代码行数:20,代码来源:App.cs

示例10: ResumePainting

 public static void ResumePainting(Control control)
 {
     if (!control.IsDisposed)
     {
         SendMessage(control.Handle, WM_SETREDRAW, 1, 0);
         control.Refresh();
     }
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:8,代码来源:Utility.cs

示例11: ResumeDrawing

 public static void ResumeDrawing(Control parent)
 {
     NativeWinApi.SendMessage(parent.Handle, NativeWinApi.Messages.WM_SETREDRAW, new IntPtr(1), IntPtr.Zero);
     parent.Refresh();
 }
开发者ID:phillipwei,项目名称:Tracking.Self,代码行数:5,代码来源:WinApi.cs

示例12: ResumeDrawing

 public static void ResumeDrawing(Control parent)
 {
     SendMessage(parent.Handle, (uint)WM_SETREDRAW, (System.UIntPtr)1, (System.IntPtr)0);
     parent.Refresh();
 }
开发者ID:kukareka,项目名称:printbox,代码行数:5,代码来源:WinApi.cs

示例13: Start

		/// <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();
				}
			}
		}
开发者ID:CooLMoRTaL,项目名称:VEUserControl,代码行数:73,代码来源:FormPrint.cs

示例14: TestPublicMethods

		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");
//.........这里部分代码省略.........
开发者ID:nlhepler,项目名称:mono,代码行数:101,代码来源:ControlHandleTest.cs

示例15: BlinkControl

 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);
     }
 }
开发者ID:leopacman,项目名称:MyTvShowOrganizer,代码行数:13,代码来源:Form1_Main.cs


注:本文中的System.Windows.Forms.Control.Refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。