473,441 Members | 2,049 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,441 software developers and data experts.

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
Nov 17 '05 #1
1 2551
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.DrawReversibleFrame. 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
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

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

"Siri Krishna" <si**********@indiainfo.com> wrote in message
news:eo**************@TK2MSFTNGP09.phx.gbl...
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

Nov 17 '05 #2

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

Similar topics

117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
3
by: Colin McGuire | last post by:
Hi there. I have written a small procedure to draw various shapes on things. A bit of it is shown below. Private Sub drawShape(ByVal shapeType As Integer, ByRef g As Graphics) Select Case...
5
by: Cristian | last post by:
Hi. I've made so: Imports System.Drawing Imports System.Drawing.Drawing2D Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
2
by: Dan | last post by:
I want to use Graphics.DrawRectangle to draw a rectangle at a position on the screen, and then a few seconds later, erase it. How do you erase a rectangle that you just drew (without affecting the...
1
by: Jeff Waskiewicz | last post by:
Hello All, I'm trying to solve a nagging problem. The goal is to draw a rectangle over the top of all the other controls on a form. Specifically, over a ChartFX control. The user would draw...
2
by: Jon Slaughter | last post by:
How does DrawRectangle position a rectangle w.r.t to the Rectangle passed? Lets suppose I use a pen of width 5. Are the lines centered about the passed Rectangle or is it enclosed or offset? Are...
1
by: t f | last post by:
Hi FillRectangle allows me to use a rectanglef as a parameter, why doesnt DrawRectangle? Even though I can use floats as parameters? Did M$ forget to add it? Thanks t f
3
by: Joca | last post by:
I've made a private sub that creates a graphic (using drawrectangle, string, line and stuff like that) inside a picturebox, so i wouldnt place it right on top of the form itself and also beeing able...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.