473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to put a scalable image into a form (or panel)

I'm a Java developer relatively new to to VB .NET (and I don't know
the old VB6 at all). I know how to draw lines, circles and other
simple shapes on a form in VB.NET (using the onPaint event).

Could someone out there please give me a simple example, or point me
to a SIMPLE example that:

1) puts a given JPEG (or GIF, or TIF) image into a form or panel (or
whatever other control is appropriate)

2) allows me to re-size the form or panel in the usual manner by
grabbing a corner with the mouse pointer and dragging it.
As I resize the form, the image is to re-scale itself, as appropriate,
to keep the form/panel filled completely.

Thanks for any help and advice,

Wolfgang
Santa Barbara, CA
Nov 21 '05 #1
1 2125
"Wolfgang" <rn***@nospam.ilternet.edu> schrieb:
I'm a Java developer relatively new to to VB .NET (and I don't know
the old VB6 at all). I know how to draw lines, circles and other
simple shapes on a form in VB.NET (using the onPaint event).

Could someone out there please give me a simple example, or point me
to a SIMPLE example that:

1) puts a given JPEG (or GIF, or TIF) image into a form or panel (or
whatever other control is appropriate)

2) allows me to re-size the form or panel in the usual manner by
grabbing a corner with the mouse pointer and dragging it.
As I resize the form, the image is to re-scale itself, as appropriate,
to keep the form/panel filled completely.


For example:

\\\
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms

Public Class UserControl1
Inherits Panel

Public Sub New()
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.UpdateStyles()
End Sub

Protected Overrides Sub OnPaintBackground( _
ByVal e As PaintEventArgs _
)
If Not Me.BackgroundImage Is Nothing Then
e.Graphics.DrawImage( _
Me.BackgroundImage, 0, 0, Me.Width, Me.Height _
)
End If
End Sub
End Class
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wolfgang | last post by:
I'm a Java developer relatively new to to VB .NET (and I don't know the old VB6 at all). I know how to draw lines, circles and other simple shapes on a form in VB.NET (using the onPaint event)....
2
by: Burstock | last post by:
I have a page that uses a Panel server control with a vertical scroll bar. It is in a table on the page that uses a Master page for it basic layout. Occasionally, when the page displays in IE (not...
12
by: Adil Akram | last post by:
I'm using VS 2005, .net 2.0 for a desktop application (Window Form app). I can't set ZOrder of Panel control neither at design time by toolbar/menu command "Bring to Front"/"Sent to Back" nor at...
0
by: =?Utf-8?B?RXJpYw==?= | last post by:
Hello All, I have an Image where the corners of them are set to transparent (a=0, r=255, b=255,g=255) and I load this image as a Bitmap into the BackgroundImage property of a windows panel. When...
2
by: theinvisibleGhost | last post by:
Is there any easy way of centering a label in a form or panel? I can dock, and anchor but not get my label to stay centered, short of resorting to playing with the top and left properties of the...
1
by: PeteOlcott | last post by:
Does anyone know how to make a scalable image on a DialogBox? I am currently using a static Picture Control, can this be adapted to become scalable to the size of the DialogBox?
1
by: wingsganesh | last post by:
Hi , Am working in "Pocket PC Windows Mobile 6 Professional" Using cameraCaptureDialog class i save one image in My pictures folder in Windows Mobile 6 Professional. When a button click...
0
by: Kevinst | last post by:
Hello, currently I am working on the following scenario: There is a device connected to my application. That device has a 256x256 pixel display showing graphics and text. Now for each pixel...
1
by: abdul hanan | last post by:
I want to read image form c and compress it on turbo c. #include<stdio.h> #include<conio.h> void main() { FILE*fptr; fptr=fopen("D:\\abc.jpg","r"); printf("%c",getc(fptr)); }
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
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...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
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...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.