-
Regarding convertion of Picture box and its contents to bitmap file.
Hi,
I need help on converting picture control along with controls on it to bmp
file.
I successfully done that Job by using BitBlt API. But, I could not able to
get the controls into bmp file, which are on the picture but, out side of
visibility of screen...
I got this help from newsgroups...
/*
The BitBlt method will not copy the parts of the picture that
do not show on the screen. You might want to search www.vbpj.com
for an article from K. E. Peterson about copying images using the
Device handle...
*/
But, I could not able to find this article..
Please let me know how to convert the whole picture box to bmp file.
Thank you,
regards,
Kiran
krallabandi@osi-tech.com
-
Re: Regarding convertion of Picture box and its contents to bitmap file.
I don't think what you want to do is possible.
Though it is possible to get the picture you then still won't get the
controls on the picturebox because they're not part of the picture.
In the VB help there is a sample on how to print a VB form with all controls
on it by redrawing it on the printer.
It should be relatively easy to change the code to redraw your picturebox
with all the controls on it to another picturebox and then SavePicture it's
content (.Image) to a bitmap file.
--
Hope this helps ...
Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de
Please reply to the newsgroup :-)
"Kiran Kumar" <krallabandi@osi-tech.com> schrieb im Newsbeitrag
news:3944d098$1@news.devx.com...
>
> Hi,
>
> I need help on converting picture control along with controls on it to bmp
> file.
> I successfully done that Job by using BitBlt API. But, I could not able to
> get the controls into bmp file, which are on the picture but, out side of
> visibility of screen...
> I got this help from newsgroups...
>
> /*
> The BitBlt method will not copy the parts of the picture that
> do not show on the screen. You might want to search www.vbpj.com
> for an article from K. E. Peterson about copying images using the
> Device handle...
> */
>
> But, I could not able to find this article..
> Please let me know how to convert the whole picture box to bmp file.
>
> Thank you,
>
> regards,
> Kiran
> krallabandi@osi-tech.com
>
-
Re: Regarding convertion of Picture box and its contents to bitmap file.
I don't think what you want to do is possible.
Though it is possible to get the picture you then still won't get the
controls on the picturebox because they're not part of the picture.
In the VB help there is a sample on how to print a VB form with all controls
on it by redrawing it on the printer.
It should be relatively easy to change the code to redraw your picturebox
with all the controls on it to another picturebox and then SavePicture it's
content (.Image) to a bitmap file.
--
Hope this helps ...
Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de
Please reply to the newsgroup :-)
"Kiran Kumar" <krallabandi@osi-tech.com> schrieb im Newsbeitrag
news:3944d098$1@news.devx.com...
>
> Hi,
>
> I need help on converting picture control along with controls on it to bmp
> file.
> I successfully done that Job by using BitBlt API. But, I could not able to
> get the controls into bmp file, which are on the picture but, out side of
> visibility of screen...
> I got this help from newsgroups...
>
> /*
> The BitBlt method will not copy the parts of the picture that
> do not show on the screen. You might want to search www.vbpj.com
> for an article from K. E. Peterson about copying images using the
> Device handle...
> */
>
> But, I could not able to find this article..
> Please let me know how to convert the whole picture box to bmp file.
>
> Thank you,
>
> regards,
> Kiran
> krallabandi@osi-tech.com
>
-
Re: Regarding convertion of Picture box and its contents to bitmap file.
That is what I want. at execution time I want to copy the contents of one
picture box into another and I want the bitmap of the source.
If u see the following you will understand my requirement...
Hi,
Now I 'll explain you all in detail...
Basic requirement is I need to incorporate print feature to our case tool.
Our Case tool is based on UML. We are drawing UML diagrams like class diagrams,
Usecase diagrams etc... We are drawing all the diagrams on a canvas screen
which is nothing but a picture control. All the figures to draw the diagram
are activeX controls. ie., all usecases, classes, boundary diagrams etc...
are activeX controls. To facilitate user we put vertical and horizontal scroll
bars to the form on which this Picture control has been placed. OK
right now we hard coded the size of picture control .
left = 0, top = 0, width = 200000 Height = 100000.
What I want is I want to convert the image on the picture control ie., including
all my activeX controls into a bitmap file. So, that I can print it using
VB print control.
For that I proceeded with small example, which consists of a form on which
2 picture boxes Source Picture1 and destination Picture2. and a command button
command1.
I made the size of the Picture1 bigger than the size of form on which it
was placed. and put some existing VB controls on Picture1 at the location
which is outside of the visibility of form. Hope u understand This is the
tricky job.
But using BitBlt API I could able to copy the portion of picture1 which is
visible on screen.
What my problem is I want to get the whole picture1 image. into a bitmap
file. I want to get the picture1 image as bmp file along with all the controls
placed on it.
Thats all..
Please make use of my code that I sent u earlier. and letme know Hoe to do..
I can able to send u the example as an attachment also. IF u provide me
mail id..
Thank you,
Please do help me at the earliest.
Here is the code:
Option Explicit
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, _
ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Command1_Click()
Dim di%
Picture1.ScaleMode = vbPixels ' Set scale to pixels.
Picture1.AutoRedraw = False ' Turn off AutoRedraw.
di = BitBlt(Picture2.hdc, 0, 0, Picture2.ScaleWidth, _
Picture2.ScaleHeight, Picture1.hdc, 0, 0, vbSrcCopy)
Picture2.Visible = False
SavePicture Picture2.Image, "C:\temp\TEMP1.bmp"
Picture2.Refresh
' Printer.PaintPicture Picture2.Image, 0, 0, Picture2.Width, Picture2.Height
' Printer.EndDoc
End Sub
Private Sub Form_Load()
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height
Picture2.ScaleMode = vbPixels
Picture1.ScaleMode = vbPixels
Picture1.AutoRedraw = True
Picture2.AutoRedraw = True
Picture2.Visible = False
End Sub
Kiran
krallabandi@osi-tech.com
"René Whitworth" <R.Whitworth@w-s-s.de> wrote:
>I don't think what you want to do is possible.
>Though it is possible to get the picture you then still won't get the
>controls on the picturebox because they're not part of the picture.
>In the VB help there is a sample on how to print a VB form with all controls
>on it by redrawing it on the printer.
>It should be relatively easy to change the code to redraw your picturebox
>with all the controls on it to another picturebox and then SavePicture it's
>content (.Image) to a bitmap file.
>
>--
>Hope this helps ...
>
>Rene Whitworth
>Whitworth Software Solutions - Germany
>http://www.w-s-s.de
>Please reply to the newsgroup :-)
>
>
>"Kiran Kumar" <krallabandi@osi-tech.com> schrieb im Newsbeitrag
>news:3944d098$1@news.devx.com...
>>
>> Hi,
>>
>> I need help on converting picture control along with controls on it to
bmp
>> file.
>> I successfully done that Job by using BitBlt API. But, I could not able
to
>> get the controls into bmp file, which are on the picture but, out side
of
>> visibility of screen...
>> I got this help from newsgroups...
>>
>> /*
>> The BitBlt method will not copy the parts of the picture that
>> do not show on the screen. You might want to search www.vbpj.com
>> for an article from K. E. Peterson about copying images using the
>> Device handle...
>> */
>>
>> But, I could not able to find this article..
>> Please let me know how to convert the whole picture box to bmp file.
>>
>> Thank you,
>>
>> regards,
>> Kiran
>> krallabandi@osi-tech.com
>>
>
>
-
Re: Regarding convertion of Picture box and its contents to bitmap file.
That is what I want. at execution time I want to copy the contents of one
picture box into another and I want the bitmap of the source.
If u see the following you will understand my requirement...
Hi,
Now I 'll explain you all in detail...
Basic requirement is I need to incorporate print feature to our case tool.
Our Case tool is based on UML. We are drawing UML diagrams like class diagrams,
Usecase diagrams etc... We are drawing all the diagrams on a canvas screen
which is nothing but a picture control. All the figures to draw the diagram
are activeX controls. ie., all usecases, classes, boundary diagrams etc...
are activeX controls. To facilitate user we put vertical and horizontal scroll
bars to the form on which this Picture control has been placed. OK
right now we hard coded the size of picture control .
left = 0, top = 0, width = 200000 Height = 100000.
What I want is I want to convert the image on the picture control ie., including
all my activeX controls into a bitmap file. So, that I can print it using
VB print control.
For that I proceeded with small example, which consists of a form on which
2 picture boxes Source Picture1 and destination Picture2. and a command button
command1.
I made the size of the Picture1 bigger than the size of form on which it
was placed. and put some existing VB controls on Picture1 at the location
which is outside of the visibility of form. Hope u understand This is the
tricky job.
But using BitBlt API I could able to copy the portion of picture1 which is
visible on screen.
What my problem is I want to get the whole picture1 image. into a bitmap
file. I want to get the picture1 image as bmp file along with all the controls
placed on it.
Thats all..
Please make use of my code that I sent u earlier. and letme know Hoe to do..
I can able to send u the example as an attachment also. IF u provide me
mail id..
Thank you,
Please do help me at the earliest.
Here is the code:
Option Explicit
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, _
ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Command1_Click()
Dim di%
Picture1.ScaleMode = vbPixels ' Set scale to pixels.
Picture1.AutoRedraw = False ' Turn off AutoRedraw.
di = BitBlt(Picture2.hdc, 0, 0, Picture2.ScaleWidth, _
Picture2.ScaleHeight, Picture1.hdc, 0, 0, vbSrcCopy)
Picture2.Visible = False
SavePicture Picture2.Image, "C:\temp\TEMP1.bmp"
Picture2.Refresh
' Printer.PaintPicture Picture2.Image, 0, 0, Picture2.Width, Picture2.Height
' Printer.EndDoc
End Sub
Private Sub Form_Load()
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height
Picture2.ScaleMode = vbPixels
Picture1.ScaleMode = vbPixels
Picture1.AutoRedraw = True
Picture2.AutoRedraw = True
Picture2.Visible = False
End Sub
Kiran
krallabandi@osi-tech.com
"René Whitworth" <R.Whitworth@w-s-s.de> wrote:
>I don't think what you want to do is possible.
>Though it is possible to get the picture you then still won't get the
>controls on the picturebox because they're not part of the picture.
>In the VB help there is a sample on how to print a VB form with all controls
>on it by redrawing it on the printer.
>It should be relatively easy to change the code to redraw your picturebox
>with all the controls on it to another picturebox and then SavePicture it's
>content (.Image) to a bitmap file.
>
>--
>Hope this helps ...
>
>Rene Whitworth
>Whitworth Software Solutions - Germany
>http://www.w-s-s.de
>Please reply to the newsgroup :-)
>
>
>"Kiran Kumar" <krallabandi@osi-tech.com> schrieb im Newsbeitrag
>news:3944d098$1@news.devx.com...
>>
>> Hi,
>>
>> I need help on converting picture control along with controls on it to
bmp
>> file.
>> I successfully done that Job by using BitBlt API. But, I could not able
to
>> get the controls into bmp file, which are on the picture but, out side
of
>> visibility of screen...
>> I got this help from newsgroups...
>>
>> /*
>> The BitBlt method will not copy the parts of the picture that
>> do not show on the screen. You might want to search www.vbpj.com
>> for an article from K. E. Peterson about copying images using the
>> Device handle...
>> */
>>
>> But, I could not able to find this article..
>> Please let me know how to convert the whole picture box to bmp file.
>>
>> Thank you,
>>
>> regards,
>> Kiran
>> krallabandi@osi-tech.com
>>
>
>
-
Re: Regarding convertion of Picture box and its contents to bitmap file.
As in my previous posting, you will have to REDRAW your controls.
A control placed on a picturebox will never be part of the picture, so
you'll have to draw it's face into the picture.
You don't need any BitBlt() code for this.
An example of what you need is in the VB help file, just find the topic on
printing a form.
--
Hope this helps ...
Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de
Please reply to the newsgroup :-)
"Kiran Kumar" <krallabandi@osi-tech.com> schrieb im Newsbeitrag
news:394636f4@news.devx.com...
>
> That is what I want. at execution time I want to copy the contents of one
> picture box into another and I want the bitmap of the source.
>
> If u see the following you will understand my requirement...
>
> Hi,
> Now I 'll explain you all in detail...
> Basic requirement is I need to incorporate print feature to our case tool.
> Our Case tool is based on UML. We are drawing UML diagrams like class
diagrams,
> Usecase diagrams etc... We are drawing all the diagrams on a canvas screen
> which is nothing but a picture control. All the figures to draw the
diagram
> are activeX controls. ie., all usecases, classes, boundary diagrams etc...
> are activeX controls. To facilitate user we put vertical and horizontal
scroll
> bars to the form on which this Picture control has been placed. OK
> right now we hard coded the size of picture control .
> left = 0, top = 0, width = 200000 Height = 100000.
>
> What I want is I want to convert the image on the picture control ie.,
including
> all my activeX controls into a bitmap file. So, that I can print it using
> VB print control.
>
> For that I proceeded with small example, which consists of a form on which
> 2 picture boxes Source Picture1 and destination Picture2. and a command
button
> command1.
>
> I made the size of the Picture1 bigger than the size of form on which it
> was placed. and put some existing VB controls on Picture1 at the location
> which is outside of the visibility of form. Hope u understand This is the
> tricky job.
>
> But using BitBlt API I could able to copy the portion of picture1 which is
> visible on screen.
>
> What my problem is I want to get the whole picture1 image. into a bitmap
> file. I want to get the picture1 image as bmp file along with all the
controls
> placed on it.
>
> Thats all..
> Please make use of my code that I sent u earlier. and letme know Hoe to
do..
> I can able to send u the example as an attachment also. IF u provide me
> mail id..
>
> Thank you,
> Please do help me at the earliest.
>
> Here is the code:
>
> Option Explicit
> Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
> ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
> ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, _
> ByVal ySrc As Long, ByVal dwRop As Long) As Long
>
> Private Sub Command1_Click()
> Dim di%
> Picture1.ScaleMode = vbPixels ' Set scale to pixels.
> Picture1.AutoRedraw = False ' Turn off AutoRedraw.
> di = BitBlt(Picture2.hdc, 0, 0, Picture2.ScaleWidth, _
> Picture2.ScaleHeight, Picture1.hdc, 0, 0, vbSrcCopy)
> Picture2.Visible = False
> SavePicture Picture2.Image, "C:\temp\TEMP1.bmp"
> Picture2.Refresh
> ' Printer.PaintPicture Picture2.Image, 0, 0, Picture2.Width,
Picture2.Height
> ' Printer.EndDoc
> End Sub
>
> Private Sub Form_Load()
> Picture2.Width = Picture1.Width
> Picture2.Height = Picture1.Height
> Picture2.ScaleMode = vbPixels
> Picture1.ScaleMode = vbPixels
> Picture1.AutoRedraw = True
> Picture2.AutoRedraw = True
> Picture2.Visible = False
> End Sub
>
>
>
>
> Kiran
> krallabandi@osi-tech.com
>
>
>
> "René Whitworth" <R.Whitworth@w-s-s.de> wrote:
> >I don't think what you want to do is possible.
> >Though it is possible to get the picture you then still won't get the
> >controls on the picturebox because they're not part of the picture.
> >In the VB help there is a sample on how to print a VB form with all
controls
> >on it by redrawing it on the printer.
> >It should be relatively easy to change the code to redraw your picturebox
> >with all the controls on it to another picturebox and then SavePicture
it's
> >content (.Image) to a bitmap file.
> >
> >--
> >Hope this helps ...
> >
> >Rene Whitworth
> >Whitworth Software Solutions - Germany
> >http://www.w-s-s.de
> >Please reply to the newsgroup :-)
> >
> >
> >"Kiran Kumar" <krallabandi@osi-tech.com> schrieb im Newsbeitrag
> >news:3944d098$1@news.devx.com...
> >>
> >> Hi,
> >>
> >> I need help on converting picture control along with controls on it to
> bmp
> >> file.
> >> I successfully done that Job by using BitBlt API. But, I could not able
> to
> >> get the controls into bmp file, which are on the picture but, out side
> of
> >> visibility of screen...
> >> I got this help from newsgroups...
> >>
> >> /*
> >> The BitBlt method will not copy the parts of the picture that
> >> do not show on the screen. You might want to search www.vbpj.com
> >> for an article from K. E. Peterson about copying images using the
> >> Device handle...
> >> */
> >>
> >> But, I could not able to find this article..
> >> Please let me know how to convert the whole picture box to bmp file.
> >>
> >> Thank you,
> >>
> >> regards,
> >> Kiran
> >> krallabandi@osi-tech.com
> >>
> >
> >
>
-
Re: Regarding convertion of Picture box and its contents to bitmap file.
As in my previous posting, you will have to REDRAW your controls.
A control placed on a picturebox will never be part of the picture, so
you'll have to draw it's face into the picture.
You don't need any BitBlt() code for this.
An example of what you need is in the VB help file, just find the topic on
printing a form.
--
Hope this helps ...
Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de
Please reply to the newsgroup :-)
"Kiran Kumar" <krallabandi@osi-tech.com> schrieb im Newsbeitrag
news:394636f4@news.devx.com...
>
> That is what I want. at execution time I want to copy the contents of one
> picture box into another and I want the bitmap of the source.
>
> If u see the following you will understand my requirement...
>
> Hi,
> Now I 'll explain you all in detail...
> Basic requirement is I need to incorporate print feature to our case tool.
> Our Case tool is based on UML. We are drawing UML diagrams like class
diagrams,
> Usecase diagrams etc... We are drawing all the diagrams on a canvas screen
> which is nothing but a picture control. All the figures to draw the
diagram
> are activeX controls. ie., all usecases, classes, boundary diagrams etc...
> are activeX controls. To facilitate user we put vertical and horizontal
scroll
> bars to the form on which this Picture control has been placed. OK
> right now we hard coded the size of picture control .
> left = 0, top = 0, width = 200000 Height = 100000.
>
> What I want is I want to convert the image on the picture control ie.,
including
> all my activeX controls into a bitmap file. So, that I can print it using
> VB print control.
>
> For that I proceeded with small example, which consists of a form on which
> 2 picture boxes Source Picture1 and destination Picture2. and a command
button
> command1.
>
> I made the size of the Picture1 bigger than the size of form on which it
> was placed. and put some existing VB controls on Picture1 at the location
> which is outside of the visibility of form. Hope u understand This is the
> tricky job.
>
> But using BitBlt API I could able to copy the portion of picture1 which is
> visible on screen.
>
> What my problem is I want to get the whole picture1 image. into a bitmap
> file. I want to get the picture1 image as bmp file along with all the
controls
> placed on it.
>
> Thats all..
> Please make use of my code that I sent u earlier. and letme know Hoe to
do..
> I can able to send u the example as an attachment also. IF u provide me
> mail id..
>
> Thank you,
> Please do help me at the earliest.
>
> Here is the code:
>
> Option Explicit
> Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
> ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
> ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, _
> ByVal ySrc As Long, ByVal dwRop As Long) As Long
>
> Private Sub Command1_Click()
> Dim di%
> Picture1.ScaleMode = vbPixels ' Set scale to pixels.
> Picture1.AutoRedraw = False ' Turn off AutoRedraw.
> di = BitBlt(Picture2.hdc, 0, 0, Picture2.ScaleWidth, _
> Picture2.ScaleHeight, Picture1.hdc, 0, 0, vbSrcCopy)
> Picture2.Visible = False
> SavePicture Picture2.Image, "C:\temp\TEMP1.bmp"
> Picture2.Refresh
> ' Printer.PaintPicture Picture2.Image, 0, 0, Picture2.Width,
Picture2.Height
> ' Printer.EndDoc
> End Sub
>
> Private Sub Form_Load()
> Picture2.Width = Picture1.Width
> Picture2.Height = Picture1.Height
> Picture2.ScaleMode = vbPixels
> Picture1.ScaleMode = vbPixels
> Picture1.AutoRedraw = True
> Picture2.AutoRedraw = True
> Picture2.Visible = False
> End Sub
>
>
>
>
> Kiran
> krallabandi@osi-tech.com
>
>
>
> "René Whitworth" <R.Whitworth@w-s-s.de> wrote:
> >I don't think what you want to do is possible.
> >Though it is possible to get the picture you then still won't get the
> >controls on the picturebox because they're not part of the picture.
> >In the VB help there is a sample on how to print a VB form with all
controls
> >on it by redrawing it on the printer.
> >It should be relatively easy to change the code to redraw your picturebox
> >with all the controls on it to another picturebox and then SavePicture
it's
> >content (.Image) to a bitmap file.
> >
> >--
> >Hope this helps ...
> >
> >Rene Whitworth
> >Whitworth Software Solutions - Germany
> >http://www.w-s-s.de
> >Please reply to the newsgroup :-)
> >
> >
> >"Kiran Kumar" <krallabandi@osi-tech.com> schrieb im Newsbeitrag
> >news:3944d098$1@news.devx.com...
> >>
> >> Hi,
> >>
> >> I need help on converting picture control along with controls on it to
> bmp
> >> file.
> >> I successfully done that Job by using BitBlt API. But, I could not able
> to
> >> get the controls into bmp file, which are on the picture but, out side
> of
> >> visibility of screen...
> >> I got this help from newsgroups...
> >>
> >> /*
> >> The BitBlt method will not copy the parts of the picture that
> >> do not show on the screen. You might want to search www.vbpj.com
> >> for an article from K. E. Peterson about copying images using the
> >> Device handle...
> >> */
> >>
> >> But, I could not able to find this article..
> >> Please let me know how to convert the whole picture box to bmp file.
> >>
> >> Thank you,
> >>
> >> regards,
> >> Kiran
> >> krallabandi@osi-tech.com
> >>
> >
> >
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks