|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Adding points to a bitmapsmall piece of a project where I need to add some annotation (let's say just some small filled rectangles as markers) to a pre-existing bitmap and then resave the bitmap. I've tried several ways of doing this but they either don't work or give errors. Anyone able to help me out please? The sort of thing I'm doing is: Dim MyBMP as Bitmap = Bitmap.Fromfile(MyFileLocation) then I've tried eg Dim gr as graphics = MyBMP.Creategraphics but get a runtime error that I can't use a bitmap with indexed pixels. I was then simply hoping to be able to say: gr.FillRectangle(brushdetails, rectangledetails) MyBMP.Save(AnnotatedFile) I could go on with the various bits of code I've tried but while I'm presuming that there is a simple approach to this, my attempts obviously haven't hit on the right combination. Thanks for any help. JGD John Dann wrote:
Show quoteHide quote > I've never had much cause to read up in detail on GDI+ but there's a This seems to be the heart of the problem. From what I have read,> small piece of a project where I need to add some annotation (let's > say just some small filled rectangles as markers) to a pre-existing > bitmap and then resave the bitmap. I've tried several ways of doing > this but they either don't work or give errors. Anyone able to help me > out please? > > The sort of thing I'm doing is: > > Dim MyBMP as Bitmap = Bitmap.Fromfile(MyFileLocation) > > then I've tried eg > > Dim gr as graphics = MyBMP.Creategraphics > > but get a runtime error that I can't use a bitmap with indexed pixels. bitmap formats with indexed colors are not given equal treatment by GDI+. If possible, I would suggest having the original image altered into a non-indexed bitmap format (eg 24 bits per pixel), then you will be able to do Dim gr As Graphics = Graphics.FromImage(MyBMP) and proceed as you had intended. You might find more useful info at Bob Powell's GDI+ site (google). -- Larry Lard Replies to group please
http://www.vbdotnetheaven.com/Sections/GDI+.asp
John Dann wrote: Show quoteHide quote >I've never had much cause to read up in detail on GDI+ but there's a >small piece of a project where I need to add some annotation (let's >say just some small filled rectangles as markers) to a pre-existing >bitmap and then resave the bitmap. I've tried several ways of doing >this but they either don't work or give errors. Anyone able to help me >out please? > >The sort of thing I'm doing is: > >Dim MyBMP as Bitmap = Bitmap.Fromfile(MyFileLocation) > >then I've tried eg > >Dim gr as graphics = MyBMP.Creategraphics > >but get a runtime error that I can't use a bitmap with indexed pixels. > >I was then simply hoping to be able to say: > >gr.FillRectangle(brushdetails, rectangledetails) > >MyBMP.Save(AnnotatedFile) > >I could go on with the various bits of code I've tried but while I'm >presuming that there is a simple approach to this, my attempts >obviously haven't hit on the right combination. > >Thanks for any help. >JGD > >
Does String mashal default to UnmanagedType.LPTStr
(newbie warning) vb.net, stdregprov, deletekey - Invalid cast Loop thru all subfolders and list all files under each use ADOX for this :-) Transparent Color in an Icon questions about VB.NET, and uses in education Is there code to convert a c# module to VB? Loading two separate instance of the same assembly Error: Cast From String to type Integer not valid score object property values against a decision rule created from from database table record values |
|||||||||||||||||||||||