Hi!
I need to fit my GoGrid size to GoView size, which contains it.
I did the following:
-
I derrived my class from GoGrid
-
I subscribed on GoView events:
this.View.SizeChanged += GoViewSizeChangedEventHandler;
this.View.PropertyChanged += GoViewPropertyChangedEventHandler; -
Events handlers of these events contains the same code (in PropertyChanged event handler this code will execute if e.PropertyName == “DocScale”):
this.Bounds = new RectangleF(0, 0,
View.DocExtent.Width > View.Document.Bounds.Width ? View.DocExtent.Width : View.Document.Bounds.Width,
View.DocExtent.Height > View.Document.Bounds.Height ? View.DocExtent.Height : View.Document.Bounds.Height);
It works almost exactly as i need, but sometimes the size of the GoGrid and the GoView doesn't equal each other. Is there a mistake in my events handlers? Or may be i passed something important? Thanks!