public void Render(Graphics graphics, MyPoint org, int zoom) { if (!_visible) { return; } const int height = 8; const int posX = 20; const int hSpace = 10; int posY = 30; //int posY = ClientSize.Height - 30; int width = 150; Pen pen = new Pen(Color.Black, 2.0f); int textHeight = (int)_font.GetHeight(); graphics.DrawLine(pen, posX, posY, posX + width, posY); graphics.DrawLine(pen, posX, posY - height, posX, posY + height); graphics.DrawLine(pen, posX + width, posY - height, posX + width, posY + height); MyPointF world0 = ScreenToWorld(org, zoom); MyPointF world1 = ScreenToWorld(org + new MyPoint(width, 0), zoom); double dist = TrackDataManager.ComputeDistance(world0.Y, world0.X, world1.Y, world1.X); graphics.DrawString(Units.Provider.DistanceString(dist), _font, Brushes.Black, posX + width + hSpace, posY - textHeight / 2); }
public void OnMouseMove(MyPoint origin, int zoom, MouseEventArgs e) { if (_openPair != null) { MyPoint cursor = new MyPoint(origin.X + e.X, origin.Y + e.Y); _openPair.WorldPos1 = ScreenToWorld(cursor, zoom); _openPair.Distance = TrackDataManager.ComputeDistance(_openPair.WorldPos0.Y, _openPair.WorldPos0.X, _openPair.WorldPos1.Y, _openPair.WorldPos1.X);; _view.Invalidate(); } }
private void FillList(DirectoryInfo dir) { DirectoryInfo dil = new DirectoryInfo(FileSystem.LocalTrackFolder); if (!dir.Exists) { return; } if (!dil.Exists) { return; } FileInfo[] fi_remote = dir.GetFiles(); // there is a version that supports wildcards, FileInfo[] fi_local = dil.GetFiles(); // but it does not work correctly TrackFileList.Clear(); foreach (FileInfo fi in fi_remote) { if (TrackDataManager.CanOpenFile(fi.FullName)) { TrackFileInfo info = new TrackFileInfo(); info.FileName = fi.Name; info.FullNameRemote = fi.FullName; info.FullNameLocal = dil.FullName + Path.DirectorySeparatorChar + fi.Name; info.ExistLocal = false; info.Size = fi.Length; TrackFileList.Add(info); } } foreach (FileInfo fi in fi_local) { if (TrackDataManager.CanOpenFile(fi.FullName)) { foreach (TrackFileInfo info in TrackFileList) { if (info.FileName == fi.Name) { info.ExistLocal = true; break; } } } } }