473,394 Members | 1,960 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,394 software developers and data experts.

Stretching the Image on MDI Form

Hi Folks,

I Want regarding the stretching image on the MDI Form?

I have one MDI Form and there is a image on that form? so that i want to stretch the image on the form according to the screen resoluation? these are the requriments i have? so please help me urgently.

Thanks & Regards
---------------------------
Mahesh
Feb 8 '08 #1
2 4988
Bum
19
Hi Mahesh,

Look at

Screen.TwipsPerPixelX
Screen.TwipsPerPixelY

You get the size of your screen this way.

if you want, you can do below, add three pictureboxes to mdiform adn make them the same size as the mdiform like

picture1.height = mdiform1.height
picture1.width= mdiform1.width

Expand|Select|Wrap|Line Numbers
  1. Public Sub Setup_Image(FileName)
  2.  
  3.   'picture1 is the main interface
  4.   'picture2 holds the original picture
  5.   'picture3 holds the resized image and transfers it to picture1
  6.  
  7.   'everyones in twips
  8.     Picture1.ScaleMode = 3
  9.     Picture2.ScaleMode = 3
  10.     Picture3.ScaleMode = 3
  11.     Me.ScaleMode = 3
  12.  
  13.     'assign our pic
  14.     Picture2.Picture = LoadPicture(FileName)
  15.  
  16.     HW = 600 'height/width 'size of our square
  17.     Picture1.Width = HW
  18.     Picture1.Height = HW
  19.     Picture3.Width = HW
  20.     Picture3.Height = HW
  21.  
  22.     'find out if the pic is tall or fat then scale to fit in box, then center
  23.      MyWidth = Picture2.Picture.Width
  24.      MyHeight = Picture2.Picture.Height
  25.  
  26.    ''find out if wider or taller, then find ratio
  27.    If MyHeight >= MyWidth Then
  28.       myRatio = MyWidth / MyHeight
  29.       MyHeight = HW
  30.       MyWidth = MyHeight * myRatio
  31.       LeftBound = (HW - MyWidth) / 2
  32.       TopBound = 0
  33.    Else
  34.       myRatio = MyHeight / MyWidth
  35.       MyWidth = HW
  36.       MyHeight = MyWidth * myRatio
  37.       LeftBound = 0
  38.       TopBound = (HW - MyHeight) / 2
  39.    End If
  40.  
  41.     Picture1.AutoRedraw = True
  42.     Picture3.AutoRedraw = True
  43.     Picture3.Cls
  44.  
  45.     Call Picture3.PaintPicture(Picture2.Picture, _
  46.                                 LeftBound, TopBound, MyWidth, MyHeight)
  47.     Picture3.Line (LeftBound, TopBound)-(MyWidth + LeftBound, MyHeight + TopBound), , B
  48.  
  49.     Picture1.Picture = Picture3.Image
  50.  
  51. End Sub

Hope this helps,

B
Feb 14 '08 #2
Killer42
8,435 Expert 8TB
mahesh123, what version of VB are you using?
Feb 15 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: Kim Scarborough | last post by:
Say I wanted to put a couple lines of asterisks between paragraphs, and have it stretch the spaces so that it spanned 100% of the text-width, like this: * * * * * ...
1
by: Jax | last post by:
Can you do this? The default for a background image on a web form is tile and i cant seem to find any options to switch that to stretch. Is this not possible? Many thanks go to any reply, even...
3
by: Raed Sawalha | last post by:
I read in MSDN an examples for Image Stretching but something I can not understand is this line e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units); what is e in all example they...
3
by: Sridhar | last post by:
Hi, I have created a user control which has the html code as follows <TABLE id="ToolBarTable" cellSpacing="0" cellPadding="0" width="100%" border="0"> <tr> <td align="right"...
4
by: Arthur Dent | last post by:
Hello all... i have a really frsutrating problem here... This is only happening in IE (6 & 7b2), Mozilla and Netscape are both OK. I have a top-level table with a width of 760px, so it should be...
14
by: rsearing | last post by:
I am new to HTML and will have to beg if this is obvious, but I am trying to design a table that looks like: ******************************** *----A------*------------------------*...
2
by: elephant | last post by:
I'm trying something in CSS, and I was wondering if anyone knows of a way to do it. The goal is to have one image with a width of 25px, and have the left 12 pixels be one side of an image of...
0
by: SayamiSuchi | last post by:
hi I have taken one image control("image1") in the form("frmForm1.aspx").Now i want to one image ("mypic.jpeg") whose size is larger than the image control i.e image1.When i run the program, the...
5
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all, I m stretching my form and i want if i stretch its position after stretching must be in middle of screen or i want to stretch centerly. Thanx >> ALI <<
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:
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
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
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
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...
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...

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.