Solved

mdiform interface

Posted on 2000-02-23
8
327 Views
Last Modified: 2010-05-02
I have a picture and I want this picture to be mdiform background like monitor wallpaper (display title or center). how can I do it?
0
Comment
Question by:firza
  • 6
  • 2
8 Comments
 

Author Comment

by:firza
ID: 2549669
Adjusted points to 200
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2549736
This code ought to work... see www.mvps.org/vbnet for other useful stuff

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2000 VBnet, Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' You are free to use this code within your own applications,
' but you are expressly forbidden from selling or otherwise
' distributing this source code without prior written consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub Form_Paint()

    Dim X As Integer, Y As Integer
    Dim ImgWidth As Integer
    Dim ImgHeight As Integer
    Dim FrmWidth As Integer
    Dim FrmHeight As Integer

   'use Image1 or Picture1, as appropriate.
   'use one of the following PaintPicture methods:
    ImgWidth = Image1.Width
    ImgHeight = Image1.Height
    FrmWidth = Form1.Width
    FrmHeight = Form1.Height
   
   'tile entire form (Method 1)
    For X = 0 To FrmWidth Step ImgWidth
       For Y = 0 To FrmHeight Step ImgHeight
          PaintPicture Image1, X, Y      
       Next Y
    Next X

   'tile left side (Method 2)
   'For Y = 0 To FrmHeight Step ImgHeight
   '   PaintPicture Image1, 0, Y
   'Next Y
   
End Sub
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2549745
To centre... replace the for..next loop with

paintpicture image1, frmwidth-imgwidth, frmheight-imgheight
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 3

Expert Comment

by:paulstamp
ID: 2549773
Sorry.. code above wont work with MDI Parent...

I did have some code somewhere to do it... I'll post if I can find it.
0
 
LVL 3

Accepted Solution

by:
paulstamp earned 200 total points
ID: 2549801
Actually... you can use the code I listed above to achieve what you want.

Create two forms... an MDI parent and a normal form. Add two picture boxes on the normal form and set their visible prop to false. Call 1 picSource and the other picTarget and put the bitmap you want to use in the picTarget.

Then place a button on the form and use the following code in its click event.

   Dim X As Integer, Y As Integer
    Dim ImgWidth As Integer
    Dim ImgHeight As Integer
    Dim FrmWidth As Integer
    Dim FrmHeight As Integer
   
    picTarget.Width = MDIForm1.ScaleWidth
    picTarget.Height = MDIForm1.ScaleHeight



   'use Image1 or picTarget, as appropriate.
   'use one of the following PaintPicture methods:
    ImgWidth = picSource.Width
    ImgHeight = picSource.Height
    FrmWidth = picTarget.Width
    FrmHeight = picTarget.Height
     
    For X = 0 To FrmWidth Step ImgWidth
       For Y = 0 To FrmHeight Step ImgHeight
          picTarget.PaintPicture picSource.Picture, X, Y
       Next Y
    Next X

    Set MDIForm1.Picture = picTarget.Image
    MDIForm1.Show

That ought to do the trick.
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2549803
Spot the delibrate mistake - you should put the source image in picSource, not picTarget !
0
 

Author Comment

by:firza
ID: 2553039
i use MDI Perent
so what height scale use for MDIForm1.Picture use?

i don't want a normal form appear at MDI Perent? when I put the source image in picSource not picture in MDIPerent


coding your give not answering my question.


0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2553481
Leave the scalemode of the MDI parent and the picture boxes as Twips.

Instead of using another normal form you could place both the picture box es directly onto the MDI parent and resize the target to fill the entire client area.This way you dont need another form, and also you dont need to copy the picture from a picture box onto the form's picture property either.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question