本文整理汇总了C#中Mapping.GetHexTopLeftCorner方法的典型用法代码示例。如果您正苦于以下问题:C# Mapping.GetHexTopLeftCorner方法的具体用法?C# Mapping.GetHexTopLeftCorner怎么用?C# Mapping.GetHexTopLeftCorner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapping
的用法示例。
在下文中一共展示了Mapping.GetHexTopLeftCorner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditorControl
public EditorControl(Map mapToEdit, MainWindow mainWindow)
{
InitializeComponent();
Map = mapToEdit;
MainWnd = mainWindow;
Mapping = new Mapping(50, 42);
this.DataContext = Map;
ViewPortData viewPort = new ViewPortData() { CentreX = 0, CentreY = 0, Height = 500, Width = 500, Zoom = 1 };
//var uriSource = new Uri(@"/WpfApplication1;component/Untitled.png", UriKind.Relative);
//foo.Source = new BitmapImage(uriSource);
BitmapImage img = new BitmapImage(new Uri("C:/Development/projects/Landwar/Shared/HexRed.png"));
/*ImageBrush imgBrush = new ImageBrush(img);
imgBrush.Viewbox = new Rect(0, 0, 1, 1);
imgBrush.ViewboxUnits = BrushMappingMode.RelativeToBoundingBox;
imgBrush.Stretch = Stretch.Uniform;*/
SolidColorBrush redSolidColorBrush = new SolidColorBrush();
redSolidColorBrush.Color = Color.FromArgb(255, 255, 0, 0);
SolidColorBrush grnSolidColorBrush = new SolidColorBrush();
grnSolidColorBrush.Color = Color.FromArgb(255, 0, 255, 0);
for (int j = 0; j < mapToEdit.Height; ++j)
{
for (int i = 0; i < mapToEdit.Width; ++i)
{
Point hexTopLeft = Mapping.GetHexTopLeftCorner(viewPort, mapToEdit.Hexes[j,i]);
Polygon pGon = GenerateHex(hexTopLeft.X, hexTopLeft.Y, Mapping.hexHeight, Mapping.hexWidth);
pGon.Stroke = Brushes.Purple;
pGon.StrokeThickness = 0;
pGon.ClipToBounds = true;
//pGon.Fill = imgBrush;
if (((double)i) % 2 == 0)
{
pGon.Fill = redSolidColorBrush;
}
else
{
pGon.Fill = grnSolidColorBrush;
}
pGon.MouseEnter += Polygon_MouseMove;
this.cnvMap.Children.Add(pGon);
}
}
}