Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Tue, 08 Jul 2008 11:02:16 +0200,    group: microsoft.public.dotnet.framework.compactframework        back       


How to draw into a bitmap and then display this bitmap?   
Hello,

using CF 1.0 how to do the following:

- have some bitmap
- draw lines and text into it
- put it onto screen (as a whole with a fast copy
   operation or similar)
- avoid drawing directly on the screen
- with measures available either in CF 1.0 or Win32
   directly thus avoiding 3rd party libraries like
   OpenNET CF or similar

Greetings

Markus
date: Tue, 08 Jul 2008 11:02:16 +0200   author:   Markus Humm

Re: How to draw into a bitmap and then display this bitmap?   
On 2008-07-08 10:02:16 +0100, Markus Humm  said:

> Hello,
> 
> using CF 1.0 how to do the following:
> 
> - have some bitmap
> - draw lines and text into it
> - put it onto screen (as a whole with a fast copy
>    operation or similar)
> - avoid drawing directly on the screen
> - with measures available either in CF 1.0 or Win32
>    directly thus avoiding 3rd party libraries like
>    OpenNET CF or similar
> 
> Greetings
> 
> Markus

You should be able to piece the code together yourself from MSDN and 
the numerous .NET Compact Framework books on the market. The code below 
is the simplest of examples.

Pen p =  new Pen(Color.White);

Brush b = new SolidBrush(Color.White);

Font f = new Font("Arial", 10.0F, FontStyle.Bold);



// - have some bitmap
// - avoid drawing directly on the screen

Bitmap offscreenBmp = new Bitmap(@"\My Documents\My Pictures\Flower.jpg");



// - draw lines and text into it

Graphics g = Graphics.FromImage(offscreenBmp);

g.DrawLine(p, 0, 65, 240, 65);

g.DrawString("This is some text", f, b, 70, 50);



// - put it onto screen (as a whole with a fast copy

//   operation or similar)

pictureBox1.Image = offscreenBmp;

-- 
Neil Cowburn MVP
Principal Partner
OpenNETCF Consulting
date: Tue, 8 Jul 2008 11:24:21 +0100   author:   Neil Cowburn neilc@[nospam]opennetcf.[nospam]com

Re: How to draw into a bitmap and then display this bitmap?   
Hello,

your solution works but is "slow like hell".
Any idea about that? Or how to obtain the HDC of the bitmap to use the 
BitBlt functions from Win32 GDI API? under CF 1.0 this is not accessible 
as such.

Greetings

Markus
date: Tue, 15 Jul 2008 20:19:37 +0200   author:   Markus Humm

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us