Re: Clip capture
- From: "mike williams" <mike@xxxxxxxxxxxxxxxxx>
- Date: Wed, 30 Nov 2005 10:15:00 -0000
"ProfitMaxTrading.com" <nospam@xxxxxxxxxxxxxx> wrote in message
news:7Tbjf.11031$QW2.3552@xxxxxxxxxxxxx
> I copied on purpose a greater height than width picture but
> my output shows width greater than height. So I'm obviously
> truncating my output somewhere.
I wish I could see all your code in one list, instead of seeing little bits
of it piecemeal. For example, where are you declaring the variables you use
and is their scope correct? Also, does the picture box on the separate Form
*definitely* have its Autoredraw property set to True? It needs to be. By
the way, when you say you are "getting a negative number on the hDC" do you
mean that the hDC itself is a negative number or that the returned value
from a blit or other API operation that you use on the hDC returns a
negative number. Which is it? It is possible for a hDC to be a negative
number (especially in Win XP). It's just effectively a memory address. Is
this negative nunmber *just* a negative number, ir is it a specific negative
number that usually has special significance when using API routines (-1)?
If the Autoredraw property of the picture box on the second Form is True
then you can draw into it straight away. If you draw into it when the Form
that contains it is not loaded then VB will load that Form for you. So
whether or not you show or load the form prior to blitting into its
Autoredraw picture box you shouldn't have a problem. Is the ScaleMode of the
Form in which the picture box "libves" set to pixels? And does your code set
up the picture box to the size if the blit *and* do a PictureBox.Cls
*before* you perform the blit? (see below).
When you blit to an Autoredraw picture box the blit will just go into
whatever size bitmap is currently selected into that hDC (being clipped if
the bitmap is smaller than the blit, but with the "extra bitmap area"
remaining as it previously was if the existing bitmap is larger than the
blit). This means that unless you do something about it, the resultant size
of the bitmap can be very different from the size of the blit. If you want
your blit to create a specifically sized bitmap then you *must* set the
width and height of the picture box (assuming it is borderless) to the size
you require *before* you perform the blit. And, of course, the Picture Box's
container must be set to pixels when you do set the size. Also, *and this is
a very important step*, you *must* use Cls on the picture box after you have
set its size to a new value. The Cls method removes the currently existing
bitmap from memory altogether and de-selects it from the device context.
Then, the next time you access the hDC property the system will
automatically create a new bitmap (the same pixel size as the current client
area of the picture box) and will select that new bitmap into the device
context. So, if you want a specifically sized bitmap (and if the size you
want is different from the size of the currently selected bitmap) you must
do:
Height = something
Width = something
Cls
Blit
Mike
.
- References:
- Clip capture
- From: ProfitMax Trading Inc.
- Re: Clip capture
- From: ProfitMaxTrading.com
- Re: Clip capture
- From: ProfitMaxTrading.com
- Re: Clip capture
- From: Steve Gerrard
- Re: Clip capture
- From: ProfitMaxTrading.com
- Clip capture
- Prev by Date: Re: Blinking in listview
- Previous by thread: Re: Clip capture
- Next by thread: datagrid problem of columns
- Index(es):
Relevant Pages
|