本文整理汇总了C#中IGraphic.MoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphic.MoveTo方法的具体用法?C# IGraphic.MoveTo怎么用?C# IGraphic.MoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphic
的用法示例。
在下文中一共展示了IGraphic.MoveTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrackSlider
//public event System.EventHandler ValueChangedEvent;
public TrackSlider(string name, IGraphic track, IGraphic thumb,
Orientation orient,
float min, float max,
float initialValue)
: base(name, 0,0,0,0)
{
fTrackGraphic = track;
fThumbGraphic = thumb;
fOrientation = orient;
fMin = min;
fMax = max;
fCurrentValue = initialValue;
fPosition = initialValue;
int yoffset = 0;
int xoffset = 0;
int trackyoffset = 0;
int trackxoffset = 0;
if ((track==null) || (thumb==null))
return ;
AddGraphic(fTrackGraphic, null);
AddGraphic(fThumbGraphic, null);
if (orient == Orientation.Horizontal)
{
// Must align thumb vertically with track.
int midy = fTrackGraphic.Frame.Top + (fTrackGraphic.Frame.Height+1)/2;
int thumbHeight = fThumbGraphic.Frame.Height+1;
yoffset = midy - (thumbHeight / 2);
xoffset = fTrackGraphic.Frame.Left;
}
else
{
// Must align thumb horizontally with track.
int midx = Frame.Left+(Frame.Width+1)/2;
int thumbWidth = fThumbGraphic.Frame.Width+1;
int trackWidth = fTrackGraphic.Frame.Width+1;
xoffset = midx - (thumbWidth / 2);
yoffset = fTrackGraphic.Frame.Top;
trackxoffset = midx - (trackWidth/2);
trackyoffset = fTrackGraphic.Frame.Top;
fTrackGraphic.MoveTo(trackxoffset, trackyoffset);
}
fThumbGraphic.MoveTo(xoffset,yoffset);
RectangleI newFrame = fTrackGraphic.Frame;
//newFrame.Union(fThumbGraphic.Frame);
Frame = newFrame;
SetValue(initialValue, false);
}
示例2: AddToLayout
public override void AddToLayout(IGraphic trans)
{
int size;
int height;
int width;
height = trans.Frame.Height;
width = trans.Frame.Width;
switch (fOrientation)
{
case Orientation.Horizontal:
if (fNumElements == 0)
fCurrentX = fCurrentX + fMargin;
size = width;
if (height > fTallest)
fTallest = height;
//trans.MoveTo(fCurrentX,fCurrentY);
trans.MoveTo(fCurrentX,trans.Frame.Top);
// Adjust widest, tallest, and new position
fWidest = fCurrentX+size+1;
fCurrentX += size+1 + fGap;
break;
case Orientation.Vertical:
if (fNumElements == 0)
fCurrentY = fCurrentY + fMargin;
size = height;
if (width > fWidest)
fWidest = width;
trans.MoveTo(fCurrentX,fCurrentY);
fTallest = fCurrentY + size+1;
fCurrentY += size+1 + fGap;
break;
}
fNumElements++;
}
示例3: AddToLayout
public override void AddToLayout(IGraphic g)
{
fWrappedGraphic = g;
if (fWrappedGraphic == null)
{
return ;
}
int xpos = Frame.Left;
int ypos = Frame.Top;
int width = Frame.Width;
int height = Frame.Height;
int midx = Frame.Left + width / 2;
int midy = Frame.Top + height / 2;
int graphicwidth = fWrappedGraphic.Frame.Width;
int graphicheight = fWrappedGraphic.Frame.Height;
switch (fPosition)
{
case Position.Center:
xpos = fMargin + midx-graphicwidth/2;
ypos = fMargin + midy-graphicheight/2;
break;
case Position.Left:
xpos = fMargin;
ypos = midy-graphicheight/2;
break;
case Position.Top:
xpos = midx-graphicwidth/2;
ypos = fMargin;
break;
case Position.Right:
xpos = Frame.Width-graphicwidth - fMargin;
ypos = midy-graphicheight/2;
break;
case Position.Bottom:
xpos = midx-graphicwidth/2;
ypos = Frame.Height-graphicheight - fMargin;
break;
case Position.TopLeft:
xpos = fMargin;
ypos = fMargin;
break;
case Position.TopRight:
xpos = Frame.Width-graphicwidth - fMargin;
ypos = fMargin;
break;
case Position.BottomLeft:
xpos = fMargin;
ypos = Frame.Height-graphicheight - fMargin;
break;
case Position.BottomRight:
xpos = Frame.Width-graphicwidth - fMargin;
ypos = Frame.Height-graphicheight -fMargin;
break;
}
fWrappedGraphic.MoveTo(xpos, ypos);
}