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


C# Controls.Control类代码示例

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


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

示例1: GetIsSendingMouseWheelEventToParent

        /// <summary>
        /// Gets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
        /// </summary>
        /// <param name="control">
        /// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be retrieved.
        /// </param>
        /// <returns>
        /// The IsSendingMouseWheelEventToParent, or <see langword="null"/>
        /// if no IsSendingMouseWheelEventToParent has been set.
        /// </returns>
        public static bool? GetIsSendingMouseWheelEventToParent(Control control)
        {
            if (control == null)
                throw new ArgumentNullException("");

            return control.GetValue(ScrollProperty) as bool?;
        }
开发者ID:Nimgoble,项目名称:Jibbr,代码行数:17,代码来源:BubbleScrolling.cs

示例2: TemplatedAdorner

 /// <summary>
 /// Initializes a new instance of the <see cref="TemplatedAdorner"/> class.
 /// </summary>
 /// <param name="adornedElement">The adorned element.</param>
 /// <param name="dataContext">The data context.</param>
 /// <param name="adornerTemplate">The adorner template.</param>
 public TemplatedAdorner(UIElement adornedElement, object dataContext, ControlTemplate adornerTemplate)
     : base(adornedElement)
 {
     _child = new Control {Template = adornerTemplate};
     DataContext = dataContext;
     AddVisualChild(_child);
 }
开发者ID:PaulStovell,项目名称:bindable,代码行数:13,代码来源:TemplatedAdorner.cs

示例3: Activate

		public void Activate(Control Container) {
			Container.ContextMenu = this;
			Container.ContextMenu.IsEnabled = true;
			Container.ContextMenu.PlacementTarget = Container;
			Container.ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
			Container.ContextMenu.IsOpen = true;
		}
开发者ID:Gainedge,项目名称:BetterExplorer,代码行数:7,代码来源:FilterMenu_Strings.cs

示例4: GetCulture

        /// <summary>
        /// Gets spell checking culture of the specified control.
        /// </summary>
        /// <param name="control">
        /// The control.
        /// </param>
        /// <returns>
        /// The spell checking culture.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="control"/> parameter is null.
        /// </exception>
        public static CultureInfo GetCulture(Control control)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            return (CultureInfo)control.GetValue(CultureProperty);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:19,代码来源:SpellCheck.cs

示例5: Verify

		public static void Verify(Control control)
		{
			using (addAdditionalInfo())
			{
				Approvals.Verify(new ImageWriter(f => WpfUtils.ScreenCapture(control, f)));
			}
		}
开发者ID:staxmanade,项目名称:ApprovalTests.Net,代码行数:7,代码来源:WpfApprovals.cs

示例6: CreateViewModel

    /// <summary>
    /// Create viewmodel objects for each view.
    /// </summary>
    public object CreateViewModel(Control control, string queryString)
    {
      object result = null;

      if (control is WpUI.MainPage)
        result = App.ViewModel.MainPageViewModel;
      
      else if (control is Views.Login)
        result = new ViewModels.Login();
      
      else if (control is Views.ProjectDetails)
        result = new ViewModels.ProjectDetail(queryString);
      
      else if (control is Views.ProjectEdit)
        result = new ViewModels.ProjectEdit(queryString);
      
      else if (control is Views.ResourceDetails)
        result = new ViewModels.ResourceDetail(queryString);
      
      else if (control is Views.ResourceEdit)
        result = new ViewModels.ResourceEdit(queryString);
      
      else if (control is Views.RoleListEdit)
        result = new ViewModels.RoleListEdit();

      else
        result = ((NavigationShell)Bxf.Shell.Instance).PendingView.Model;

      ((NavigationShell)Bxf.Shell.Instance).PendingView = null;

      return result;
    }
开发者ID:BiYiTuan,项目名称:csla,代码行数:35,代码来源:ViewModelFactory.cs

示例7: Run

        public override void Run(
            IAnimationContext context,
            Control control,
            TimeSpan duration,
            Action<Control> endMethod)
        {
            var storyboard = new Storyboard();

            DoubleAnimation fadeAnimation;

            if ( rounds > 1 )
            {
                fadeAnimation = new DoubleAnimation( startOpacity, endOpacity, new Duration( duration ) );
                fadeAnimation.AutoReverse = true;
                fadeAnimation.RepeatBehavior = new RepeatBehavior( rounds - 1 );
                storyboard.Children.Add( fadeAnimation );
                Storyboard.SetTarget( fadeAnimation, control );
                Storyboard.SetTargetProperty( fadeAnimation, new PropertyPath( UIElement.OpacityProperty ) );
            }

            fadeAnimation = new DoubleAnimation( startOpacity, endOpacity, new Duration( duration ) );
            fadeAnimation.BeginTime = TimeSpan.FromMilliseconds( duration.TotalMilliseconds * ( rounds - 1 ) * 2 );
            storyboard.Children.Add( fadeAnimation );
            Storyboard.SetTarget( fadeAnimation, control );
            Storyboard.SetTargetProperty( fadeAnimation, new PropertyPath( UIElement.OpacityProperty ) );

            if ( endMethod != null )
                storyboard.Completed += ( s, a ) => endMethod( control );
            storyboard.Begin( control );
        }
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:30,代码来源:FadeTransition.cs

