473,473 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help Displaying & Stabilizing PictureBox Contents

(ellipses in place of code sections which do not deviate from defaults)

Private Sub Form_Main_Load(...) Handles MyBase.Load
For A = 0 To 16
For B = 0 To 14
PictureBox_MapEditor_Map.CreateGraphics.DrawImage
(System.Drawing.Image.FromFile("C:\The RPG Project\Test 2.bmp"), A * 40,
B * 40)
Next
Next
End Sub

First:

The preceeding code tiles a PictureBox with 17 Columns by 15 Rows of what
will eventually be varying graphics (as befits a Final Fantasy IV-style
visual presentation)...

At least it does in theory. In actuality, nothing happens unless I tie
the tiling to a post-Form.Load event.

But I'd *really* like it to execute absent at program start absent user
input. Any way to do this?

Second:

How do I stabilize the contents of the PictureBox, so it won't be
affected by alt/tabbing, moving a window on top of it, or other such
annoyances?

Third:

The PictureBox is contained (eventually with several other controls) in a
Panel. Is there any way that I can force references to the control to
also reference the panel, as in Panel.PictureBox.CreateGraphics?

Will this also allow me to have two same-named component controls in the
form, as long as they are members of different panels?

Thanks in advance for any assistance,

The Confessor

Feb 8 '06 #1
1 1407
CMM
AFAIK the .NET picturebox doesn't have an autoredraw property but it's easy
to simulate:

Dim bmp As New Bitmap(width, height)
Dim gr As Graphics = Graphics.FromImage(bmp)
'draw as before
PictureBox_MapEditor_Map.Image = bmp

That works... but, personally, I don't see why not just put drawing code in
the PictureBox's Paint event. Drawing is extremely fast in .NET... and sorta
makes "autoredraw" obsolete.

P.S.
Oh yeah and I think you're supposed to do gr.Dispose() on manually created
gr objects... or else they'll go into garbage collection land still holding
on to GDI resources until the GC finally destroys it (whenever that is... if
ever).
"The Confessor" <in*****@reply.to.group> wrote in message
news:Xn*********************************@130.81.64 .196...
(ellipses in place of code sections which do not deviate from defaults)

Private Sub Form_Main_Load(...) Handles MyBase.Load
For A = 0 To 16
For B = 0 To 14
PictureBox_MapEditor_Map.CreateGraphics.DrawImage
(System.Drawing.Image.FromFile("C:\The RPG Project\Test 2.bmp"), A * 40,
B * 40)
Next
Next
End Sub

First:

The preceeding code tiles a PictureBox with 17 Columns by 15 Rows of what
will eventually be varying graphics (as befits a Final Fantasy IV-style
visual presentation)...

At least it does in theory. In actuality, nothing happens unless I tie
the tiling to a post-Form.Load event.

But I'd *really* like it to execute absent at program start absent user
input. Any way to do this?

Second:

How do I stabilize the contents of the PictureBox, so it won't be
affected by alt/tabbing, moving a window on top of it, or other such
annoyances?

Third:

The PictureBox is contained (eventually with several other controls) in a
Panel. Is there any way that I can force references to the control to
also reference the panel, as in Panel.PictureBox.CreateGraphics?

Will this also allow me to have two same-named component controls in the
form, as long as they are members of different panels?

Thanks in advance for any assistance,

The Confessor

Feb 8 '06 #2

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

Similar topics

8
by: Foxy Kav | last post by:
Hi everyone, Im currently doing first year UNI, taking a programming course in C++, for one project i have to create a simple array manipulator... that i have done, but i cant figure out how to...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
9
by: Steve Long | last post by:
Hello, (total GDI newbie) I'm having trouble drawing just a simple line to display in a picturebox. I just want a straight, dotdash line. I have two methods, one works and one doesn't (it cause...
15
by: Geoff Cox | last post by:
Hello, Can I separately declare and initialize a string array? How and where would I do it in the code below? It was created using Visual C++ 2005 Express Beta 2 ... In C# I would have ...
2
by: Daniel | last post by:
Hi all, Is it possible to output the contents of a panel as a graphic file? -- Daniel MCSE, MCP+I, MCP in Windows 2000/NT --------------------------------------
0
by: Marcus Kwok | last post by:
I have written a class (Windows Form) in Managed C++ that accepts an array of image filenames and will display them sequentially. All images will be the same size. I got it to work, but I know...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
1
by: VICTOR DIACONO | last post by:
I have the following problem. I am trying to print the contents of a number of Textboxes into Labels on a Picturebox. Then I wish to output the Picturebox to the screen. Ok, it is a simple...
1
by: Macias | last post by:
Hi, I'm using avicap32 to capture video from my webcam, but I've a problem. I can cerate preview in ex. in picturebox component, but I need to get image from camera to Bitmap or Image component,...
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.