GoView Rubberband


#1

Is there a way I can override the rubber band on the GoView… I want to change it from that black to say green or blue… and give it a alpha blended background color… is this doable?


#2

That’s controlled by GoToolRubberBanding, which just calls GoView.DrawXorBox.
In Windows Forms, GoView.DrawXorBox calls GoView.DrawXorRectangle, which calls ControlPaint.DrawReversibleFrame. You could override the implementation of GoView.DrawXorBox to do what you want.


#3

Great thanx man…


#4

This isn’t that easy :) I repainted both my monitors with a few thousand rubberbands… :)


#5
OK, here's a greatly simplified version of the implementation that GoView has: public virtual void DrawXorBox(Rectangle rect, bool drawnew) {
// erase any previous rectangle
if (myPrevXorRectValid) {
DrawXorRectangle(myPrevXorRect);
myPrevXorRectValid = false;
} if (drawnew) {
DrawXorRectangle(rect);
myPrevXorRect = rect;
myPrevXorRectValid = true;
}
} public void DrawXorRectangle(Rectangle rect) {
Rectangle screenRect = RectangleToScreen(rect);
ControlPaint.DrawReversibleFrame(screenRect, this.BackColor, FrameStyle.Thick);
} private Rectangle myPrevXorRect = new Rectangle();
private bool myPrevXorRectValid = false;