473,395 Members | 1,504 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 2124
"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
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...
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
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
jinu1996
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 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.