本文整理汇总了C#中System.Windows类的典型用法代码示例。如果您正苦于以下问题:C# Windows类的具体用法?C# Windows怎么用?C# Windows使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Windows类属于System命名空间,在下文中一共展示了Windows类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerpendicularLine
public static WPFMEDIA.LineGeometry PerpendicularLine(WPF.Point StartPoint, WPF.Point EndPoint, double Length)
{
//Get Current Angle Don't need the actual angle, radians is fine.
double angle = CurrentAngle(StartPoint, EndPoint);
double radians = Math.Atan2(StartPoint.Y - EndPoint.Y, StartPoint.X - EndPoint.X);
//Take 90 deg
double newAngle = angle + 90;
double newRadians = radians + Math.PI / 2;
//need to determine the shift.
double shiftX = Length * Math.Cos(newRadians);
//double shiftX2 = Length * Math.Cos(newAngle * Math.PI / 180);
double shiftY = Length * Math.Sin(newRadians);
double newStartPointX = StartPoint.X - shiftX;
double newStartPointY = StartPoint.Y - shiftY;
double newEndPointX = StartPoint.X + shiftX;
double newEndPointY = StartPoint.Y + shiftY;
WPF.Point newStartPoint = new WPF.Point(newStartPointX, newStartPointY);
WPF.Point newEndPoint = new WPF.Point(newEndPointX, newEndPointY);
//get the second point
//draw line from center of the point.
WPFMEDIA.LineGeometry newLine = new System.Windows.Media.LineGeometry(newStartPoint, newEndPoint);
return newLine;
}
示例2: Line
//Can be more complex later.
public static WPFMEDIA.LineGeometry Line(WPF.Point StartPoint, WPF.Point EndPoint)
{
WPFMEDIA.LineGeometry newLine = new System.Windows.Media.LineGeometry(StartPoint, EndPoint);
return newLine;
}
示例3: Rect
public Rect (SW.Rect rect)
{
x = rect.X;
y = rect.Y;
width = rect.Width;
height = rect.Height;
}
示例4: MARGINS
/// <summary>
/// Initializes a new instance of the MARGINS struct
/// </summary>
/// <param name="t">
/// The supplied thickness
/// </param>
public MARGINS (sw.Thickness t)
{
this.Left = (int)t.Left;
this.Right = (int)t.Right;
this.Top = (int)t.Top;
this.Bottom = (int)t.Bottom;
}
示例5: GetSize
public static Size GetSize (sw.FrameworkElement element)
{
if (!double.IsNaN(element.ActualWidth) && !double.IsNaN(element.ActualHeight))
return new Size ((int)element.ActualWidth, (int)element.ActualHeight);
else
return new Size ((int)(double.IsNaN(element.Width) ? -1 : element.Width), (int)(double.IsNaN(element.Height) ? -1 : element.Height));
}
示例6: InDesignMode
public bool? InDesignMode()
{
#if SILVERLIGHT
if (Application.Current.RootVisual != null) {
return System.ComponentModel.DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual);
}
return false;
#elif NETFX_CORE
return DesignMode.DesignModeEnabled;
#else
var designEnvironments = new[] {
"BLEND.EXE",
"XDESPROC.EXE",
};
var entry = Assembly.GetEntryAssembly();
if (entry != null) {
var exeName = (new FileInfo(entry.Location)).Name.ToUpperInvariant();
if (designEnvironments.Any(x => x.Contains(exeName))) {
return true;
}
}
return false;
#endif
}
示例7: ShowDesignerDialog
public static DialogResult ShowDesignerDialog(string title, Wpf.UIElement wpfContent, int width, int height)
{
DesignerDialog dlg = new DesignerDialog(title, wpfContent);
dlg.Width = width;
dlg.Height = height;
dlg.SizeGripStyle = SizeGripStyle.Hide;
return dlg.ShowDialog();
}
示例8: ConnectTo
void ConnectTo (sw.Point startPoint, bool startNewFigure = false)
{
if (startNewFigure || figure == null) {
figure = new swm.PathFigure ();
figure.StartPoint = startPoint;
figure.Segments = new swm.PathSegmentCollection ();
Control.Figures.Add (figure);
} else
figure.Segments.Add (new swm.LineSegment (startPoint, true));
}
示例9: ToXwtFontStretch
public static FontStretch ToXwtFontStretch(SW.FontStretch value)
{
// No, SW.FontStretches is not an enum
if (value == SW.FontStretches.UltraCondensed) return FontStretch.UltraCondensed;
if (value == SW.FontStretches.ExtraCondensed) return FontStretch.ExtraCondensed;
if (value == SW.FontStretches.Condensed) return FontStretch.Condensed;
if (value == SW.FontStretches.SemiCondensed) return FontStretch.SemiCondensed;
if (value == SW.FontStretches.SemiExpanded) return FontStretch.SemiExpanded;
if (value == SW.FontStretches.Expanded) return FontStretch.Expanded;
if (value == SW.FontStretches.ExtraExpanded) return FontStretch.ExtraExpanded;
if (value == SW.FontStretches.UltraExpanded) return FontStretch.UltraExpanded;
return FontStretch.Normal;
}
示例10: searchForAssembly
public bool? InUnitTestRunner()
{
var testAssemblies = new[] {
"CSUNIT",
"NUNIT",
"XUNIT",
"MBUNIT",
"NBEHAVE",
};
try {
return searchForAssembly(testAssemblies);
} catch (Exception) {
return null;
}
}
示例11: Button
public Button(List<Texture2D> textures, DotNET.Point location, long minInteractionTime)
{
this.textures = textures;
this.Location = location;
representation = 0;
this.numTextures = textures.Count;
radius = ((textures[0].Height / 2) + (textures[0].Width / 2)) / 2;
radiusSq = radius * radius;
minNecessaryInteractionTime = minInteractionTime;
stopwatch = new Stopwatch();
people = new Person[6];
buttonHasBeenTriggered = false;
timingInteraction = false;
}
示例12: searchForAssembly
public bool? InUnitTestRunner()
{
var testAssemblies = new[] {
"CSUNIT",
"NUNIT",
"XUNIT",
"MBUNIT",
"NBEHAVE",
"VISUALSTUDIO.QUALITYTOOLS",
"FIXIE",
"NCRUNCH",
};
try {
return searchForAssembly(testAssemblies);
} catch (Exception) {
return null;
}
}
示例13: Offset
/// <summary>
/// Offsets a point in a particular direction by certian length.
/// </summary>
/// <param name="p1"></param>
/// <param name="dir"></param>
/// <param name="len"></param>
/// <returns></returns>
public static Point Offset(Point p1, windows.Vector dir, float len)
{
return new Point((int)(p1.X + dir.X * len / dir.Length),
(int)(p1.Y + dir.Y * len / dir.Length));
}
示例14: DistanceBetweenPoints
public static double DistanceBetweenPoints(WPF.Point StartPoint, WPF.Point EndPoint)
{
double length = Math.Sqrt(Math.Pow(StartPoint.X - EndPoint.X, 2) + Math.Pow(StartPoint.Y - EndPoint.Y, 2));
return length;
}
示例15: CurrentAngle
public static double CurrentAngle(WPF.Point StartPoint, WPF.Point EndPoint)
{
double radians = Math.Atan2(StartPoint.Y - EndPoint.Y, StartPoint.X - EndPoint.X);
double angle = radians * (180 / Math.PI);
return angle;
}