Difference between .Backgroundimage and .Image paint behavior Form vs Picturebox.

In this code when I copy the image to picturebox1.background image the form does not paint the controls on startup and the paint event keeps firing repeatedly. When copy image to picturebox1.image the form starts properly and the paint event does not fire
(unless needed).
What is the difference between the .backgroundimage and .image that makes the form not paint the controls but repeatedly fire the form paint event?
Same behaviour if a form backgroundimage is used, but it does not have image property so it cant be stopped if copying to a form background?
Thanks.
Public Class Form6
Private Sub Form6_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
Static t As Integer
t += 1
Me.Text = t.ToString
Using bmp As New Bitmap(400, 400)
Using g As Graphics = Graphics.FromImage(bmp)
g.Clear(Color.Red)
PictureBox1.Image = bmp.Clone
End Using
End Using
End Sub
Private Sub Form6_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.DoubleBuffered = True
End Sub
End Class
Copy to picturebox1.backgroundimages gives this startup without the controls painted and the form paint is continuously firing as can be seen in the form header text:
Copy to picturebox1.image and form startups up properly and does not keep firing form paint.
Edit: removed         Me.Location = New Point(200, 100)
That does not cause a problem.

Hey Tom,
 Well, i have been playing around monitoring the windows messages received by the form and the picturebox to see what was happening.  I found the messages start changing right after the picturebox receives it`s first Paint message. Here is where
they start changing.
Using Image Property these are all the massages received after its first paint message is received.
PictureBox - msg=0xf (WM_PAINT) hwnd=0x37037c wparam=0x0 lparam=0x0 result=0x0
Form - msg=0x14 (WM_ERASEBKGND) hwnd=0x1303c4 wparam=0xffffffffeb0108b7 lparam=0x0 result=0x1
Form - msg=0xe (WM_GETTEXTLENGTH) hwnd=0x1303c4 wparam=0x0 lparam=0x0 result=0x5
Form - msg=0xd (WM_GETTEXT) hwnd=0x1303c4 wparam=0x6 lparam=0x342ee08 result=0x5
Form - msg=0xe (WM_GETTEXTLENGTH) hwnd=0x1303c4 wparam=0x0 lparam=0x0 result=0x5
Form - msg=0xd (WM_GETTEXT) hwnd=0x1303c4 wparam=0x6 lparam=0x342ee08 result=0x5
Form - msg=0x318 (WM_PRINTCLIENT) hwnd=0x1303c4 wparam=0xffffffffeb0108b7 lparam=0x4 result=0x0
PictureBox - msg=0x14 (WM_ERASEBKGND) hwnd=0x37037c wparam=0x9010329 lparam=0x0 result=0x1
PictureBox - msg=0xe (WM_GETTEXTLENGTH) hwnd=0x37037c wparam=0x0 lparam=0x0 result=0x0
PictureBox - msg=0xd (WM_GETTEXT) hwnd=0x37037c wparam=0x1 lparam=0x342ede8 result=0x0
PictureBox - msg=0xe (WM_GETTEXTLENGTH) hwnd=0x37037c wparam=0x0 lparam=0x0 result=0x0
PictureBox - msg=0xd (WM_GETTEXT) hwnd=0x37037c wparam=0x1 lparam=0x342ede8 result=0x0
PictureBox - msg=0xf (WM_PAINT) hwnd=0x37037c wparam=0x0 lparam=0x0 result=0x0
 Using the BackgroundImage property these are the messages received after the first picturebox Paint message is received. The last 6 messages just keep repeating until the app is closed.
PictureBox - msg=0xf (WM_PAINT) hwnd=0x38037c wparam=0x0 lparam=0x0 result=0x0
PictureBox - msg=0x14 (WM_ERASEBKGND) hwnd=0x38037c wparam=0x9010329 lparam=0x0 result=0x1
PictureBox - msg=0xe (WM_GETTEXTLENGTH) hwnd=0x38037c wparam=0x0 lparam=0x0 result=0x0
PictureBox - msg=0xd (WM_GETTEXT) hwnd=0x38037c wparam=0x1 lparam=0x3430160 result=0x0
PictureBox - msg=0xe (WM_GETTEXTLENGTH) hwnd=0x38037c wparam=0x0 lparam=0x0 result=0x0
PictureBox - msg=0xd (WM_GETTEXT) hwnd=0x38037c wparam=0x1 lparam=0x3430160 result=0x0
PictureBox - msg=0xf (WM_PAINT) hwnd=0x38037c wparam=0x0 lparam=0x0 result=0x0
PictureBox - msg=0x14 (WM_ERASEBKGND) hwnd=0x38037c wparam=0x9010329 lparam=0x0 result=0x1
PictureBox - msg=0xe (WM_GETTEXTLENGTH) hwnd=0x38037c wparam=0x0 lparam=0x0 result=0x0
PictureBox - msg=0xd (WM_GETTEXT) hwnd=0x38037c wparam=0x1 lparam=0x3430160 result=0x0
PictureBox - msg=0xe (WM_GETTEXTLENGTH) hwnd=0x38037c wparam=0x0 lparam=0x0 result=0x0
PictureBox - msg=0xd (WM_GETTEXT) hwnd=0x38037c wparam=0x1 lparam=0x3430160 result=0x0
 So that made me wonder how they differed in the BackGroundImage and Image properties of the PictureBox class when being painted.  I looked at the .Net source code for the picturebox class HERE
and found that the PictureBox class is inherited from the Control base class and the Image property is a special property added to the picturebox class and is handled in its OnPaint event.  The BackgroundImage is a property of the Control base class that
the picturebox class inherits from.  So, that is handled in the base class somehow.
 I looked at the Control class code but, it is so much different than what i am use to looking at that i could not really follow what it was doing.  So, in the end i still don`t have an answer but, i can only guess that setting the BackgroundImage
