本文整理汇总了C#中System.Windows.UIElement类的典型用法代码示例。如果您正苦于以下问题:C# UIElement类的具体用法?C# UIElement怎么用?C# UIElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIElement类属于System.Windows命名空间,在下文中一共展示了UIElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HelpAdorner
public HelpAdorner(UIElement element)
: base(element)
{
this.MouseEnter += HelpAdorner_MouseEnter;
this.MouseLeave += HelpAdorner_MouseLeave;
this.MouseDown += HelpAdorner_MouseDown;
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:7,代码来源:HelpAdorner.cs
示例2: DropTargetAdorner
protected DropTargetAdorner(UIElement adornedElement)
: base(adornedElement)
{
_adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement);
_adornerLayer.Add(this);
IsHitTestVisible = false;
}
开发者ID:modulexcite,项目名称:LoreSoft.Shared,代码行数:7,代码来源:DropTargetAdorner.cs
示例3: StartAnimation
/// <summary>
/// Starts an animation to a particular value on the specified dependency property.
/// You can pass in an event handler to call when the animation has completed.
/// </summary>
public static void StartAnimation(UIElement animatableElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
{
double fromValue = (double)animatableElement.GetValue(dependencyProperty);
DoubleAnimation animation = new DoubleAnimation();
animation.From = fromValue;
animation.To = toValue;
animation.Duration = TimeSpan.FromSeconds(animationDurationSeconds);
animation.Completed += delegate(object sender, EventArgs e)
{
//
// When the animation has completed bake final value of the animation
// into the property.
//
animatableElement.SetValue(dependencyProperty, animatableElement.GetValue(dependencyProperty));
CancelAnimation(animatableElement, dependencyProperty);
if (completedEvent != null)
{
completedEvent(sender, e);
}
};
animation.Freeze();
animatableElement.BeginAnimation(dependencyProperty, animation);
}
开发者ID:modopotato,项目名称:LibnoiseDesigner,代码行数:32,代码来源:AnimationHelper.cs
示例4: RemoveCustomControl
public void RemoveCustomControl(UIElement control)
{
_customControlSurface.RemoveControl(control);
var customControlInfo = _customControls.FirstOrDefault(it => it.Control == control);
if (customControlInfo != null)
_customControls.Remove(customControlInfo);
}
开发者ID:Bruhankovi4,项目名称:Emotyper,代码行数:7,代码来源:CustomControlManager.cs
示例5: AdornerCursorCoordinateDrawer
// ********************************************************************
// Public Methods
// ********************************************************************
#region Public Methods
/// <summary>
/// Constructor. Initializes class fields.
/// </summary>
public AdornerCursorCoordinateDrawer(XYLineChart xyLineChart, UIElement adornedElement, MatrixTransform shapeTransform)
: base(adornedElement)
{
elementTransform = shapeTransform;
IsHitTestVisible = false;
this.xyLineChart = xyLineChart;
}
开发者ID:anddudek,项目名称:anjlab.fx,代码行数:15,代码来源:AdornerCursorCoordinateDrawer.cs
示例6: GetPosition
public static Point GetPosition(RoutedEventArgs args, UIElement relativeTo)
{
if (args is MouseEventArgs)
{
return ((MouseEventArgs) args).GetPosition(relativeTo);
}
if (args is ManipulationDeltaEventArgs)
{
var manipulationDeltaEventArg = args as ManipulationDeltaEventArgs;
return
UIElementEx.C1TransformToVisual(manipulationDeltaEventArg.ManipulationContainer as UIElement, relativeTo)
.Transform(manipulationDeltaEventArg.ManipulationOrigin);
}
if (args is ManipulationStartedEventArgs)
{
var manipulationStartedEventArg = args as ManipulationStartedEventArgs;
return
UIElementEx.C1TransformToVisual(manipulationStartedEventArg.ManipulationContainer as UIElement, relativeTo)
.Transform(manipulationStartedEventArg.ManipulationOrigin);
}
if (!(args is TouchEventArgs) || relativeTo != null && relativeTo == null)
{
return new Point();
}
return ((TouchEventArgs) args).GetTouchPoint(relativeTo).Position;
}
开发者ID:mdjabirov,项目名称:C1Decompiled,代码行数:26,代码来源:C1InputEventArgs.cs
示例7: AdornerChartMarkers
public AdornerChartMarkers(UIElement adornedElement, Transform shapeTransform, IList<ChartMarkerSet> markerSets, XYLineChart parentChart) : base(adornedElement)
{
_adornedElement = adornedElement;
_parentChart = parentChart;
_markerSets = markerSets;
_transform = shapeTransform;
}
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:7,代码来源:AdornerChartMarkers.cs
示例8: DragAdorner
public DragAdorner(UIElement owner, UIElement adornElement, bool useVisualBrush, double opacity)
: base(owner)
{
this.owner = owner;
if (useVisualBrush)
{
VisualBrush brush = new VisualBrush(adornElement);
Rectangle rect = new Rectangle();
brush.Opacity = opacity;
rect.RadiusX = 3;
rect.RadiusY = 3;
rect.Width = adornElement.DesiredSize.Width;
rect.Height = adornElement.DesiredSize.Height;
this.XCenter = adornElement.DesiredSize.Width / 2;
this.YCenter = adornElement.DesiredSize.Height / 2;
rect.Fill = brush;
this.child = rect;
}
else
{
this.child = adornElement;
}
}
开发者ID:cipjota,项目名称:Chronos,代码行数:28,代码来源:DragAdorner.cs
示例9: CreateCursor
public static Cursor CreateCursor(UIElement element, int xHotSpot,
int yHotSpot)
{
element.Measure(new Size(double.PositiveInfinity,
double.PositiveInfinity));
element.Arrange(new Rect(0, 0, element.DesiredSize.Width,
element.DesiredSize.Height));
RenderTargetBitmap rtb =
new RenderTargetBitmap((int)element.DesiredSize.Width,
(int)element.DesiredSize.Height, 96, 96, PixelFormats.Pbgra32);
rtb.Render(element);
PngBitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(rtb));
MemoryStream ms = new MemoryStream();
encoder.Save(ms);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
ms.Close();
ms.Dispose();
Cursor cur = InternalCreateCursor(bmp, xHotSpot, yHotSpot);
bmp.Dispose();
return cur;
}
开发者ID:heinzsack,项目名称:DEV,代码行数:30,代码来源:CursorHelper.cs
示例10: DragBehavior
public DragBehavior(UIElement element)
{
_element = element;
element.MouseLeftButtonDown += OnMouseButtonDown;
element.MouseLeftButtonUp += OnMouseButtonUp;
element.MouseMove += OnMouseMove;
}
开发者ID:alexander-karpov,项目名称:Shelter,代码行数:7,代码来源:DragBehavior.cs
示例11: ContentAdorner
public ContentAdorner(UIElement element, UIElement adornedElement)
: base(adornedElement)
{
_element = element;
AddLogicalChild(element);
AddVisualChild(element);
}
开发者ID:ivanglushchenko,项目名称:BetterWpfControls,代码行数:7,代码来源:ContentAdorner.cs
示例12: GetJpgImage
/// <summary>
/// </summary>
/// <param name="source"> </param>
/// <param name="scale"> </param>
/// <param name="quality"> </param>
/// <returns> </returns>
public static byte[] GetJpgImage(UIElement source, double scale, int quality)
{
var actualHeight = source.RenderSize.Height;
var actualWidth = source.RenderSize.Width;
var renderHeight = actualHeight * scale;
var renderWidth = actualWidth * scale;
var renderTarget = new RenderTargetBitmap((int) renderWidth, (int) renderHeight, 96, 96, PixelFormats.Pbgra32);
var sourceBrush = new VisualBrush(source);
var drawingVisual = new DrawingVisual();
var drawingContext = drawingVisual.RenderOpen();
using (drawingContext)
{
drawingContext.PushTransform(new ScaleTransform(scale, scale));
drawingContext.DrawRectangle(sourceBrush, null, new Rect(new Point(0, 0), new Point(actualWidth, actualHeight)));
}
renderTarget.Render(drawingVisual);
var jpgEncoder = new JpegBitmapEncoder
{
QualityLevel = quality
};
jpgEncoder.Frames.Add(BitmapFrame.Create(renderTarget));
Byte[] imageArray;
using (var outputStream = new MemoryStream())
{
jpgEncoder.Save(outputStream);
imageArray = outputStream.ToArray();
}
return imageArray;
}
开发者ID:Yaguar666,项目名称:ffxivapp-common,代码行数:35,代码来源:ScreenCapture.cs
示例13: Initialize
public void Initialize(UIElement element)
{
_element = element;
element.MouseLeftButtonDown += MouseLeftButtonDown;
element.MouseLeftButtonUp += MouseLeftButtonUp;
element.MouseMove += MouseMove;
}
开发者ID:petriw,项目名称:Balder,代码行数:7,代码来源:MouseDevice.cs
示例14: SendToUIThread
private void SendToUIThread(UIElement element, string text)
{
element.Dispatcher.BeginInvoke(
new Action(() => { SendKeys.Send(text); }),
DispatcherPriority.Input
);
}
开发者ID:haozhouxu,项目名称:WorkVS2015,代码行数:7,代码来源:test.xaml.cs
示例15: SizeChangedInfo
/// <summary>
/// Initializes a new instance of the SizeChangedinfo class.
/// </summary>
/// <param name="element">
/// The element which size is changing.
/// </param>
/// <param name="previousSize">
/// The size of the object before update. New size is element.RenderSize
/// </param>
/// <param name="widthChanged">
/// The flag indicating that width component of the size changed. Note that due to double math
/// effects, the it may be (previousSize.Width != newSize.Width) and widthChanged = true.
/// This may happen in layout when sizes of objects are fluctuating because of a precision "jitter" of
/// the input parameters, but the overall scene is considered to be "the same" so no visible changes
/// will be detected. Typically, the handler of SizeChangedEvent should check this bit to avoid
/// invalidation of layout if the dimension didn't change.
/// </param>
/// <param name="heightChanged">
/// The flag indicating that height component of the size changed. Note that due to double math
/// effects, the it may be (previousSize.Height != newSize.Height) and heightChanged = true.
/// This may happen in layout when sizes of objects are fluctuating because of a precision "jitter" of
/// the input parameters, but the overall scene is considered to be "the same" so no visible changes
/// will be detected. Typically, the handler of SizeChangedEvent should check this bit to avoid
/// invalidation of layout if the dimension didn't change.
/// </param>
public SizeChangedInfo(UIElement element, Size previousSize, bool widthChanged, bool heightChanged)
{
_element = element;
_previousSize = previousSize;
_widthChanged = widthChanged;
_heightChanged = heightChanged;
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:32,代码来源:SizeChangedInfo.cs
示例16: Draggable
public Draggable(UIElement uiElement, object context)
{
_uiElement = uiElement;
_context = context;
uiElement.PreviewMouseDown += UiElementPreviewMouseDown;
uiElement.PreviewMouseUp += UiElementOnPreviewMouseUp;
}
开发者ID:ndikiy,项目名称:NDragDrop,代码行数:7,代码来源:Draggable.cs
示例17: drag_Rotate_Started
private void drag_Rotate_Started(DragListener drag)
{
var designerItem = this.ExtendedItem.Component as FrameworkElement;
this.parent = VisualTreeHelper.GetParent(designerItem) as UIElement;
this.centerPoint = designerItem.TranslatePoint(
new Point(designerItem.ActualWidth*designerItem.RenderTransformOrigin.X,
designerItem.ActualHeight*designerItem.RenderTransformOrigin.Y),
this.parent);
Point startPoint = Mouse.GetPosition(this.parent);
this.startVector = Point.Subtract(startPoint, this.centerPoint);
if (this.rotateTransform == null)
{
this.initialAngle = 0;
}
else
{
this.initialAngle = this.rotateTransform.Angle;
}
rtTransform = this.ExtendedItem.Properties[FrameworkElement.RenderTransformProperty].Value;
operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
}
开发者ID:QIWEB,项目名称:SharpDevelop,代码行数:25,代码来源:RotateThumbExtension.cs
示例18: TemplateAdorner
/// <summary>
/// Initializes a new instance of the <see cref="TemplateAdorner"/> class
/// </summary>
/// <param name="adornedElement">The adorned element</param>
/// <param name="frameworkElementAdorner">The framework element of the adorner</param>
public TemplateAdorner(UIElement adornedElement, FrameworkElement frameworkElementAdorner)
: base(adornedElement)
{
this.frameworkElementAdorner = frameworkElementAdorner;
this.AddVisualChild(frameworkElementAdorner);
this.AddLogicalChild(frameworkElementAdorner);
}
开发者ID:ruisebastiao,项目名称:DragSnap,代码行数:12,代码来源:TemplateAdorner.cs
示例19: UIElementAdorner
/// <summary>
///
/// </summary>
/// <param name="element"></param>
/// <param name="direction"></param>
public UIElementAdorner(UIElement element, UIElement child)
: base(element)
{
this.child = child;
AddLogicalChild(child);
AddVisualChild(child);
}
开发者ID:sbtj,项目名称:OssMetroClient,代码行数:12,代码来源:UIElementAdorner.cs
示例20: Add
public static PossibleErrorAdorner Add(UIElement element)
{
PossibleErrorAdorner result = null;
AdornerLayer al = AdornerLayer.GetAdornerLayer(element);
if (al != null)
{
Adorner[] adorners = al.GetAdorners(element);
if (adorners != null && adorners.Length != 0)
{
foreach (Adorner a in adorners)
{
if (a is PossibleErrorAdorner)
{
result = a as PossibleErrorAdorner;
break;
}
}
}
if (result == null)
{
result = new PossibleErrorAdorner(element);
al.Add(result);
}
}
return result;
}
开发者ID:matejo,项目名称:PersonalTimeReport,代码行数:28,代码来源:PossibleErrorAdorner.cs
注:本文中的System.Windows.UIElement类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论