 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andy Guest
|
Posted: Fri Oct 13, 2006 1:29 pm Post subject: Drawing bitmap image on the form |
|
|
I am trying to create an application that is similar to Windows Media Center
where I use a Resizer component to resize all controls when the screen
resolution is changed. Fonts are easy but I cannot use any of the standard
controls like combobox or even TImage. I was thinking of creating and
drawing the bitmap images on the form using the GDI and maybe I can get
it to resize accordingly. Anyone who has experience on how to do this is
greatly appreciated.
Thanking you in advance.
Andy |
|
| Back to top |
|
 |
Peter Below (TeamB) Guest
|
Posted: Fri Oct 13, 2006 11:11 pm Post subject: Re: Drawing bitmap image on the form |
|
|
Andy wrote:
| Quote: | I am trying to create an application that is similar to Windows Media
Center where I use a Resizer component to resize all controls when
the screen resolution is changed. Fonts are easy but I cannot use any
of the standard controls like combobox or even TImage. I was thinking
of creating and drawing the bitmap images on the form using the GDI
and maybe I can get it to resize accordingly. Anyone who has
experience on how to do this is greatly appreciated.
|
You can paint on the forms Canvas in the forms OnPaint event, or you
can use a TPaintbox and draw on its canvas in its OnPaint event.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be |
|
| Back to top |
|
 |
Andy Guest
|
Posted: Sat Oct 14, 2006 3:41 am Post subject: Re: Drawing bitmap image on the form |
|
|
Hi Peter,
Thanks for the tip. How do I scale and resize an image drawn this way
when the form resolution resizes, such as when using a Resizer component?
Thanks again.
Andy
"Peter Below (TeamB)" <none> wrote in message
news:xn0esfhca1l09q002 (AT) newsgroups (DOT) borland.com...
| Quote: | Andy wrote:
I am trying to create an application that is similar to Windows Media
Center where I use a Resizer component to resize all controls when
the screen resolution is changed. Fonts are easy but I cannot use any
of the standard controls like combobox or even TImage. I was thinking
of creating and drawing the bitmap images on the form using the GDI
and maybe I can get it to resize accordingly. Anyone who has
experience on how to do this is greatly appreciated.
You can paint on the forms Canvas in the forms OnPaint event, or you
can use a TPaintbox and draw on its canvas in its OnPaint event.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be |
|
|
| Back to top |
|
 |
Peter Below (TeamB) Guest
|
Posted: Sat Oct 14, 2006 6:17 pm Post subject: Re: Drawing bitmap image on the form |
|
|
Andy wrote:
| Quote: | Thanks for the tip. How do I scale and resize an image drawn this way
when the form resolution resizes, such as when using a Resizer
component?
|
Scaling a bitmap is not an easy task. You can use the
TCanvas.StretchDraw method, but the algorithm Windows uses for the task
does not always yield a good image quality. The graphics32 library
mentioned in another reply in this thread offers alternative methods
that work better. Never used it myself but is mentioned favourably
quite often in this group.
What you should always try, however, is to maintain the aspect ratio of
your original image. If that is not important to you you may as well
load the bitmap into a client-aligned TImage and set its Stretch
property to true...
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be |
|
| Back to top |
|
 |
Andy Guest
|
Posted: Wed Oct 18, 2006 1:32 pm Post subject: Re: Drawing bitmap image on the form |
|
|
Hi Peter,
Thanks again for the tip.
Andy
"Peter Below (TeamB)" <none> wrote in message
news:xn0esgo9c8zkdz001 (AT) newsgroups (DOT) borland.com...
| Quote: | Andy wrote:
Thanks for the tip. How do I scale and resize an image drawn this way
when the form resolution resizes, such as when using a Resizer
component?
Scaling a bitmap is not an easy task. You can use the
TCanvas.StretchDraw method, but the algorithm Windows uses for the task
does not always yield a good image quality. The graphics32 library
mentioned in another reply in this thread offers alternative methods
that work better. Never used it myself but is mentioned favourably
quite often in this group.
What you should always try, however, is to maintain the aspect ratio of
your original image. If that is not important to you you may as well
load the bitmap into a client-aligned TImage and set its Stretch
property to true...
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|