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

VB.NET 2008 Refresh System.Graphics.DrawString

srj115
9
I have a form that periodically updates an image, which in turn is supposed to update a caption. However, each time the form updates the picture, the caption remains the same as the first picture's caption. The captions are stored in an ArrayList, and I'm positive that the index is being updated appropriately. For instance, I can MsgBox(arrCaptions(intArrIndex)) and get the correct caption, but the new caption never replaces the first caption displayed in the form.
Expand|Select|Wrap|Line Numbers
  1. Private Sub frmMain_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
  2.         Dim F As New Font("Arial", 10, FontStyle.Regular)
  3.         Dim B As New SolidBrush(Color.White)
  4.         Dim strFormat As New StringFormat
  5.         strFormat.Alignment = StringAlignment.Center
  6.  
  7.         'MsgBox(arrCaptions(intArrIndex))
  8.         e.Graphics.DrawString(arrCaptions(intArrIndex), F, B, (PictureBox1.Width / 2), PictureBox1.Height + 2, strFormat)
  9.     End Sub
  10.  
  11.     Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
  12.         frmMain_Paint(sender, e)
  13.     End Sub
  14.  
Aug 31 '08 #1
1 3773
Plater
7,872 Expert 4TB
Why are you having your picturebox's paint function calling your form's paint method. seems redundant?
Also, wouldn't it be much more simple to just a Label control and update it's text?
Sep 2 '08 #2

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

Similar topics

1
by: DrDevious | last post by:
Maybe I am doing something wrong but has anyone else here noticed a difference in the positioning of text between the Graphics.DrawString method and the Win32 GDI DrawText function? My text is...
0
by: twostepted | last post by:
Hello, This is a bit of a long post (sorry) but here is the jist of it: I've developed a Windows forms User Control marquee (auto-scrolling text like a readerboard). I'm trying to optimize it...
17
by: SamSpade | last post by:
picDocument is a picturebox When I do picDocument.Invalidate() the box paints. But if instead I do picDocument.Refresh() the box does not paint. What does Refresh do. I guessed it did an...
5
by: Charles A. Lackman | last post by:
Hello, I have created a complete PrintDocument and need to create an image from it. How is this done? e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality...
0
by: Stan Sainte-Rose | last post by:
Hi, I have a problem with alignment with a datagrid. When I use the SF variable with g.DrawString function, my first Decimal Column is merged with the previous so my last column is blank. If I...
2
by: DazedAndConfused | last post by:
Is there a way to find the coordinates of x after using Graphics.DrawString? i.e. e.Graphics.DrawString("My Report", reportFont, reportBrush, x, y) x = the coordinates position of "t" in "My...
7
by: Peter Row | last post by:
Hi, I've started work on my own control some parts of which use standard controls, others I need to draw on my controls surface to get the display output I require, however.... I seem to be...
1
by: Martijn Mulder | last post by:
At startup my application loads an image from a file from disk. If the file is not there, I still need a valid System.Drawing.Image object but I don't know how to get one. //class MyImage...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.