inside the Paint event of the form is somehow stopping the Form from receiving the 6 messages shown in the first set of messages shown which is causing it to never finish painting itself.
 Maybe Crazypennie or someone with a deeper knowledge into the "behind the scenes" workings of it can say what the difference is. I figured that changing the backgroundimage was causing the form to receive a new paint message and was going
into an infinite loop but, according to the messages i was getting after the picturebox`s 1st paint message, the form never receives another message.
 I know this probably won`t help but, if you want to create a new backgroundimage for the picturebox and modify it each time the form is painted you could just assign the picturebox a new bitmap at Load and then use the graphics object of the PictureBox.BackgroundImage
to redraw it in the paint event instead of creating a new bitmap for it each time the form is painted.
Public Class Form1
Private bmp As New Bitmap(400, 400)
Private Sub Form6_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Me.DoubleBuffered = True
PictureBox1.BackgroundImage = bmp
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles Me.Paint
Using g As Graphics = Graphics.FromImage(PictureBox1.BackgroundImage)
g.Clear(Color.Red)
End Using
End Sub
End Class
 Or i guess just use the Image property instead.  8)
If you say it can`t be done then i`ll try it

Similar Messages

  • What's the difference between Generators and Image Units?

    Hi
    What's the difference (in layman terms) between the Generators and Image Units in the Library?

    I may be wrong, but I believe that Image Units are part of the operating system (core video, core gfx, etc), thus can change with OS changes. Generators and filters are coded specific to Motion...
    Patrick

  • In smart forms-- difference between table and template

    can you please tell me what is the difference between table and template in smart forms,
    and als give me some object developed in smart forms.

    it is not recommended because, when ever we activate the smartform it generates one function module.
    if we transport that driver program and smartform to testing or production, in that server the generated function module name will be differ.
    hope u got it.
    for this we need to use these function modules.
    SSF_FUNCTION_MODULE_NAME
    FM_NAME
    regards.
    santhosh reddy
    reward if useful
    Edited by: Santhosh Reddy on Feb 16, 2008 7:52 PM

  • Difference between CS3 and CS4 when placing images, percentage not kept

    There is some kind of difference between CS3 and CS4 when placing images. The images I've dealt with right now were vector images but it might apply to all kinds of images.
    When replacing an existing image, the CS4 behaviour is to let the image fill up the frame. In CS3 the percentage was set to 100% as default (the % you see when selecting the image, not the container).
    Also when replacing an impage in CS4, the "inner" image frame is kept, while in C3, the percentage was kept.
    Is there some kind of placement preferences / settings to let CS4 act the same wat as CS3 did, when placing an image?
    -- Andreas

    Yes, the behavior was changed in CS4 (and many users, like me, prefer the new system).
    If you click and drag a loaded image place cursor the entire image will be be scaled to fit the proportionally drawn frame -- a huge timesaver if you mostly place uncropped art. If you want 100% of the image at 100% scale, just click and release -- same as before, or as before you can pre-draw a frame and place into it and your image will come in cropped at 100% (unless you've changed the fitting options for the frame before placing).
    Peter

  • Difference between "Export" and "Export form Fact Table" package

    Hi experts!
    Could you tell me what is the difference between "Export" and "Export form Fact Table" package?
    Tkanks
    Gabriel

    Hi,
    Basic difference between Export and Export from Fact Table is
    In standard package "Export" : We can perform this function when we are online and we have adequate amount of data to be exported. We can run this package eg: weekly or monthly. Here we use u201CExport Packageu201D to pull the data
    And in the administrative package "Export from Fact Table"   Mostly it is used to do the backend data loading  basically bulk data , also any formula logic has to be implemented on the data in that case we use the administrative package.
    Hope this helps.

  • Differences between standard and pro versions

    I was reading the comparision of these two Acrobat versions and for Pro it says:
    Edit and enhance photos to add to your PDF communications with Adobe Photoshop® CS5.
    Quickly transform static PowerPoint slides into compelling, interactive PDF presentations with Adobe Presenter       
    Rapidly combine screen recordings, narration, video, slides, and more into a rich media experience with Adobe Captivate® 5
    Does that mean that the Pro version includes Photoshop, Presenter and Captivate programs as well? Or, what are the differences? As an aside, the new look and feel of the Adobe website is confusing at best. Seems geared to being flashy, not useful.
    Regards, David

    Acrobat does not included those other packages. One of the pages that always struck me funny (maybe I have a twisted mind) but has this artistic background is the updates page. The background looks like a lacy bra to me. It is the first thing that comes to mind every time I see it. That is a problem with abstract images (that are typically unnecessary and waste bandwidth), that a lot is in the eye of the beholder. Actually, I have heard from many others that also see the bra.
    OK, back to Acrobat. There are several aspects of Acrobat that allow you to have links to the other products built in, but they are not included. The page at http://www.adobe.com/products/acrobatpro/buying-guide.html?promoid=JIJYS provides some info, but a lot is missing. For instance there are differences with PDF Optimize and Reduce File Size I think (sorry, I do not have Std to check). One important one that is part of pro is the preflight option. Apparently Std does not include portfolios or allow PDF comparison according to the chart.
    If you are into forms, then Std apparently will do them as AcroForms (my preference, partially because of familiarity), but does not include Designer if that was your preference. Some of the enabling for Reader is not available in Std. Also, Std does not allow embedding Flash. Std is limited for some of the products that include PDF Maker (not a big one for me, but might be important to you).
    That is a quick summary based on the chart. However, be aware there are some other features that the chart does not seem to cover. For the difference between Std and Pro, I would suggest getting Pro. The big hit is the initial cost of the product, not the step up to Pro. In a business plan consider the time that might be wasted trying to do some of the things in Pro that are not in Std. Those are the types of issues to consider. Many folks consider the cost to be large, and for a small business it is. However, in the long term it may be worth the cost.
    Keep in mind that many large CAD packages in engineering run about $30,000 for a single license, half the cost of the engineer that would use it. Some other tools are about $15,000. In that view, Acrobat is cheap (except for cheapskates like me).

  • What's the difference between tags and albums

    I've always used tags, I don't really understand why you would use albums instead of tags.
    Say I've got pictures of birds, I would apply the Bird tag.
    Where exactly do albums come in?

    Another thing to keep in mind with the differences between albums and tags.
    Both albums and tags are stored in the catalogs.
    Tags can be also stored in the picture files themselves; they can be accessed form your OS or other applications. They are still available if the catalog is missing or corrupt. The organizer does only 'write metadata' to files if you specifically issue this command. On the other hand, albums can't be saved in the files themselves. They are kinds of  'playlists' which can only be stored in catalogs. That's why it is important to backup regularly. The standard backup process saves the catalogs as well as the image files; if you use an external backup system, include the catalog folder (found with Menu Help/System information) as well in your backup procedure.

  • What is the difference between avi and mov

    Hi FCP users,
    I am actually an audio guy, but I would like an answer on something.
    I work with Logic, and usually use quicktime movies when I am working to movies. But I am working with a client who is an Avid user and swears by avi files. Can someone explain to me the difference. My client explained to me that avi's are better than mov files. He claims their file sizes are bigger, so therefore there quality is better. He said there is some form of compression on quicktime movies which lessen the quality to avi, even if the mov is uncompressed apparently the quality is still less than an uncompressed avi. If this is not true, could someone give me the real big difference between the two.
    I thought is was more of a preference, like windows users prefer wav, and apple users like quicktime movies. Like with audio, there isnt a huge difference between aif and wav. Windows users prefer wav and apple users aif.
    Thanks in advance for any information.

    gazo wrote:
    The vid guy has sent me some files to work with. So I am working in Final Cut to edit some of the video, and then sending it back to him. He is working on PC with Avid. What is the best. Should I convert the avi files he has sent to me to mov files. Then pull these into FCP, and then export it out as avi for him. Or should I export out as mov, and then he converts them to avi when he pulls it into Avid on his PC? Very confusing which is the best procedure between Mac and PC.
    Thanks in advance for any help.
    This is a disaster in the making. You can avoid being part of the train wreck by either renting an Avid, going to live at his house, or telling him to get a Macintosh.
    You must find the lowest common denominator video format that will work on both of your systems. That could be conventional DV, dunno, never used Avid and never tried to edit anything on a PC. But I can tell you this with absolute certainty, it will be easier and, in the end, much less expensive for one of you to adopt the other's platform for the duration of this project. The time you waste transcoding, arguing, formatting your drives, buying secondary products, fitting round pegs into square holes, and trying to find a workable solution (that will keep changing as the project gets more complicated) will cost you much more in terms of money out of pocket and creative frustration than simply buying/renting another station.
    bogiesan

  • What is the difference between SWF and F4V in the context of Streaming or progressive Download?

    Hello everybody,
    I am absolutely a beginner in working with Captivate and furthermore my technological know how is not that good.
    So, I have problems to understand if the export formats SWF and F4V are both capable to be published in the Internet as streaming video and as progressive Download? Well so, I do not really understand the difference between streaming and progessive download either?
    Furthermore I was asking myself if this issue depends on how I imported flash videos (there are these two options) in my Captivate project during the production phase?
    I would be very thankful for some helping information!
    Greetings,
    Mareike the beginner

    Welcome to our community
    I'm not certain I fully understand the differences myself, but will toss out what I believe to be true about the formats. Hopefully, if I'm incorrect in my bellief, someone with more definitive knowledge will chime in.
    It was explained to me a couple of years back and is my understanding that "streaming" only applies to a video based format such as F4V, FLV and it doesn't apply to SWF. With SWF, you may specify a preload value. So when the SWF transmits from the web server to the PC, a certain percentage has to be received before play begins. But that's not streaming. It's preloading.
    For streaming to occur, the web server establishes a communication channel between the server and the destination PC. This channel is monitored to see what speed is in use. Only enough information is then transmitted to be comfortable at that speed. If the speed improves during the connection, the server serves data at a faster rate. If the connection degrades, the information transmitted is also scaled back so as to accommodate the lower speed.
    With SWF, after it has all been downloaded, a savvy user is able to poke around in their temporary internet files and save the SWF for play later. With streaming, this isn't possible because as the stream is viewed, it evaporates from memory.
    Seriously hoping others will chime in here to confirm or deny this.
    Cheers... Rick
    Helpful and Handy Links
    Begin learning Captivate 5 moments from now! $29.95
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcererStone Blog
    Captivate eBooks

  • Difference between servlet and ActionServlet

    Difference between servlet and ActionServlet..
    Anybody reply

    jsf_VWP5.5.1 wrote:
    Difference between servlet and ActionServlet..
    Anybody replyAs their name imply, ActionServlets like outdoor activities, whereas Servlets are rather contemplative types.
    The only time Servlets exhibit behavior similar to ActionServlets, in under extremely stressful situations, like when a Servlet is being chased by a pit bull.

  • Difference between iteratior and List Iterator

    Difference between iteratior and List Iterator

    Ravikumar:
    You have already posted something quite similar to this posting here: http://forum.java.sun.com/thread.jspa?threadID=735377
    While I cannot speak for everyone else here, I personally find your approach rather rude and inconsiderate. The manner in which you are posting these questions implies that you not only do not recognize that there is work involved in answering them but that you do not sufficiently understand them in such a manner as to be able to phrase them coherently.
    I expect that you are attempting to do your homework by exploiting the helpful people on this forum rather than by learning the material in question. If I am mistaken as to your intentions, please inform me and I will apologize to you. However, I find it difficult to believe that anyone would have such poor forum etiquette as not to realize that posting a "question" in the form of a topic statement is impolite.
    There are many fine people here who will assist you in learning and applying Java; I have relied upon their assistance on multiple occasions and found it indispensible. But you are far more likely to receive a helpful response (at least from me) if you take the time to express your questions more fully and (especially) to learn the material.
    Cheers and happy learning.

  • Difference between billing and invoice?

    Hi all
    can anybody say Difference between billing and invoice?
    thanks

    Hi Ipsit,
    Invoice is document indicating to delivery goods and Billing is a receipt of payment
    Tables are VBRK & VBRP. For flow, go to transaction VF03, enter document number and hit 'Display Document Flow' button on toolbar
    VBRK and VBRP holds billing/invoice details..
    Billing Document:
    Generic term for invoices, credit memos, debit memos, pro forma invoices and cancellation documents.
    The tables are VBRK and VBRP.
    2) -- once u do PGI the delivery document will be created. There is no way to stop it.. The thing u can to do go to the list of created deliveries in VL09. Select the delivery doc which u created. There u have the option of reversing the goods or canceling it.
    Billing is generic term and u can say invoice is a type of billing document.
    After PGI only way left is to cancel it by Using TCODE MBST as this Tcode is used to cancel any material document.
    Please Reward If Really Helpful,
    Thanks and Regards,
    Sateesh.Kandula

  • Difference between billing and invoice?  How to stop PGI?

    can u please help me in these questions.
    Difference between billing and invoice?  How to stop PGI?

    Invoice is document indicating to delivery goods and Billing is a receipt of payment
    Tables are VBRK & VBRP. For flow, go to transaction VF03, enter document number and hit 'Display Document Flow' button on toolbar
    vbrk and vbrp holds billing/invoice details..
    Billing Document:
    Generic term for invoices, credit memos, debit memos, pro forma invoices and cancellation documents.
    The tables are VBRK and VBRP.
    2)-- once u do PGI the delivery document will be created . there is no way to stop it  .. the thing u can to do go to the list of created deliveries in VL09.. select the delivery doc which u created.there  u have the option of reversing the goods or canceling it.
    let me know if i am wrong...
    thanks,
    madhan
    Message was edited by:
            madhan n

  • Hi All difference between abap and hr-abap urgent pls

    Hi All difference between abap and hr-abap urgent pls

    Hello,
    To add to the above points regarding infotypes
    Infotypes stand apart in  HR and manage a volume of data in HR domain..they are unique to HR module ranging from basic employee information to time management and finally the custom infotypes.....
    Payroll and other monetory activities related to an employee also form a vital part of the HR module....
    while considering Reports..in HR data is mainly with respect to infotypes and the concept of PAKEY...7 key fields which uniquely defines any record in an infotype is used..with Pernr(employee number),Begda(begindate) and Endda(enddate) form an integral part of the key..Based on the time constraints(1,2,3) of an infotype the keys are judged (to retrieve data from an infotype)
    In ABAP HR we also have lots of predefined function modules that can be used..eg:go to se37..put 'HR*' and press F4...
    finally to update an HR infotype record we use the function module hr operation rather than direct updates...also there are standard audit trail reports that monitors various activities such as insert/modify/delete operations on an hr infotype record...
    Pls revert back for clarity and reward if helpful
    Regards
    Byju

  • What's the difference between 2nd and 3rd generation

    PLEASE HELP! New Apple user and looking to purchase a used 2nd or 3rd generation ipod touch.
    what's the difference between 2nd and 3rd generation?
    apparently I am told that the 2nd gen does not have the capabilities of listening without headphone? and the 3rd gen does??

    Hi maximumslowness - (great name),
    The 2nd gen Touch has one internal speaker, so you can listen to it, (both left and right channels) without headphones.
    However - it's a small single speaker and it is not very loud. It's not designed for quality listening (neither is the speaker on the 3rd gen as far as I know) and probably will not be adequate if there is a lot of background noise nearby.
    One option is to drop the iPod (not literally!) into an iPod Docking station so that the sound can play out through a self-contained mains-powered amplified speaker, which will also charge your iPod. There are many on the market. On the bottom of the iPod is the 30-pin dock connector which can be used to feed the audio to a docking station. Another option is simply to use a cable to connect from the headphone socket to the audio input on any amplifier.
    Yet another is to plug in a small fold-up style speakers, such as
    http://www.amazon.co.uk/Portable-Folding-Speakers-iPods-Players/dp/B000A1QKNU/re f=sr_1_84?ie=UTF8&qid=1332326622&sr=8-84
    or http://www.amazon.co.uk/Generation-Capsule-iPhone-Laptop-Speaker/dp/B002XNO7FQ/r ef=sr_1_6?ie=UTF8&qid=1332326656&sr=8-6
    I've no idea how good the sound is, you'll have to judge that for yourself. The links are both to a UK store, but most countries will have a similar option.
    I do not recieve any form of payment or compensatiion for the above links.
    Message was edited by: the fiend

Maybe you are looking for

  • New to Mainstage but I have one question.

    Hi guys, I'm new to Mainstage, but not to Logic. Anyway, I have one rather complicated question before I dig though all the manuals. Here is the set up that I want to achieve. My buddy has an I-Mac, I have a MacBook. What we have been doing involving

  • DMS - Document checkin in background

    Dear all, Is it possible to checking document in background process ? I would appreciate if anyone could please guide me on this procedure. Thanks in advance .

  • How to give url to an tree element?

    I have created a 2 views         The first view contains a Tree Control like: MainMenu 1                       - submenu 1                       - submenu 2 MainMenu 2                       - submenu 1                       - submenu 2 MainMenu 3    

  • Multi-language use

    I have one big grievance with my Blackberry: I write message, emails and postings in English, Swedish and Finnish but I have not found a way to switch keyboard to get the scandinavian characters in use. Please help or I have to go back to Nokia!

  • Host update information not same between WSUS server(Up/Downstream)

    Hi, I have two WSUS server (in win server 2012). HOST connect to WSUS1, WSUS1 sync WSUS2, WSUS2 sync Microsoft update server(internet). In WSUS1, Host update states is 100% and last report at 2014/05/28 AM 10:00. In WSUS2, Host update states is  95%