本文整理汇总了C#中System.Drawing.RectangleF类的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.RectangleF类的具体用法?C# System.Drawing.RectangleF怎么用?C# System.Drawing.RectangleF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Drawing.RectangleF类属于命名空间,在下文中一共展示了System.Drawing.RectangleF类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Generate
public override void Generate(ref Device device)
{
bounds = new System.Drawing.RectangleF(-30.0f, 0.0f, 60.0f, 30.0f);
texture = Microsoft.DirectX.Direct3D.TextureLoader.FromFile(
device,
Environment.CurrentDirectory + "\\Texture\\SKY_BOX_EGYPT.BMP",
0,
0,
1,
Usage.None,
Format.Unknown,
Pool.Managed,
Filter.None,
Filter.None,
System.Drawing.Color.Magenta.ToArgb());
float yOffSet = bounds.Height / 2;
vertices = new CustomVertex.PositionColoredTextured[4];
vertices[0].Position = new Vector3(bounds.X, bounds.Y + yOffSet, -15.0f);
vertices[0].Tu = 0.0f; vertices[0].Tv = 0.0f;
vertices[0].Color = System.Drawing.Color.LightBlue.ToArgb();
vertices[1].Position = new Vector3(bounds.X, bounds.Y - yOffSet, -15.0f);
vertices[1].Color = System.Drawing.Color.White.ToArgb();
vertices[1].Tu = 0.0f; vertices[1].Tv = 1.0f;
vertices[2].Position = new Vector3(bounds.X + bounds.Width, bounds.Y + yOffSet, -15.0f);
vertices[2].Color = System.Drawing.Color.LightBlue.ToArgb();
vertices[2].Tu = 1.0f; vertices[2].Tv = 0.0f;
vertices[3].Position = new Vector3(bounds.X + bounds.Width, bounds.Y - yOffSet, -15.0f);
vertices[3].Color = System.Drawing.Color.White.ToArgb();
vertices[3].Tu = 1.0f; vertices[3].Tv = 1.0f;
}
开发者ID:stevenandrewcarter,项目名称:Bombard,代码行数:34,代码来源:SkyBox.cs
示例2: MiniCell
public MiniCell()
: base(UITableViewCellStyle.Value1,Key)
{
Frame = new System.Drawing.RectangleF (0, 0, 320, 30);
TextLabel.Font = UIFont.SystemFontOfSize (UIFont.SmallSystemFontSize + 2);
DetailTextLabel.Font = UIFont.SystemFontOfSize (UIFont.SmallSystemFontSize + 2);
}
开发者ID:nagyist,项目名称:iPadPos,代码行数:7,代码来源:MiniCell.cs
示例3: RunCommand
protected override Rhino.Commands.Result RunCommand(Rhino.RhinoDoc doc, Rhino.Commands.RunMode mode)
{
MonoMac.ObjCRuntime.Runtime.RegisterAssembly (this.GetType ().Assembly);
var vm = new DNViewModel();
var win = RhinoMac.Window.FromNib("CocoaRhinoWindow", vm);
win.Title = "On the fly";
var rect = new System.Drawing.RectangleF(10, 100, 200, 50);
//var btn = new MonoMac.AppKit.NSButton (rect);
var btn = new CustomButton(rect);
win.ContentView.AddSubview(btn);
btn.Title = "On the fly";
btn.SetButtonType(MonoMac.AppKit.NSButtonType.MomentaryLightButton);
btn.BezelStyle = MonoMac.AppKit.NSBezelStyle.Rounded;
TestResponer res = new TestResponer ();
btn.Activated += (object sender, EventArgs e) => {
MonoMac.AppKit.NSFontManager.SharedFontManager.Target = res;
MonoMac.AppKit.NSFontManager.SharedFontManager.OrderFrontFontPanel (btn);
};
res.NextResponder = win.NextResponder;
win.NextResponder = res;
win.ShowModal();
return Rhino.Commands.Result.Success;
}
开发者ID:sbaer,项目名称:cocoarhino_cs,代码行数:28,代码来源:CocoaRhinoCommand.cs
示例4: Draw
public override void Draw(System.Drawing.RectangleF rect)
{
base.Draw(rect);
var width = rect.Width / 2f - 1f;
var addedRect = new System.Drawing.RectangleF(0, 0, width, rect.Height);
var removedRect = new System.Drawing.RectangleF(rect.Width / 2f + 1f, 0, width, rect.Height);
var context = UIGraphics.GetCurrentContext();
context.SaveState();
context.SetFillColor(UIColor.FromRGB(204, 255, 204).CGColor);
context.AddPath(GraphicsUtil.MakeRoundedRectPath(addedRect, 5));
context.FillPath();
context.SetFillColor(UIColor.FromRGB(255, 221, 221).CGColor);
context.AddPath(GraphicsUtil.MakeRoundedRectPath(removedRect, 5));
context.FillPath();
context.RestoreState();
UIColor.FromRGB(57, 152, 57).SetColor();
var stringRect = addedRect;
stringRect.Y += 1f;
string addedString = (Added == null) ? "-" : "+" + Added.Value;
DrawString(addedString, stringRect, UIFont.SystemFontOfSize(12f), UILineBreakMode.TailTruncation, UITextAlignment.Center);
UIColor.FromRGB(0xcc, 0x33, 0x33).SetColor();
stringRect = removedRect;
stringRect.Y += 1f;
string removedString = (Removed == null) ? "-" : "-" + Removed.Value;
DrawString(removedString, stringRect, UIFont.SystemFontOfSize(12f), UILineBreakMode.TailTruncation, UITextAlignment.Center);
}
开发者ID:rcaratchuk,项目名称:CodeFramework,代码行数:32,代码来源:AddRemoveView.cs
示例5: ViewDidMoveToSuperview
public override void ViewDidMoveToSuperview ()
{
Frame = new System.Drawing.RectangleF(0, 25, Superview.Bounds.Width, Superview.Bounds.Height - 60);
AdjustSubviews();
SetPositionOfDivider(Bounds.Width/3, 0);
base.ViewDidMoveToSuperview ();
}
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:7,代码来源:SpatialDockManager.cs
示例6: UIMapControlInputHandler
protected UIMapControlInputHandler(InputMode setInputMode, UIMapControl setUIMapControl)
{
mapUnitOrder = MapUnitOrder.None;
IsSpanningRectangle = false;
selectionRectangle = RectangleF.Empty;
MapControl = setUIMapControl;
InputMode = setInputMode;
}
开发者ID:CAMongrel,项目名称:WinWar,代码行数:9,代码来源:UIMapControlInputHandler.cs
示例7: Rect
public static System.Drawing.RectangleF Rect(System.Drawing.Rectangle rect)
{
var new_rect = new System.Drawing.RectangleF();
new_rect.X = rect.X;
new_rect.Y = rect.Y;
new_rect.Width = rect.Width;
new_rect.Height = rect.Height;
return new_rect;
}
开发者ID:modulexcite,项目名称:Visio-Power-Tools,代码行数:9,代码来源:ColorPickerUtil.cs
示例8: Draw
public override void Draw(System.Drawing.Graphics g)
{
System.Drawing.SolidBrush solidBrush = new System.Drawing.SolidBrush(Color);
System.Drawing.PointF upperLeftPoint = new System.Drawing.PointF((float)(Center.X - RadiusX), (float)(Center.Y - RadiusY));
System.Drawing.SizeF rectSize = new System.Drawing.SizeF((float)(2 * RadiusX), (float)(2 * RadiusY));
System.Drawing.RectangleF rect = new System.Drawing.RectangleF(upperLeftPoint, rectSize);
g.FillEllipse(solidBrush, rect);
solidBrush.Dispose();
}
开发者ID:abdonkov,项目名称:HackBulgaria-CSharp,代码行数:9,代码来源:Ellipse.cs
示例9: Draw
public override void Draw(System.Drawing.Graphics g)
{
System.Drawing.SolidBrush solidBrush = new System.Drawing.SolidBrush(Color);
System.Drawing.PointF upperLeftPoint = new System.Drawing.PointF((float)(Center.X - Width / 2), (float)(Center.Y - Height / 2));
System.Drawing.SizeF rectSize = new System.Drawing.SizeF((float)Width, (float)Height);
System.Drawing.RectangleF rect = new System.Drawing.RectangleF(upperLeftPoint, rectSize);
g.FillRectangle(solidBrush, rect);
solidBrush.Dispose();
}
开发者ID:abdonkov,项目名称:HackBulgaria-CSharp,代码行数:9,代码来源:Rectangle.cs
示例10: IsCross
/// <summary>
/// 获取编辑器对象的宽度
/// </summary>
/// <returns></returns>
//public float GetWidth()
//{
// return Math.Abs(this.Left - this.Right);
//}
///// <summary>
///// 获取编辑器对象的高度
///// </summary>
///// <returns></returns>
//public float GetHeight()
//{
// return Math.Abs(this.Top - this.Bottom);
//}
/// <summary>
/// 矩形区域与形参中的区域是否重叠交叉
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="right"></param>
/// <param name="bottom"></param>
/// <returns></returns>
public bool IsCross(float x,float y,float right,float bottom)
{
bool isCoross = false;
System.Drawing.RectangleF srcRect = new System.Drawing.RectangleF(this.Left, this.Top, this.Width, this.Height);
System.Drawing.RectangleF destRect = new System.Drawing.RectangleF(x, y, right, bottom);
if (srcRect.IntersectsWith(destRect)) isCoross = true;
return isCoross;
}
开发者ID:yuzhantao,项目名称:ColorEditor,代码行数:36,代码来源:EditorObjectRectangle.cs
示例11: TestCreateSVGObject
public void TestCreateSVGObject()
{
System.Drawing.RectangleF rect = new System.Drawing.RectangleF(); ;
string lineBrush = null;
string fillBrush = null;
string expectedString = null;
string resultString = null;
resultString = _unitUnderTest.CreateSVGObject(rect, lineBrush, fillBrush);
Assert.AreEqual(expectedString, resultString, "CreateSVGObject method returned unexpected result.");
Assert.Fail("Create or modify test(s).");
}
开发者ID:ecell,项目名称:ecell3-ide,代码行数:11,代码来源:TestFigureBase.cs
示例12: DarkSwitch
public DarkSwitch(bool on)
{
InsertSegment("ON", 0, false);
InsertSegment("OFF", 1, false);
Frame = new System.Drawing.RectangleF(0, 0, 100, 30);
ControlStyle = UISegmentedControlStyle.Bar;
BackgroundColor = StyleExtensions.transparent;
TintColor = UIColor.FromRGB(100, 100, 100);
SelectedSegment = (on) ? 0 : 1;
}
开发者ID:Smeedee,项目名称:Smeedee-Mobile,代码行数:12,代码来源:WidgetConfigTableViewSource.cs
示例13: Init
public static void Init(TestContext context)
{
dp1 = new System.Drawing.Point(10, 10);
dp2 = new System.Drawing.Point(100, 100);
drect = new System.Drawing.Rectangle(5, 5, 15, 15);
wp1 = new System.Windows.Point(10, 10);
wp2 = new System.Windows.Point(100, 100);
wrect = new System.Windows.Rect(5, 5, 15, 15);
fp1 = new System.Drawing.PointF(10, 10);
fp2 = new System.Drawing.PointF(100, 100);
frect = new System.Drawing.RectangleF(5, 5, 15, 15);
}
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:14,代码来源:PointTest.cs
示例14: UpdateBoundsAndMargins
/// <summary>
/// Update the default bounds and margins after the printer settings changed.
/// This function must be called manually after a page setup dialog.
/// </summary>
public void UpdateBoundsAndMargins()
{
if (_printerSettings.IsValid)
{
_printerPageBounds = _printDocument.DefaultPageSettings.Bounds;
_printerMargins = _printDocument.DefaultPageSettings.Margins;
}
else // obviously no printer installed, use A4 size (sorry, this is european size)
{
_printerPageBounds = new System.Drawing.RectangleF(0, 0, 1169, 826);
_printerMargins = new System.Drawing.Printing.Margins(50, 50, 50, 50);
}
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:18,代码来源:PrintingService.cs
示例15: HandleDrag
protected void HandleDrag(UIPanGestureRecognizer recognizer)
{
// if it's just began, cache the location of the image
if (recognizer.State == UIGestureRecognizerState.Began)
originalImageFrame = imgDragMe.Frame;
if (recognizer.State != (UIGestureRecognizerState.Cancelled | UIGestureRecognizerState.Failed
| UIGestureRecognizerState.Possible)) {
// move the shape by adding the offset to the object's frame
System.Drawing.PointF offset = recognizer.TranslationInView (imgDragMe);
System.Drawing.RectangleF newFrame = originalImageFrame;
newFrame.Offset (offset.X, offset.Y);
imgDragMe.Frame = newFrame;
}
}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:16,代码来源:GestureRecognizers_iPhone.xib.cs
示例16: UITabBarControllerWithTabBarOnTop
public UITabBarControllerWithTabBarOnTop ()
{
//-----------------------CUSTOM TAB BAR-------------------------------------------------
rect = new System.Drawing.RectangleF(0,0,this.View.Bounds.Size.Width,TAB_BAR_HEIGHT);
this.TabBar.Frame = rect;
this.TabBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
rect = new System.Drawing.RectangleF();
rect.Location.Y = TAB_BAR_HEIGHT;
rect.Size.Height = this.View.Bounds.Size.Height - TAB_BAR_HEIGHT;
this.View.Frame = rect;
this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
//----------------------------------------------------------------------------------------
tab1 = new UIViewController();
tab1.Title = "Green";
tab1.View.BackgroundColor = UIColor.Green;
tab2 = new UIViewController();
tab2.Title = "Orange";
tab2.View.BackgroundColor = UIColor.Orange;
tab3 = new UIViewController();
tab3.Title = "Red";
tab3.View.BackgroundColor = UIColor.Red;
#region Additional Info
// tab1.TabBarItem = new UITabBarItem (UITabBarSystemItem.History, 0); // sets image AND text
// tab2.TabBarItem = new UITabBarItem ("Orange", UIImage.FromFile("Images/first.png"), 1);
// tab3.TabBarItem = new UITabBarItem ();
// tab3.TabBarItem.Image = UIImage.FromFile("Images/second.png");
// tab3.TabBarItem.Title = "Rouge"; // this overrides tab3.Title set above
// tab3.TabBarItem.BadgeValue = "4";
// tab3.TabBarItem.Enabled = false;
#endregion
var tabs = new UIViewController[] {
tab1, tab2, tab3
};
ViewControllers = tabs;
SelectedViewController = tab2; // normally you would default to the left-most tab (ie. tab1)
}
开发者ID:moljac,项目名称:MonoTouch.Samples,代码行数:45,代码来源:TabBarController.cs
示例17: Form1_Shown
private void Form1_Shown(object sender, EventArgs e)
{
Debug.WriteLine("Form1_Shown");
surface = new Win32Surface(this.CreateGraphics().GetHdc());
context = new Context(surface);
textFormat = DWriteCairo.CreateTextFormat(
"Consolas",
FontWeight.Normal,
FontStyle.Normal,
FontStretch.Normal,
12);
textFormat.TextAlignment = TextAlignment.Center;
float left, top, width, height;
// get actual size of the text
var measureLayout = DWriteCairo.CreateTextLayout(s, textFormat, 4096, 4096);
measureLayout.GetRect(out left, out top, out width, out height);
measureLayout.Dispose();
// build text context against the size and format
textLayout = DWriteCairo.CreateTextLayout(s, textFormat, (int)Math.Ceiling(width), (int)Math.Ceiling(height));
Debug.WriteLine("showing layout");
Path path = DWriteCairo.RenderLayoutToCairoPath(context, textLayout);
context.AppendPath(path);
context.Fill();
textLayout.GetRect(out left, out top, out width, out height);
textRect = new System.Drawing.RectangleF(left, top, width, height);
context.Rectangle(left, top, width, height);
context.Stroke();
context.GetTarget().Flush();
}
开发者ID:zwcloud,项目名称:ZWCloud.DwriteCairo,代码行数:38,代码来源:Form1.cs
示例18: RandomSymbol
private byte[] RandomSymbol(int number)
{
number = number%360;
string text ="";
System.Drawing.Brush brush = null;
if (number < 60)
return null;
if (number < 120)
{
text = "<120";
brush = System.Drawing.Brushes.DarkGreen;
}
else if(number < 240)
{
text = number.ToString();
brush = System.Drawing.Brushes.Orange;
}
else
{
text = ">240";
brush = System.Drawing.Brushes.Red;
}
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(120, 60);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
System.Drawing.RectangleF size = new System.Drawing.RectangleF(0f, 0f, 120f, 60f);
g.FillRectangle(System.Drawing.Brushes.White, size);
var sf = new System.Drawing.StringFormat(System.Drawing.StringFormatFlags.NoWrap)
{Alignment = System.Drawing.StringAlignment.Center};
g.DrawString(text, new System.Drawing.Font("Arial", 24), brush, size, sf);
g.Flush();
g.Dispose();
var ms = new System.IO.MemoryStream();
bmp.MakeTransparent(System.Drawing.Color.White);
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
return ms.ToArray();
}
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:38,代码来源:Theming.cs
示例19: Init
public static void Init(TestContext context)
{
drect = new System.Drawing.Rectangle(5, 5, 5, 5);
dr1 = new System.Drawing.Rectangle(6, 6, 1, 1); //In
dr2 = new System.Drawing.Rectangle(3, 3, 5, 5); //Overlap TopLeft
dr3 = new System.Drawing.Rectangle(0, 0, 15, 15); //Over
dr4 = new System.Drawing.Rectangle(0, 0, 1, 1); //Out
dr5 = new System.Drawing.Rectangle(8, 8, 5, 5); //Overlap RightBottom
frect = new System.Drawing.RectangleF(5, 5, 5, 5);
fr1 = new System.Drawing.RectangleF(6, 6, 1, 1); //In
fr2 = new System.Drawing.RectangleF(3, 3, 5, 5); //Overlap TopLeft
fr3 = new System.Drawing.RectangleF(0, 0, 15, 15); //Over
fr4 = new System.Drawing.RectangleF(0, 0, 1, 1); //Out
fr5 = new System.Drawing.RectangleF(8, 8, 5, 5); //Overlap RightBottom
wrect = new System.Windows.Rect(5, 5, 5, 5);
wr1 = new System.Windows.Rect(6, 6, 1, 1); //In
wr2 = new System.Windows.Rect(3, 3, 5, 5); //Overlap TopLeft
wr3 = new System.Windows.Rect(0, 0, 15, 15); //Over
wr4 = new System.Windows.Rect(0, 0, 1, 1); //Out
wr5 = new System.Windows.Rect(8, 8, 5, 5); //Overlap RightBottom
}
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:23,代码来源:RectTest.cs
示例20: UpdateBoundsAndMargins
/// <summary>
/// Update the default bounds and margins after the printer settings changed.
/// This function must be called manually after a page setup dialog.
/// </summary>
public void UpdateBoundsAndMargins()
{
bool validPage = false;
if (_printerSettings.IsValid)
{
_printerPageBounds = _printDocument.DefaultPageSettings.Bounds;
_printerMargins = _printDocument.DefaultPageSettings.Margins;
// check the values
validPage = true;
validPage &= _printerPageBounds.Height > 0;
validPage &= _printerPageBounds.Width > 0;
validPage &= _printerPageBounds.Height > (_printerMargins.Top + _printerMargins.Bottom);
validPage &= _printerPageBounds.Width > (_printerMargins.Left + _printerMargins.Right);
}
if (!validPage)// obviously no printer installed, use A4 size (sorry, this is european size)
{
_printerPageBounds = new System.Drawing.RectangleF(0, 0, 1169, 826);
_printerMargins = new System.Drawing.Printing.Margins(50, 50, 50, 50);
}
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:27,代码来源:PrintingService.cs
注:本文中的System.Drawing.RectangleF类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论