473,770 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
+ 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_MapE ditor_Map.Creat eGraphics.DrawI mage
(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.PictureBo x.CreateGraphic s?

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 1425
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.FromIm age(bmp)
'draw as before
PictureBox_MapE ditor_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_MapE ditor_Map.Creat eGraphics.DrawI mage
(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.PictureBo x.CreateGraphic s?

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
2069
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 make the ESC key quit the called function when ever the user inputs data. The description was : ESC drops back to the main menu in case the user gets locked up or wants to start over again, ESC should provide a fool proof way to exit back to the...
8
5481
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
9
2411
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 an exception to be thrown): This one works but it's not the results I want. private void CreateImage1() {
15
5324
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 private string myArray;
2
1237
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
1480
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 something is not right because of the way I am using Application::DoEvents() (ref: http://www.codinghorror.com/blog/archives/000159.html and http://www.codinghorror.com/blog/archives/000370.html ), along with the fact that I get a crash when I try...
0
5576
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 ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
1
2387
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 matter of assigning the value of the Textbox to a Label in the Picturebox. But VB.NET doesn't seem to support a Print method for the Picturebox. How do I output the Picturebox (complete with its contents) to screen or the printer?
1
3213
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, because I want to use this to motion detection. I don't know how I can get picture from camera to Image variable. Please help Maciek
0
9617
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9453
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10036
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6710
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3607
muto222
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.