From: Peter Duniho on 26 May 2010 11:19 chandrahas tripathi wrote: > Hi, > > I want to create drawing board application that can draw Line, rectagle, > circle and free hand drawing. > > Each drawing need to be transparent, moveable (draggable), have bring to > front and send to back feature etc. > > How can I do this .. where should I start? > > Right now I have used a panel as the drawing board and each of the drawing > object (line, circle etc) as user controls overriding the OnPaintBackGround. > the user control draw on the board upon variuos mouse events as appropriate. > But I fail to acheive the transparency. What is the best way to do this?? I > mean if I drew a rectangle I draw rectagle (not a filled one) in the user > control and add it to the main drawing board but then it just make a white > rectangle hiding all the other drwing comes under the new rectangle. > > Get me a direction if I am doing some thing wrong and If I am doing it > correct what I have missing?? If you're going to go the custom control route, overriding OnPaint() is more appropriate than overriding OnPaintBackground(). However, for your purposes, you probably do not want to use any control at all for each shape. Instead, have a single custom control (inheriting just the Control class, not UserControl), in which you override OnPaint() and handle drawing each drawn object in there. Instead of letting .NET handle keeping track of the objects, you'll have to create your own data structure to do so (e.g. a list of objects, ordered back-to-front, and drawn in that order). Pete
From: Chris Dunaway on 26 May 2010 15:20 On May 26, 4:57 am, chandrahas tripathi<ctripathi...(a)gmail.com> wrote: > Hi, > > I want to create drawing board application that can draw Line, rectagle, > circle and free hand drawing. > > Each drawing need to be transparent, moveable (draggable), have bring to > front and send to back feature etc. > > How can I do this .. where should I start? > > Right now I have used a panel as the drawing board and each of the drawing > object (line, circle etc) as user controls overriding the OnPaintBackGround. > the user control draw on the board upon variuos mouse events as appropriate. > But I fail to acheive the transparency. What is the best way to do this?? I > mean if I drew a rectangle I draw rectagle (not a filled one) in the user > control and add it to the main drawing board but then it just make a white > rectangle hiding all the other drwing comes under the new rectangle. > > Get me a direction if I am doing some thing wrong and If I am doing it > correct what I have missing?? > > Thanks, > Regards, > Chandrahas > > Fromhttp://webcache.googleusercontent.com/search?q=cache:6AfTt546VjQJ:www... > > Posted via DevelopmentNow.com Groupshttp://www.developmentnow.com/g/ See this page: http://www.bobpowell.net/manipulate_graphics.htm Also, download the code for Paint.Net. That could also help you. Chris
|
Pages: 1 Prev: Remote COM server in C#? Next: Scrolling Large Text File Without Hogging Memory |