private void addAssetButton_Click(object sender, EventArgs e) { if (m_addAssetButton == null) { return; } MainForm mainForm = FindForm() as MainForm; if (mainForm == null) { return; } int y = m_addAssetButton.Top; Controls.Remove(m_addAssetButton); m_addAssetButton = null; Asset_PropertyEditor editor; y = AddAsset("", "", "", mainForm.ProjectModel == null ? null : mainForm.ProjectModel, out editor, y); Height = y; if (editor != null) { editor.Text = "<New Asset>"; if (SidePanel != null) { SidePanel.UpdateScrollbars(); SidePanel.ScrollbarV.Value = editor.Bottom; } } }
protected override void OnResize(EventArgs eventargs) { base.OnResize(eventargs); if (SidePanel != null) { SidePanel.UpdateScrollbars(); } }
public void RebuildList() { m_content.Controls.Clear(); if (m_viewPath == null || m_rootPath == null) { m_viewPath = m_rootPath; } if (m_viewPath == null || !Directory.Exists(m_viewPath)) { return; } string root = Path.GetFullPath(m_rootPath); string path = Path.GetFullPath(m_viewPath); bool upDownRow = false; int x = DEFAULT_SEPARATOR; MetroTileIcon tile; bool isRoot = path.Length == root.Length; DirectoryInfo dir = new DirectoryInfo(path); if (!dir.Exists) { return; } if (!isRoot) { tile = new MetroTileIcon(); MetroSkinManager.ApplyMetroStyle(tile); tile.Tag = dir.FullName + @"\.."; tile.Top = DEFAULT_SEPARATOR; tile.Left = x; tile.Size = DEFAULT_TILE_SIZE; tile.Image = m_backImage; tile.IsImageScaled = true; tile.ImageScale = new PointF(0.85f, 0.85f); tile.MouseUp += new MouseEventHandler(tile_MouseUp); m_content.Controls.Add(tile); upDownRow = !upDownRow; } foreach (DirectoryInfo info in dir.GetDirectories()) { tile = new MetroTileIcon(); MetroSkinManager.ApplyMetroStyle(tile); tile.Tag = info.FullName; tile.Top = upDownRow ? (DEFAULT_SEPARATOR + DEFAULT_TILE_SIZE.Height + DEFAULT_SEPARATOR) : DEFAULT_SEPARATOR; tile.Left = x; tile.Size = DEFAULT_TILE_SIZE; tile.Text = info.Name; tile.TextAlign = ContentAlignment.BottomRight; tile.TileTextFontSize = MetroTileTextSize.Small; tile.TileTextFontWeight = MetroTileTextWeight.Regular; tile.Image = m_dirImage; tile.IsImageScaled = true; tile.ImageScale = new PointF(0.85f, 0.85f); tile.ImageAlign = ContentAlignment.TopLeft; tile.ImageOffset = new Point(-10, -10); tile.MouseUp += new MouseEventHandler(tile_MouseUp); m_content.Controls.Add(tile); upDownRow = !upDownRow; if (!upDownRow) { x += DEFAULT_TILE_SIZE.Width + DEFAULT_SEPARATOR; } } string ext; foreach (FileInfo info in dir.GetFiles()) { ext = Path.GetExtension(info.Name); tile = new MetroTileIcon(); MetroSkinManager.ApplyMetroStyle(tile); tile.Tag = info.FullName; tile.Top = upDownRow ? (DEFAULT_SEPARATOR + DEFAULT_TILE_SIZE.Height + DEFAULT_SEPARATOR) : DEFAULT_SEPARATOR; tile.Left = x; tile.Size = DEFAULT_TILE_SIZE; tile.Text = ext + "\n" + Path.GetFileNameWithoutExtension(info.Name); tile.TextAlign = ContentAlignment.BottomRight; tile.TileTextFontSize = MetroTileTextSize.Small; tile.TileTextFontWeight = MetroTileTextWeight.Regular; if (ext == ".h" || ext == ".cpp") { tile.Image = m_fileCodeImage; } else if (ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".bmp") { tile.Image = m_fileImageImage; } else if (ext == ".ogg" || ext == ".mp3" || ext == ".wav") { tile.Image = m_fileMusicImage; } else if (ext == ".txt" || ext == ".log") { tile.Image = m_fileTextImage; } else if (ext == ".json" || ext == ".xml") { tile.Image = m_fileDomImage; } else { tile.Image = m_fileImage; } tile.IsImageScaled = true; tile.ImageScale = new PointF(0.85f, 0.85f); tile.ImageAlign = ContentAlignment.TopLeft; tile.ImageOffset = new Point(-10, -10); tile.MouseUp += new MouseEventHandler(tile_MouseUp); m_content.Controls.Add(tile); upDownRow = !upDownRow; if (!upDownRow) { x += DEFAULT_TILE_SIZE.Width + DEFAULT_SEPARATOR; } } if (SidePanel != null) { SidePanel.UpdateScrollbars(); } }