本文整理汇总了C#中System.Drawing.RectangleF.Inset方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.Inset方法的具体用法?C# RectangleF.Inset怎么用?C# RectangleF.Inset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.RectangleF
的用法示例。
在下文中一共展示了RectangleF.Inset方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateColumnChart
void CreateColumnChart (RectangleF frame)
{
// Create the chart
columnChart = new ShinobiChart (frame.Inset(40)) {
Title = "Grocery Sales Figures",
AutoresizingMask = ~UIViewAutoresizing.None,
LicenseKey = "" //TODO: add your trail licence key here!
};
// Add a pair of axes
var xAxis = new SChartCategoryAxis ();
xAxis.Style.InterSeriesPadding = 0;
columnChart.XAxis = xAxis;
var yAxis = new SChartNumberAxis {
Title = "Sales (1000s)",
RangePaddingHigh = new NSNumber(1)
};
columnChart.YAxis = yAxis;
// Add to the view
View.AddSubview (columnChart);
var columnChartDelegate = new ColumnChartDelegate();
columnChartDelegate.ToggledSelection += ColumnChartToggledSelection;
columnChart.DataSource = columnChartDataSource;
columnChart.Delegate = columnChartDelegate;
// Show the legend
columnChart.Legend.Hidden = false;
columnChart.Legend.Placement = SChartLegendPlacement.InsidePlotArea;
}
示例2: TimedAnimation
public TimedAnimation (RectangleF frame) : base(frame)
{
float xInset = frame.Width / 3;
float yInset = frame.Height / 3;
RectangleF aniFrame = frame.Inset (xInset, yInset);
// photo1 starts and the left edge
PointF origin = frame.Location;
origin.X = 0.0f;
origin.Y = Bounds.GetMidY () - aniFrame.Height / 2;
aniFrame.Location = origin;
photo1 = new NSImageView (aniFrame);
photo1.ImageScaling = NSImageScale.AxesIndependently;
photo1.Image = NSImage.ImageNamed ("photo1.jpg");
AddSubview (photo1);
// photo2 starts in the center
origin.X = Bounds.GetMidX () - aniFrame.Width / 2;
aniFrame.Location = origin;
photo2 = new NSImageView (aniFrame);
photo2.ImageScaling = NSImageScale.AxesIndependently;
photo2.Image = NSImage.ImageNamed ("photo2.jpg");
AddSubview (photo2);
}
示例3: Draw
public override void Draw (RectangleF rect)
{
rect = rect.Inset (2, 2);
float bodyWidth = rect.Size.Width / 2;
UIBezierPath path = UIBezierPath.FromRoundedRect (new RectangleF ((rect.Size.Width - bodyWidth) / 2, 0, bodyWidth, rect.Size.Height), UIRectCorner.TopLeft | UIRectCorner.TopRight, new SizeF (8, 8));
UIColor.Black.SetStroke ();
UIColor.White.SetFill ();
path.Fill ();
path.LineWidth = 2;
path.Stroke ();
}
示例4: Draw
public override void Draw (RectangleF rect)
{
rect = rect.Inset (4, 4);
UIBezierPath path = UIBezierPath.FromArc (new PointF (rect.GetMidX (), rect.GetMidY ()), rect.Size.Width / 2, 0, 180, true);
path.LineWidth = 8;
UIColor.White.SetFill ();
path.Fill ();
UIColor.Black.SetStroke ();
path.Stroke ();
}
示例5: frameAnimation
private CAAnimation frameAnimation (RectangleF aniFrame)
{
CAKeyFrameAnimation frameAni = new CAKeyFrameAnimation ();
frameAni.KeyPath = "frame";
RectangleF start = aniFrame;
RectangleF end = aniFrame.Inset (-start.Width * .5f, -start.Height * 0.5f);
frameAni.Values = new NSObject[] {
NSValue.FromRectangleF (start),
NSValue.FromRectangleF (end) };
return frameAni;
}
示例6: KeyFrameView
public KeyFrameView(RectangleF frame) : base(frame)
{
float xInset = 3 * (frame.Width / 8);
float yInset = 3 * (frame.Height / 8);
RectangleF moverFrame = frame.Inset (xInset, yInset);
mover = new NSImageView (moverFrame);
mover.ImageScaling = NSImageScale.AxesIndependently;
mover.Image = NSImage.ImageNamed ("photo.jpg");
AddSubview (mover);
addBounceAnimation ();
}
示例7: Draw
public override void Draw(RectangleF rect)
{
base.Draw (rect);
float margins = 4;
RectangleF drawRect = new RectangleF(rect.X + margins, rect.Y + margins, rect.Width - margins*2, rect.Height - margins*2);
CGContext context = UIGraphics.GetCurrentContext();
context.AddEllipseInRect(drawRect);
context.AddEllipseInRect(drawRect.Inset(4,4));
context.SetFillColor(UIColor.Black.CGColor);
context.SetStrokeColor(UIColor.White.CGColor);
context.SetLineWidth(0.5f);
context.ClosePath();
context.SetShadow(new SizeF(1,2),4);
context.DrawPath(CGPathDrawingMode.EOFillStroke);
}
示例8: RenderPage
/*
* Render the page here: we assume we are already in a normalized coordinate system which maps
* our standard aspect ratio (3:4) to (1:1)
* The reason why we do this is to reuse the same drawing code for both the preview and the
* full screen; for full screen rendering, we map the whole view, whereas the preview maps
* the whole preview image to a quarter of the page.
* */
public RectangleF [] RenderPage (Page page, SizeF size, bool unstyledDrawing)
{
var pageRect = new RectangleF (0, 0, size.Width, size.Height);
var paragraphBounds = new RectangleF [page.Paragraphs.Count];
using (var ctxt = UIGraphics.GetCurrentContext ()) {
// fill background
ctxt.SetFillColor (UIColor.FromHSBA (0.11f, 0.2f, 1, 1).CGColor);
ctxt.FillRect (pageRect);
pageRect = pageRect.Inset (20, 20);
int i = 0;
foreach (var p in page.Paragraphs) {
var bounds = new RectangleF (pageRect.X, pageRect.Y, 0, 0);
if (UnstyledDrawing) {
var text = new NSString (page.StringForParagraph (p));
var font = UIFont.FromName ("HoeflerText-Regular", 24);
// draw text with the old legacy path, setting the font color to black.
ctxt.SetFillColor (UIColor.Black.CGColor);
bounds.Size = text.DrawString (pageRect, font);
} else {
// TODO: draw attributed text with new string drawing
var text = page.AttributedStringForParagraph (p);
var textContext = new NSStringDrawingContext ();
text.DrawString (pageRect, NSStringDrawingOptions.UsesLineFragmentOrigin, textContext);
bounds = textContext.TotalBounds;
bounds.Offset (pageRect.X, pageRect.Y);
}
paragraphBounds [i++] = bounds;
pageRect.Y += bounds.Height;
}
return paragraphBounds;
}
}
示例9: GroupAnimationView
public GroupAnimationView(RectangleF frame) : base(frame)
{
float xInset = 3 * (frame.Width / 8);
float yInset = 3 * (frame.Height / 8);
RectangleF moverFrame = frame.Inset (xInset, yInset);
PointF location = moverFrame.Location;
location.X = this.Bounds.GetMidX () - moverFrame.Width / 2;
location.Y = this.Bounds.GetMidY () - moverFrame.Height / 2;
moverFrame.Location = location;
mover = new NSImageView (moverFrame);
mover.ImageScaling = NSImageScale.AxesIndependently;
mover.Image = NSImage.ImageNamed ("photo.jpg");
NSDictionary animations = NSDictionary.FromObjectsAndKeys (
new object[] {GroupAnimation(moverFrame)},
new object[] {"frameRotation"});
mover.Animations = animations;
AddSubview (mover);
}
示例10: Draw
public override void Draw (RectangleF rectB)
{
CGColorSpace cs = null;
CGContext ctx = null;
RectangleF bds;
ctx = UIGraphics.GetCurrentContext ();
cs = CGColorSpace.CreateDeviceRGB ();
if (Vertical){
ctx.TranslateCTM (0, Bounds.Height);
ctx.ScaleCTM (1, -1);
bds = Bounds;
} else {
ctx.TranslateCTM (0, Bounds.Height);
ctx.RotateCTM (-(float)Math.PI/2);
bds = new RectangleF (0, 0, Bounds.Height, Bounds.Width);
}
ctx.SetFillColorSpace (cs);
ctx.SetStrokeColorSpace (cs);
if (NumLights == 0){
float currentTop = 0;
if (BgColor != null){
BgColor.SetColor ();
ctx.FillRect (bds);
}
foreach (var thisTresh in ColorThresholds){
var val = Math.Min (thisTresh.MaxValue, Level);
var rect = new RectangleF (0, bds.Height * currentTop, bds.Width, bds.Height * (val - currentTop));
thisTresh.Color.SetColor ();
ctx.FillRect (rect);
if (Level < thisTresh.MaxValue)
break;
currentTop = val;
}
if (BorderColor != null){
BorderColor.SetColor ();
bds.Inflate (-0.5f, -0.5f);
ctx.StrokeRect (bds);
}
} else {
float lightMinVal = 0;
float insetAmount, lightVSpace;
int peakLight = -1;
lightVSpace = bds.Height / (float) NumLights;
if (lightVSpace < 4)
insetAmount = 0;
else if (lightVSpace < 8)
insetAmount = 0.5f;
else
insetAmount = 1;
if (PeakLevel > 0){
peakLight = (int)(PeakLevel * NumLights);
if (peakLight >= NumLights)
peakLight = NumLights-1;
}
for (int light_i = 0; light_i< NumLights; light_i++){
float lightMaxVal = (light_i + 1) / (float)NumLights;
float lightIntensity;
RectangleF lightRect;
UIColor lightColor;
if (light_i == peakLight)
lightIntensity = 1;
else {
lightIntensity = (Level - lightMinVal) / (lightMaxVal - lightMinVal);
lightIntensity = Clamp (0, lightIntensity, 1);
if (!VariableLightIntensity && lightIntensity > 0)
lightIntensity = 1;
}
lightColor = ColorThresholds [0].Color;
int color_i = 0;
for (; color_i < ColorThresholds.Length-1; color_i++){
var thisTresh = ColorThresholds [color_i];
var nextTresh = ColorThresholds [color_i+1];
if (thisTresh.MaxValue <= lightMaxVal){
//Console.WriteLine ("PICKED COLOR at {0}", color_i);
lightColor = nextTresh.Color;
}
}
lightRect = new RectangleF (0, bds.Height * light_i / (float) NumLights,
bds.Width, bds.Height * (1f / NumLights));
lightRect.Inset (insetAmount, insetAmount);
if (BgColor != null){
BgColor.SetColor ();
ctx.FillRect (lightRect);
}
//.........这里部分代码省略.........
示例11: CreatePieChart
void CreatePieChart (RectangleF frame)
{
// Create the chart
pieChart = new ShinobiChart (frame.Inset(40)) {
AutoresizingMask = ~UIViewAutoresizing.None,
LicenseKey = "", // TODO: add your trail licence key here!
DataSource = pieChartDataSource
};
UpdatePieTitle ();
pieChart.Legend.Hidden = false;
View.AddSubview (pieChart);
}
示例12: RectangleFOffset
private static RectangleF RectangleFOffset(RectangleF rect, float dx, float dy)
{
// todo: is this correct
return rect.Inset(dx, dy);
}
示例13: Draw
public override void Draw(RectangleF a_rect)
{
CGColorSpace cs;
CGContext cxt;
RectangleF bds;
cxt = UIGraphics.GetCurrentContext ();
cs = CGColorSpace.CreateDeviceRGB();
if (_vertical)
{
cxt.TranslateCTM (0, this.Bounds.Size.Height);
cxt.ScaleCTM (1f, -1f);
bds = this.Bounds;
}
else
{
cxt.TranslateCTM (0, this.Bounds.Size.Height);
cxt.RotateCTM ((float)(-Math.PI / 2f) );
bds = new RectangleF (0f, 0f, this.Bounds.Size.Height, this.Bounds.Size.Width);
}
cxt.SetFillColorSpace (cs);
cxt.SetStrokeColorSpace (cs);
if (_numLights == 0)
{
int i;
float currentTop = 0f;
if (_bgColor != null)
{
_bgColor.SetColor ();
cxt.FillRect (bds);
}
for (i=0; i<_colorThresholds.Length; i++)
{
LevelMeterColorThreshold thisThresh = _colorThresholds[i];
float val = Math.Min (thisThresh.maxValue, _level);
RectangleF rect = new RectangleF(
0,
(bds.Height) * currentTop,
bds.Width,
(bds.Height) * (val - currentTop)
);
CGColor clr = new CGColor (thisThresh.color.CGColor, _maxIntensity);
cxt.SetFillColor (clr);
cxt.FillRect(rect);
if (_level < thisThresh.maxValue)
break;
currentTop = val;
}
if (_borderColor != null)
{
_borderColor.SetColor ();
cxt.StrokeRect( bds.Inset (.5f, .5f));
}
}
else
{
int light_i;
float lightMinVal = 0f;
float insetAmount, lightVSpace;
lightVSpace = bds.Height / (float)_numLights;
if (lightVSpace < 4f) insetAmount = 0f;
else if (lightVSpace < 8f) insetAmount = 0.5f;
else insetAmount = 1f;
int peakLight = -1;
if (_peakLevel > 0f)
{
peakLight = (int)(_peakLevel * _numLights);
if (peakLight >= _numLights)
peakLight = (int)(_numLights - 1);
}
for (light_i=0; light_i<_numLights; light_i++)
{
float lightMaxVal = (float)(light_i + 1) / (float)_numLights;
float lightIntensity;
RectangleF lightRect;
UIColor lightColor;
if (light_i == peakLight)
{
lightIntensity = _maxIntensity;
}
else
{
lightIntensity = (_level - lightMinVal) / (lightMaxVal - lightMinVal);
lightIntensity = LEVELMETER_CLAMP(0f, lightIntensity, _maxIntensity);
if ((!_variableLightIntensity) && (lightIntensity > 0f))
//.........这里部分代码省略.........
示例14: Draw
//.........这里部分代码省略.........
}
}
else
{
int light_i;
float lightMinVal = 0f;
float insetAmount, lightVSpace;
lightVSpace = bds.Height / (float)_numLights;
if (lightVSpace < 4f)
insetAmount = 0f;
else if (lightVSpace < 8f)
insetAmount = 0.5f;
else
insetAmount = 1f;
int peakLight = -1;
if (_peakLevel > 0f)
{
peakLight = (int)(_peakLevel * _numLights);
if (peakLight >= _numLights)
peakLight = (int)(_numLights - 1);
}
for (light_i=0; light_i<_numLights; light_i++)
{
float lightMaxVal = (float)(light_i + 1) / (float)_numLights;
float lightIntensity;
RectangleF lightRect;
UIColor lightColor;
if (light_i == peakLight)
{
lightIntensity = _maxIntensity;
}
else
{
lightIntensity = (_level - lightMinVal) / (lightMaxVal - lightMinVal);
lightIntensity = LevelMeter.LEVELMETER_CLAMP(0f, lightIntensity, _maxIntensity);
if ((!_variableLightIntensity) && (lightIntensity > 0f)) lightIntensity = _maxIntensity;
}
lightColor = _colorThresholds[0].color;
int color_i;
for (color_i=0; color_i<(_colorThresholds.Length-1); color_i++)
{
LevelMeterColorThreshold thisThresh = _colorThresholds[color_i];
LevelMeterColorThreshold nextThresh = _colorThresholds[color_i + 1];
if (thisThresh.maxValue <= lightMaxVal)
lightColor = nextThresh.color;
}
lightRect = new RectangleF(
0f,
bds.Y * (bds.Height * ((float)(light_i) / (float)_numLights)),
bds.Width,
bds.Height * (1f / (float)_numLights)
);
lightRect = lightRect.Inset (insetAmount, insetAmount);
float [] vertices = {
lightRect.GetMinX (), lightRect.GetMinY (),
lightRect.GetMaxX (), lightRect.GetMinY (),
lightRect.GetMinX (), lightRect.GetMaxY (),
lightRect.GetMaxX (), lightRect.GetMaxY ()
};
GL.VertexPointer(2, All.Float, 0, vertices);
GL.EnableClientState (All.VertexArray);
if (lightIntensity == 1f)
{
CGColor clr = lightColor.CGColor;
if (clr.NumberOfComponents != 4)
goto bail;
float [] rgba;
rgba = clr.Components;
GL.Color4 (rgba[0], rgba[1], rgba[2], 1f);
GL.DrawArrays(All.TriangleStrip, 0, 4);
} else if (lightIntensity > 0f) {
CGColor clr = lightColor.CGColor;
if (clr.NumberOfComponents != 4)
goto bail;
float [] rgba;
rgba = clr.Components;
GL.Color4(rgba[0], rgba[1], rgba[2], lightIntensity);
GL.DrawArrays(All.TriangleStrip, 0, 4);
}
lightMinVal = lightMaxVal;
}
}
bail:
GL.PopMatrix ();
GL.Flush ();
}