示例8: TrySetText

        private static void TrySetText(Control element, string text)
        {
            var peer = FrameworkElementAutomationPeer.FromElement(element);
            var provider = peer == null ? null : peer.GetPattern(PatternInterface.Value) as IValueProvider;

            if (provider != null)
            {
                provider.SetValue(text);
            }
            else if (element is TextBox)
            {
                var textBox = element as TextBox;
                textBox.Text = text;
                textBox.SelectionStart = text.Length;
            }
            else if (element is PasswordBox)
            {
                var passwordBox = element as PasswordBox;
                passwordBox.Password = text;
            }
            else
            {
                throw new AutomationException("Element does not support SendKeys.", ResponseStatus.UnknownError);
            }

            // TODO: new parameter - FocusState
            element.Focus();
        }
开发者ID:sleekweasel,项目名称:winphonedriver,代码行数:28,代码来源:ValueCommand.cs

示例9: ControlContainer

 /// <summary>
 /// Initializes a new instance of <see cref="ControlContainer"/> for specified <see cref="Control"/>.
 /// </summary>
 /// <param name="Control">Control</param>
 public ControlContainer(Control Control)
 {
     if (Control == null) {
         throw new ArgumentException("Control cannot be null");
     }
     this.Control = Control;
 }
开发者ID:GoldRenard,项目名称:DMOAdvancedLauncher,代码行数:11,代码来源:ControlContainer.cs

示例10: InitializeDialogPanel

		internal void InitializeDialogPanel(bool modal, Control focusControl)
		{
		lock (m_Lock)
		{
			InitializeDialogPanel(modal, focusControl, ApplicationEx.LayoutRoot/*parent*/);
		}
		}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例11: ResetStatus

 public void ResetStatus(Control[] textBoxes = null, Label[] labels = null)
 {
     if (_dispatcher.CheckAccess())
     {
         if (textBoxes != null)
         {
             foreach (Control t in textBoxes)
             {
                 if (t != null)
                     t.Background = new SolidColorBrush(Colors.White);
             }
         }
         if (textBoxes != null && labels != null)
         {
             foreach (Label t in labels)
             {
                 if (t != null)
                     t.Foreground = new SolidColorBrush(Colors.Black);
             }
         }
         if (_errorText != null)
             _errorText.Visibility = Visibility.Hidden;
         if (_statusText != null)
             _statusText.Visibility = Visibility.Hidden;
     }
     else
     {
         _dispatcher.Invoke(new Action(() => ResetStatus(textBoxes, labels)));
     }
 }
开发者ID:gwupe,项目名称:Gwupe,代码行数:30,代码来源:InputValidator.cs

示例12: ScreeenCaptureInStaThread

		public static string ScreeenCaptureInStaThread(string received, Control control)
		{
			Exception caught = null;
			var t = new Thread(() =>
			{
				try
				{
					ScreenCapture(control, received);
				}
				catch (Exception e)
				{
					caught = e;
				}
			});

			t.SetApartmentState(ApartmentState.STA); //Many WPF UI elements need to be created inside STA
			t.Start();
			t.Join();

			if (caught != null)
			{
				throw new Exception("Creating window failed.", caught);
			}

			return received;
		}
开发者ID:manuc66,项目名称:ApprovalTests.Net,代码行数:26,代码来源:WpfUtils.cs

示例13: SetIsSendingMouseWheelEventToParent

        /// <summary>
        /// Sets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
        /// </summary>
        /// <param name="control">
        /// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be set.
        /// </param>
        /// <param name="IsSendingMouseWheelEventToParent">
        /// The IsSendingMouseWheelEventToParent to set, or <see langword="null"/>
        /// to remove any existing IsSendingMouseWheelEventToParent from <paramref name="control"/>.
        /// </param>
        public static void SetIsSendingMouseWheelEventToParent(Control control, bool? sendToParent)
        {
            if (control == null)
                throw new ArgumentNullException("");

            control.SetValue(ScrollProperty, sendToParent);
        }
开发者ID:Nimgoble,项目名称:Jibbr,代码行数:17,代码来源:BubbleScrolling.cs

示例14: SetDefaultPageAttributes

        /// <summary>
        /// Ustawia domyślne właściwości kontrolek.
        /// </summary>
        /// <param name="page">Kontrolka.</param>
        /// <returns>Kontrolka wzbogacona o domyślne właściwości związane z wyświetlaniem na ekranie.</returns>
        protected Control SetDefaultPageAttributes(Control page)
        {
            page.Margin = new Thickness(0);
            page.Height = page.Width = double.NaN;

            return page;
        }
开发者ID:pyta,项目名称:SciepaNaGolde,代码行数:12,代码来源:PageBase.cs

示例15: getImageFromControl

        /// <summary>
        /// Convert any control to a PngBitmapEncoder
        /// </summary>
        /// <param name="controlToConvert">The control to convert to an ImageSource</param>
        /// <returns>The returned ImageSource of the controlToConvert</returns>
        private static PngBitmapEncoder getImageFromControl(Control controlToConvert)
        {
            // save current canvas transform
            Transform transform = controlToConvert.LayoutTransform;

            // get size of control
            Size sizeOfControl = new Size(controlToConvert.ActualWidth, controlToConvert.ActualHeight);
            // measure and arrange the control
            controlToConvert.Measure(sizeOfControl);
            // arrange the surface
            controlToConvert.Arrange(new Rect(sizeOfControl));

            // craete and render surface and push bitmap to it
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((Int32)sizeOfControl.Width, (Int32)sizeOfControl.Height, 96d, 96d, PixelFormats.Pbgra32);
            // now render surface to bitmap
            renderBitmap.Render(controlToConvert);
            
            // encode png data
            PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
            // puch rendered bitmap into it
            pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));

            // return encoder
            return pngEncoder;
        }
开发者ID:SomeGuyinIN,项目名称:hefnycopter,代码行数:30,代码来源:Control2ImageConverter.cs


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