none
Drawing graphic lines with 'XOR' ?

    Question

  • Finaly I have started to convert my VB6 app to VB.NET2005...

     I can't figure out how to apply the VB6.Drawmode = XOR, or any other way to draw lines and erase them them on top of other graphic lines as the user moves the mouse ?

    If not XOR is supported, is there any other way to do this (like a rubberband) ?

    Yes, I know I can use Windows GDI calls, but then all my other graphics must be converted from VB6/VB.NET drawings to GDI (as all graphics should be able to drag as they was in VB6)

     Please - need help, have searching for on answer too long already

    Friday, February 17, 2006 9:38 AM

All replies

  • Just found this thread when searching for "graphic xor".
    Elkoda seems to have the same problem as me:

    I want to draw a rectangle using the pixels' colors beneath the rectangle's lines to determine the colors used while drawing the rectangle. I could not find anything alike in the Color structure nor in the Pen or SolidBrush classes. The graphics class didn't give me anything useful either. Is it impossible to do this ? Sure i COULD draw every single point of the rectangle as a single point, calculating the necessary color information every single time anew but that is just insane for anything bigger then tiny rectangles on tiny images. Is there no pre-implemented way to do this ? There used to be some sort of graphics.drawcolormode =  drawcolormode.XOR in GDI long time ago ( I think it was in Win32 API ). Did this become extinct?

    Thanks in advance,
    Amnu


    Friday, August 22, 2008 1:40 PM
  • Thanks for your post. Although it does not solve my problem it showed me what I needed to know to proceeed or rather that I cannot do what I wanted that easily ( say with acceptable perfomance ).
    So ty :-)
    Monday, August 25, 2008 2:30 PM
  • Thanks Alot! I've been searching everywhere for a rubberbanding solution. Working perfect even over Direct3D.
    Tuesday, September 09, 2008 5:44 AM
  • I'm using the Express Edition of Visual C# 2008. Apparently this version doesn't include the class ControlPaint in System.Windows.Forms. I this correct? If so, is there somewhere I can get a copy of this class or something else that draws lines in XOR mode?

    Thanks for your help,
    Mike
    Thursday, March 19, 2009 6:01 PM
  • Sorry,
    I found that ControlPaint is in the System.Windows.Forms name space. What I tried before was the following:

    using System.Windows.Forms.ControlPaint;  // this was rejected by the compiler.
    DrawReversibleLine(...);  // this was rejected by the compiler.

    This is what worked:

    using System.Windows.Forms;
    ControlPaint.DrawReversibleLine(...);

    I hope this helps,

    Mike
    Thursday, March 19, 2009 6:34 PM