/// <summary> /// Raises the OnFolderChanged event. /// </summary> /// <param name="e">The <see cref="T:Netron.Diagramming.Core.RectangleEventArgs"/> instance containing the event data.</param> private void RaiseOnFolderChanged(RectangleEventArgs e) { EventHandler <RectangleEventArgs> handler = OnFolderChanged; if (handler != null) { handler(this, e); } }
void folder_OnFolderChanged(object sender, RectangleEventArgs e) { Rectangle rec = e.Rectangle; Transform( new Rectangle( Rectangle.Location, new Size(Rectangle.Width, rec.Height + 20))); }
void mModel_OnInvalidateRectangle(object sender, RectangleEventArgs e) { try { if (!mIsSuspended) { Invalidate(e.Rectangle); ShowTracker();//this makes sure that the tracker is always up to date, especially when the shape have changed/trasnformed because of collapse/expand of material } } catch (StackOverflowException) { //TODO: automatic exception report here? throw; } }
/// <summary> /// Handles the <see cref="FolderMaterial.OnFolderChanged"/> event and recalculates the bounding rectangle of the body, which /// depends on the state of the folders when the class shape is in <see cref="BodyType.List"/> mode. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void folders_OnFolderChanged(object sender, RectangleEventArgs e) { if (mFolders.Count == 0) { return; } bodyHeight = 0; if (mFolders.Count > 1) //shifting of the folder with respect to its predecessor { for (int k = 1; k < mFolders.Count; k++) { mFolders[k].Transform(new Rectangle(Rectangle.X + 5, mFolders[k - 1].Rectangle.Bottom + 10, Rectangle.Width - 10, FolderMaterial.HeaderHeight)); } } foreach (FolderMaterial folder in mFolders) { bodyHeight += folder.Rectangle.Height + 3; } UpdateBody(); }