Problem: The PictureBox display appears to have the image cut off. I.e.,
the image bottom does not display although the PictureBox has room for it.
It occurred to me that what was displayed was the same size as the
PictureBox was before it was resized. So I figured the bitmap was too small
and tried to increase it's size as shown below.
Two things: First it didn't fix the problem.
Secondly, I'm not sure I've done it correctly and further don't know to
finish the code (see the commented out code.
Any helpful suggestions would be appreciated:
Cal
PS The image was created by drawing strings.
Private Sub picData_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles picData.Resize
If Not ((g1 Is Nothing) Or (b1 Is Nothing)) Then
Dim g2 As Drawing.Graphics = picData.CreateGraphics
Dim b2 As Drawing.Bitmap = New Drawing.Bitmap(picData.Width, picData.Height,
g2)
g2.DrawImage(b2, 0, 0)
'g1.Dispose()
'b1.Dispose()
'g1 = g2
'b1 = b2
End If
End Sub 2 2138
I think what you want to do is instead of using a graphics object, just use
the picture box itself.
for example, do "PictureBox1.Image = b2" instead of trying to set the
graphics object itself. You shouldn't even have to do any resize events
then either, because the picturebox will handle all of that.
HTH
Josh Moody
VSU Team
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
-------------------- From: " active" <ac****@REMOVEa-znet.com> Subject: Resizing a PictureBox bitmap Date: Tue, 9 Dec 2003 09:30:46 -0500 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <Oc**************@TK2MSFTNGP10.phx.gbl> Newsgroups: microsoft.public.dotnet.languages.vb NNTP-Posting-Host: AC880E7D.ipt.aol.com 172.136.14.125 Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP10.phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:162444 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Problem: The PictureBox display appears to have the image cut off. I.e., the image bottom does not display although the PictureBox has room for it.
It occurred to me that what was displayed was the same size as the PictureBox was before it was resized. So I figured the bitmap was too
smalland tried to increase it's size as shown below.
Two things: First it didn't fix the problem.
Secondly, I'm not sure I've done it correctly and further don't know to finish the code (see the commented out code.
Any helpful suggestions would be appreciated:
Cal
PS The image was created by drawing strings.
Private Sub picData_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles picData.Resize
If Not ((g1 Is Nothing) Or (b1 Is Nothing)) Then
Dim g2 As Drawing.Graphics = picData.CreateGraphics
Dim b2 As Drawing.Bitmap = New Drawing.Bitmap(picData.Width,
picData.Height,g2)
g2.DrawImage(b2, 0, 0)
'g1.Dispose()
'b1.Dispose()
'g1 = g2
'b1 = b2
End If
End Sub
I use a graphics object to draw on a bitmap so that I can do
e.Graphics.DrawImage(b1, 0, 0)
in the pictutebox paint event. I believe I need to store the image
someplace for paint. The user draws the image (think Photoshop) so I can't
recreate it at will.
I don't have a good knowledge of this so I wonder if with the above, do you
still think I could do as you suggest??
Thanks
"Josh Moody [MSFT]" <Jo********@online.microsoft.com> wrote in message
news:Oh**************@cpmsftngxa07.phx.gbl... I think what you want to do is instead of using a graphics object, just
use the picture box itself.
for example, do "PictureBox1.Image = b2" instead of trying to set the graphics object itself. You shouldn't even have to do any resize events then either, because the picturebox will handle all of that.
HTH
Josh Moody VSU Team
--
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated. --------------------From: " active" <ac****@REMOVEa-znet.com> Subject: Resizing a PictureBox bitmap Date: Tue, 9 Dec 2003 09:30:46 -0500 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <Oc**************@TK2MSFTNGP10.phx.gbl> Newsgroups: microsoft.public.dotnet.languages.vb NNTP-Posting-Host: AC880E7D.ipt.aol.com 172.136.14.125 Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08 phx.gbl!TK2MSFTNGP10.phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:162444 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Problem: The PictureBox display appears to have the image cut off. I.e., the image bottom does not display although the PictureBox has room for
it. It occurred to me that what was displayed was the same size as the PictureBox was before it was resized. So I figured the bitmap was too smalland tried to increase it's size as shown below.
Two things: First it didn't fix the problem.
Secondly, I'm not sure I've done it correctly and further don't know to finish the code (see the commented out code.
Any helpful suggestions would be appreciated:
Cal
PS The image was created by drawing strings.
Private Sub picData_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles picData.Resize
If Not ((g1 Is Nothing) Or (b1 Is Nothing)) Then
Dim g2 As Drawing.Graphics = picData.CreateGraphics
Dim b2 As Drawing.Bitmap = New Drawing.Bitmap(picData.Width, picData.Height,g2)
g2.DrawImage(b2, 0, 0)
'g1.Dispose()
'b1.Dispose()
'g1 = g2
'b1 = b2
End If
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sharon |
last post by:
I encountered a strange behavior when doing ‘new Bitmap’:
The following code works fine and the given bitmap file is shown on the
PictureBox (the m_DrawArea) in the correct bitmap sizes:
...
|
by: David Ricker |
last post by:
I have created a PictureBox control which can have it's Image property
directly bound to an image field in a database. This works perfectly for
showing the images that are in the database. When I...
|
by: active |
last post by:
I draw text in a bitmap and then draw the bitmap on a picturebox and get text that is not all displayed the same.
Note the different text style in the (40, 100) area.
Got any insight into...
|
by: akh |
last post by:
I want to use de Drag and Drop ´s event to move a picture box from a
form and within a Picture Box.
But I have behaviour if the MyPBox As PictureBox as the Globale
varible or not
Thanks for...
|
by: Mad Scientist Jr |
last post by:
I have a bitmap (32 pixels high, 8192 pixels wide) that contains 255
images, each 32 pixels wide, that I would like to chop up into
individual 32x32 bitmap files. Rather than spending hours in...
|
by: kebalex |
last post by:
Hi,
I have an app (written in .NET 2.0) which updates a picturebox
according to some user input (a slider control). when the user makes a
change i loop through all of the pixels, do a...
|
by: GoGs |
last post by:
How this vb6 code convert in c# dotnet2
-----
Image1.Visible = False
Image1.Picture = LoadPicture("c:\image008.jpg")
Dim x, y As Single
x = Image1.Width
y = Image1.Height
Do While x...
|
by: gerardianlewis |
last post by:
Any help appreciated.
(VB.NET under XP and Vista, SP1 installed)
My code, inherited from a VB6 version of an app that ran under W98,
loads an image from a file into a PictureBox. The user may...
|
by: =?Utf-8?B?U2hhcm9u?= |
last post by:
Using VS2005 with .NET Framework 2.0
I'm using the the System.Windows.Forms.PictureBox to display a bitmap when
the PictureBox.SizeMode is PictureBoxSizeMode.StretchImage
The PictureBox can be...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |