DrawRectangle problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Siri Krishna

    #1

    DrawRectangle problem

    Hi,
    We have a custom control into which we add controls like labels and move
    them at run time. The problem we have is that when a child control is
    selected and moved, we draw a rectangle around it to identify it as
    selected. The DrawRectangle works fine when the child controls is on left
    half of the custom control area but fails to draw the rectangle when moved
    to right half of the custom control. When placed some where in between we
    see about half rectangle drawn on left side around child control. Does some
    body know the strange behavior.
    Regards,
    Siri


  • Bob Powell [MVP]

    #2
    Re: DrawRectangle problem

    I suspect that you're drawing the rectangle in the user controls paint
    event. The rectangle is drawn using simple GDI+ commands and is probably
    behind something like a panel that is in the user control.

    Try converting the coordinates of the rectangle to screen coordinates and
    using ControlPaint.Dr awReversibleFra me. That draws on the desktop and will
    stomp on everything.

    --
    Bob Powell [MVP]
    Visual C#, System.Drawing

    Find great Windows Forms articles in Windows Forms Tips and Tricks


    Answer those GDI+ questions with the GDI+ FAQ


    All new articles provide code in C# and VB.NET.
    Subscribe to the RSS feeds provided and never miss a new article.





    "Siri Krishna" <sirikrishnap@i ndiainfo.com> wrote in message
    news:eo5ukUWcFH A.2960@TK2MSFTN GP09.phx.gbl...[color=blue]
    > Hi,
    > We have a custom control into which we add controls like labels and
    > move
    > them at run time. The problem we have is that when a child control is
    > selected and moved, we draw a rectangle around it to identify it as
    > selected. The DrawRectangle works fine when the child controls is on left
    > half of the custom control area but fails to draw the rectangle when moved
    > to right half of the custom control. When placed some where in between we
    > see about half rectangle drawn on left side around child control. Does
    > some
    > body know the strange behavior.
    > Regards,
    > Siri
    >
    >[/color]


    Comment

    Working...