You could always add code in the OnPaint event. If you just want to draw a single rectangle just declare a rectangle on the form object, then using mouse events once it is selected set the Selection Rectangle object to the appropriate values and then call this.Invalidate();
It will force a repaint of the object. Inside the paint routine you can have code to only bother drawing the rectangle if a selection has been made. The actual drawing of the rectangle can be done via the System.Windows.Forms.PaintEventArgs
object which is passed to the routine. Simply use the e.Graphics.DrawRectangle();
method to draw the actual rectangle. An example of this called would be: e.Graphics.DrawRectangle(new Pen(Color.Red, 1), x, y, mySelection.Width, mySelection.Height); I am sure there is a better way out there but this should work.
Daniel M Edwards
Posts
-
Can you Draw Shapes on Forms/PictureBoxes? -
Q: Coloring SchemesI found this snippet after a quick Google search. It's the 3rd block down. http://www.syncfusion.com/FAQ/WinForms/FAQ_c85c.asp[^]
-
Assembly Class Locking IssueThanks, that method works great.
-
Assembly Class Locking IssueI am using the Assembly.LoadFrom() method in my application to extract some information from some DLLs and I am running into a locking problem. Even after I am done with the file and have set the Assembly to null it keeps the file I loaded locked until the application terminates. The problem comes when I try and update the DLL with a new version automatically via the main application. I am unable to copy the newly downloaded version over because the file still reports as locked by Windows. Does anyone know a way to tell the Assembly object to release it's hold on the file it loaded?
-
Contract AdviceI personally have to agree with avoiding the Per Seat/Per Site license. The fact of the matter is you are no where big enough to enforce it. Your best bet is to set a price and sell software maintenance. Charge something around 18%-20% of the cost as a yearly fee for keeping the software up to date. Your money will come from custom modifications and the maintenance agreements.
-
Web Parts for SharePointI have to agree 100%. I was put on the task of looking into coding some custom sharepoint webparts for our company and after finding virtually no documentation on it we concluded it would be cheaper just to purchase some pre-made web parts.
-
DVDIt depends on what you are going to be burning. If you are burning DVD videos to watch then check with your DVD player, some only suppport DVD-R or DVD+R. Outside that I go with DVD-R because they are cheaper. The RW are ok if you want to reuse the DVDs, I never do so I always use DVD-R or DVD+R. I have bought expensive brand DVD-/+R's and the cheapest of the cheap and I can honestly say performance wise I have noticed no difference. Your best bet is to buy a few of a brand and test them on your drive, if they work good go for it.
-
Snow!I know snow must suck if you live in it but living in Florida that looks like fun. A bad winter in Florida means you have to wear long sleeve shirt TWICE instead of just once.
-
What do you use to play mp3's?All Hail Winamp 2! (Just ignore the bastard child known as Winamp 3)
-
Wıindows does not shut down! Heelp!Do you have some kind of loop or strangeness in your exit condition?
-
Latest and GreatestDell Axim and Viewsonic PocketPC are pretty nice as well.
-
Linux, a future?Linux will always have a home with a small minority of computer users. Simply put Linux had a snowball chance in hell of taking over mainstream. It has alot of changing to do before that. When a person can't figure out where the start button is there is no way in hell you will ever teach them how to recompile something.
-
Color in TextBoxesThis can be done thru RTF (Rich Text Format) codes via the richTextBox.rtf variable. You will need to be careful when you do this because if you break the format rules it can break the display up. If you search on MSDN you should find a list of all the codes.
-
weird string questionThe string object holds no formatting just character data.
-
Net Send EmulatorWhat exactly is a .NET batch file?
-
Are you bored with your job?I actually enjoy my job but that is most likely due to the fact I do not work for a software development company. I develop solutions for my company to use internally so it isn't day in day out the same thing. Some days it is integration applications, next day it is network management applications. All in all I am pretty happy.
-
Speaking of animals...Guns and lots of ammo!
-
Sunday Morning Thread=)
-
Sunday Morning ThreadIt's getting kind of cold here in Florida today, the high is only suppose to be 78F. =)
-
What kind of salary to expect?I know two recent graduates of college, one with a CS degree who has a job as a developer for a Government Contracter and he makes 45k/year the other is a Computer Engineer and he makes 42k/year. Remember alot of your salary depends on your location as well.