473,327 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

DrawReversibleFrame covered by control

I have a user control consisting of a picture box inside a panel (to
permit scrolling). When the user clicks and drags on the picture box,
I use ControlPaint.DrawReversibleFrame to draw a dashed selection
rectangle.

For some reason, the rectangle does not persist beyond its initial
drawing: I see it very briefly, and then it is "covered up" as though
going behind one of the controls. Why does this happen, and what can I
do about it? (If I use the DrawRectangle method, everything is fine,
but I want the reversible frame for easy "undrawing".)

Here's the Paint event handler for the picture box, if it helps. (The
"_drawing" flag indicates that the user is still holding down the
mouse button.)

private void pic_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
Point current = this.PointToClient(Control.MousePosition);

if (_mode == CommandMode.DrawRectangles && _drawing)
{
Rectangle r = Rectangle.FromLTRB(_rectStart.X, _rectStart.Y,
current.X, current.Y);

// Frame will be drawn on the *screen*, not this specific control,
// so offset the rectangle to the control's position.

r.Offset(pic.PointToScreen(new Point(0, 0)));

ControlPaint.DrawReversibleFrame(r, pic.BackColor,
FrameStyle.Dashed);
}
}
Mar 19 '06 #1
1 4667
"Paul E Collins" <fi******************@CL4.org> wrote:
[...] For some reason, the rectangle does not persist beyond
its initial drawing: I see it very briefly, and then it is "covered
up" as though going behind one of the controls. [...]


It seems that drawing the frame in my user control's Paint handler,
rather than its component picture box's Paint handler, has fixed this.

Eq.
Mar 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DalePres | last post by:
I need to be able to do screen captures of a window that is covered by another window. All the examples I find capture the display at the target window coordinates, so it shows a section of the...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
0
by: Richard Coltrane | last post by:
Hi i have a form that houses 2 windows media axPlayers. I want to be able to capture the mousedown event for these controls so i can do a drag and drop. None these events appears to be supported by...
3
by: Spam Catcher | last post by:
Hi all, I'm having some trouble with the Mouse Hover/Leave events on a user control. Say I have a user control with a panel covering the whole control. In turn, a label + picture box cover...
8
by: Rainer Queck | last post by:
Hello NG, I had/have a bad flicker Problem with my Application. On starting some applications, while my app was running, the whole Display started to flicker. Even the desktop Icons! Looking...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.