Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. XOR mode...

XOR mode...

Scheduled Pinned Locked Moved C#
csharphelpquestion
11 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vu Truong
    wrote on last edited by
    #1

    I want to draw a shape by mouse. But I can not find out the way to use XOR mode in C#. Can you show me a sample for this issue? Thanks

    N M J O 4 Replies Last reply
    0
    • V Vu Truong

      I want to draw a shape by mouse. But I can not find out the way to use XOR mode in C#. Can you show me a sample for this issue? Thanks

      N Offline
      N Offline
      NormDroid
      wrote on last edited by
      #2

      DrawReversibleFrame Normski. - Professional Windows Programmer

      V 1 Reply Last reply
      0
      • N NormDroid

        DrawReversibleFrame Normski. - Professional Windows Programmer

        V Offline
        V Offline
        Vu Truong
        wrote on last edited by
        #3

        Sorry I don't understand your answer. Could you please give me more details?

        R 1 Reply Last reply
        0
        • V Vu Truong

          Sorry I don't understand your answer. Could you please give me more details?

          R Offline
          R Offline
          Rama Krishna Vavilala
          wrote on last edited by
          #4

          There is a class called ControlPaint. It has limted XOR drwaing functions like DrawReversibleFrame etc. Look at that.

          1 Reply Last reply
          0
          • V Vu Truong

            I want to draw a shape by mouse. But I can not find out the way to use XOR mode in C#. Can you show me a sample for this issue? Thanks

            M Offline
            M Offline
            Mazdak
            wrote on last edited by
            #5

            I think ^ is what you want. Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down

            R 1 Reply Last reply
            0
            • M Mazdak

              I think ^ is what you want. Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down

              R Offline
              R Offline
              Rama Krishna Vavilala
              wrote on last edited by
              #6

              Mazdak wrote: I think ^ is what you want. :confused: :confused:

              M 1 Reply Last reply
              0
              • R Rama Krishna Vavilala

                Mazdak wrote: I think ^ is what you want. :confused: :confused:

                M Offline
                M Offline
                Mazdak
                wrote on last edited by
                #7

                I thought he want XOR operator in C# and ^ do it. Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down

                C 1 Reply Last reply
                0
                • V Vu Truong

                  I want to draw a shape by mouse. But I can not find out the way to use XOR mode in C#. Can you show me a sample for this issue? Thanks

                  J Offline
                  J Offline
                  James T Johnson
                  wrote on last edited by
                  #8

                  XOR mode drawing isn't supported in GDI+ because its use was considered a hack since you couldn't control the color that was output from its operation. The recommended solution is to do your drawing so that you don't need XOR mode; or emulate it. For instance if you were creating a progress bar control that showed the percentage in the middle (ala most setup programs) you would draw the text twice; once with the clipping set to just the area that is being filled; again with it set to the area not being filled choosing appropriate colors both times. This is a GOOD thing though; because then font features such as antialising and cleartype will work; where as they won't if you blit to a bitmap then xor the bitmap onto another one. James "Java is free - and worth every penny." - Christian Graus

                  V 1 Reply Last reply
                  0
                  • J James T Johnson

                    XOR mode drawing isn't supported in GDI+ because its use was considered a hack since you couldn't control the color that was output from its operation. The recommended solution is to do your drawing so that you don't need XOR mode; or emulate it. For instance if you were creating a progress bar control that showed the percentage in the middle (ala most setup programs) you would draw the text twice; once with the clipping set to just the area that is being filled; again with it set to the area not being filled choosing appropriate colors both times. This is a GOOD thing though; because then font features such as antialising and cleartype will work; where as they won't if you blit to a bitmap then xor the bitmap onto another one. James "Java is free - and worth every penny." - Christian Graus

                    V Offline
                    V Offline
                    Vu Truong
                    wrote on last edited by
                    #9

                    Hi James, Do you think that I can use the Region class for this issue? I want to build a drawing application which use mouse to draw a shape. But when I drag the mouse I can't clear the previous shape. Can you show me a solution? Thanks.

                    1 Reply Last reply
                    0
                    • V Vu Truong

                      I want to draw a shape by mouse. But I can not find out the way to use XOR mode in C#. Can you show me a sample for this issue? Thanks

                      O Offline
                      O Offline
                      Oyvind Bratland
                      wrote on last edited by
                      #10

                      Check out this link: http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q314945& This works only with rectangles and lines. Øyvind

                      1 Reply Last reply
                      0
                      • M Mazdak

                        I thought he want XOR operator in C# and ^ do it. Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #11

                        He wants the XOR mode when drawing. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups