OnPaint Event - Error In Battle Screen Code ?
May 15, 2012
I am working on a simple NES gaming reprogramming project (who doesn't try to program video games when they start out?) and am coming up with a goofy little error in my battle screen code. The Battle Screen is supposed to trigger and draw this form, but the thing redraws itself three or four times, creating an obvious and obnoxious triple-blink. Basically, the OnPaint event is still a bit of a mystery to me. Is there a way to reduce the amount of redraws so that it doesn't blink like it does?
Public Class Form1
Dim provider, dataFile, connString As String
Dim enemyTop, enemyLeft, enemyWidth, enemyHeight As Integer
[CODE]...
View 8 Replies
ADVERTISEMENT
Jan 18, 2011
Does anyone know what causes and more importantly how to prevent the flickering you come by when painting a control?
View 3 Replies
Mar 13, 2012
I have my battle systems code set to (attempt) to replace the test enemies data with the data that I have saved into a text file every time you either kill the enemy, or you leave the battle and come back to it... or if youve run away from the enemy.ive got two functions in the battle page, one of which is an agressive attack, the other of which is the running away function, and both of them are supposed to run the function that resets and reloads the enemies data from a text file, yet none of them are doing what they are supposed to do...
the problem that I am having is that when I either run away, or I kill the enemy, its data is never reset to the baseline of 2000, it is always, in the case of running away, what it was when I ran away, or if I killed it, it is a random value less than 2000...
here is the respective code
agressive attack:
Private Sub CMDagressive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMDagressive.Click
'Dim previousdamage As Integer
'Dim originaldamage As String
[code]....
View 6 Replies
May 5, 2011
The program has errorhandle and write log function, however, it could not catch the error message in the program.
The following error message in Event Viewer. Error Module: oleaut32.dll ,version 5.1.2600.5512, error code: 0x000048f9
View 1 Replies
Feb 12, 2010
I am facing issue in following code syntax...
Protected Overridable Sub OnHeaderClicked(ByVal args As ItemSelectedEventArgs)
If ItemSelected IsNot Nothing Then
RaiseEvent ItemSelected(Me, args)
[CODE]...
View 6 Replies
Jan 10, 2011
I have converted C# code to vb.net using the online converter tools.
Public Sub New()
InitializeComponent()
Me.Flip1Half.Completed += New EventHandler(AddressOf Flip1Half_Completed)
[Code].....
View 2 Replies
Dec 6, 2010
I am getting an error when I code a Sub for btnDelete_Click...and it's coming from my FormActionHandler. Here is the code in my FormActionHandler:
Public Shared Function DeleteVendor(ByVal oldVendor As Vendor, ByVal newVendor As Vendor) As Boolean
Dim aServiceFactory As PayableAppServiceFactory = PayableAppServiceFactory.GetInstance()
Dim aVendorService As VendorService = aServiceFactory.GetServiceInstance(PayableAppServiceFactory.SERVICE_NAME.Vendor)
Return aVendorService.DeleteVendor(oldVendor, newVendor)
End Function
[Code]...
View 5 Replies
May 27, 2009
I have a vb application its a point of sale system and its running on 4 computers at 2 different locations ever since i upgraded those 2 sites from the old vb6 to our new vb.net software they keep getting blue screen randomly. [Code] Both location have the same exact setup, ie video monitors ram and so on. I have installed every update there is including updating the BIO.
View 6 Replies
Jul 31, 2010
I've read thru Iceplug's tutorial on control arrays and got it working. I tried to add a new event by basically copying his click event code and calling it a doubleclick event. I used the proper addhandler and assigned the correct name to my sub. I have the click event changing the background color to blue and the doubleclick event changing the background color to green. The background color does not change to green. Why?
Heres the tutorial with my new code encased in asterisks ...
Code:
Imports System
Imports System.Windows.Forms
Public Class form1
[CODE]...
View 7 Replies
Jan 26, 2010
I have seen code that uses the event:MyControl_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
and others the used: Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Is there an advantage to using one over the other?
View 3 Replies
Aug 13, 2010
I'm trying to write some toast-style popup notifications (similar to Growl) which should appear next to the system tray and stack as appropriate.I can handle the instantiation/location/etc... but I want to add a capability for non-rectangular toasts. I'd also like to have Alpha transparency so a semi-transparent background PNG on the toast form would blend with the desktop or windows behind it.
So... To get the obvious out of the way: Form.TransparencyKey is not sufficient for my needs as it's an all-or nothing transparency effect I want to get 50/50 foreground/background in some places, 0/100 in others, 100/0 in yet others etc.My initial approach is to override the OnBackgroundPaint() method, comment out the call to MyBase.OnBackgroundPaint and use the graphics object in the eventargs to draw exactly what I want to a form.This seems to work to start with - at the moment, I'm just drawing some rectangle for testing purposes so a PNG may present new difficulties but I haven't got there yet.
What I haven't been able to accomplish is updating the graphic - The first time the form is rendered, it shows perfectly as I'd expect (no border, just some rectangles floating on a desktop). If I move the windows behind the transparent window, the transparent window doesn't update/re-paintI believe that I need to be calling Me.Invalidate() to force a re-draw but am unsure when I should make the call - How do I know a window behind me has changed its' contents?
Edit: I tried putting a Me.Invalidate() inside a timer just to test how the redraw happens - it seems that it does trigger a re-draw but the re-draw opccurs OVER the existing form background - ie an area that was originally 50% opaque is now 75% opaque (50% + 50% of what was there before)So, after a couple of Invalidate()s, my form is showing as a black box - I need to clear the background of the form before re-drawing but Graphics.Clear(Color) seems to simply do a fill with the specified color - and obviously for the purposes of this question, Colors.Transparent doesn't really mean transparent - It seems to be a trick used when rendering the window to "show contents of control beneath this" which just doesn't work when we're dealing with the form itself?
Imports System.Drawing
Public Class TransparentForm
Private Timer As Timers.Timer
[code]....
View 1 Replies
Apr 2, 2012
Custom control, based on ProgressBar, in design mode, resizing to larger casues VS to crash, resizing to smaller is fine. The error from the MsgBox is Parameter not valid. The line that is reported at fault is 'rRect(i) = New RectangleF(rPoints(i), rSize)'.The function below is called indirectly from 'Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)'
Private Function GetRoundPath(ByVal r As RectangleF) As GraphicsPath
Dim rPath As New GraphicsPath
Dim rPoints(4) As PointF[code]......
View 11 Replies
Nov 3, 2011
I'm developing custom .net themes, and this relies on GDI+ -- I've been able to do this mainly with a ThemeBase released on another website. Now, however, whilst inheriting another control, I am Unable to inherit the ThemeBase which means I have to design the control a little differently -- which relies on me being able to manipulate the 'OnPaint' event of the control's design.The control's 'OnPaint' event is never fired, and I don't know why. Here's the entire textbox code.[code]
View 1 Replies
Mar 4, 2010
Here is the code for the button click event;
Protected Sub CompetenciesButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CompetenciesButton.Click
Dim con As String = WebConfigurationManager.ConnectionStrings("foo").ToString()
[code].....
View 1 Replies
Sep 2, 2010
I have a Custom Groupbox that overrides the OnPaint event to do some custom drawing, backgrounds, etc. The problem I have is that when I use it in an application and want to draw text on the control, it gets drawn first, then immediately afterwards the OnPaint from the control gets called and draws on top of the text. Is there any way to get the text drawn after the control's OnPaint?
View 1 Replies
Aug 19, 2009
I know that in primitive versions of vb (as found in excel) there was a line that you could insert t prevent screens from flickering to and fro when it is trying to process something.Application.screenupdating = false
View 4 Replies
Jan 25, 2010
i have my form set to 50% of the working area of the Form's screen. I need to know when the screen's workingarea change and resize my form accordingly. Example: the user drags his windows taskbar and hence the workingarea reduces, and as such i wish to resize my form to 50% of the workingarea
View 3 Replies
Oct 29, 2010
am trying to call a very lengthy set of code from under the DoubleClick event of one control, from within the Click event of another control....without having to copy and paste the desired VERY length code from the first control into the second.
View 3 Replies
Jun 26, 2011
The program below works fine except for the problem for which The program below allows input of a volume and value which are both successfully drawn to the screen. I will be adding variables to retain the value of each new Volume and new Value input. However, I need code to delete the volume and value graphic numbers
drawn to screen when new volume and value's are input. At present new numbers are drawn on top of the existing graphics rather than replacing them. Every attempt to clear, draw over etc has failed. from a very grateful member about to go on holiday and I need this to work for use on hols.
The private sub resetting() does not work but I cannot see why.
[Code]...
View 4 Replies
Mar 13, 2011
How do i run my current screen saver from VB2008 on the click event of a command button in my form?
View 1 Replies
Jan 24, 2011
i am asking that can i use c# language to implement "actions" fired on "click side events" such as mouse over the reason for this stupid question is that i remember some syntax of registering functions for particular events of formview, which are call when the event occurs (yes there ispostback involved" is something like the above possible for client side events using c# or even vb.net
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = "this is label three";
[code]....
View 3 Replies
Jun 29, 2011
BTW this issue occurs in any MS office program when the VB.Net (or even VBA) is processing information.Example: In Excel, a worksheet is displayed on the screen. I start either, a VB.Net or VBA procedure and within 30 seconds the Excel worksheet (previously displayed) blanks out. In both VB.Net and VBA,ScreenUpdating = False. My expectation is that the previously displayed screen would stay static as if I left my desk to get a cup of coffee; came back and the same ole Excel worksheet was still there?Of course, setting VBA Screen Updating = False accomplishes two goals: 1) speeds up processing and 2) saves the user from seeing unnecessary "garbage-processing" steps.Why does VBA or VB.Net ScreenUpdating = False not freeze the screen at the time of its invoking?
View 11 Replies
May 24, 2012
I've adapted the code from this link to use the WinXP on-screen keyboard (osk) for a touch-screen application written in VB.NET v3.5. The osk fills the bottom half of screen etc. and behaves fine except for one little quirk. If the user clicks or taps anywhere on the 'background' area behind/between the virtual keys (within the main osk window), the color of the area changes to that of the keys when any further key subsequently gets focus. The outline of all keys is then lost because they are visually merged into the osk window background. The osk must then be terminated and re-launched to remove the confusing appearance.
This behaviour only occurs when the osk window is set to the child style (i.e. when the menu is hidden), using the SetWindowLong P/Invoke function - e.g.
SetWindowLong(OskProcess.MainWindowHandle, GWL_STYLE, WS_CHILD)
It's as if the entire area behind the keys is being treated as another key when tapped/clicked, whereupon its color is 'restored' after losing focus.Is there any way to intercept and somehow override the focus event of this osk background area?
View 7 Replies
Jan 4, 2010
oke On-Screen keyboard through my VB code. I am using windows 7 and below code to open the keyboard. Everytime when i run this code i am getting error "Could not start On-Screen keyboard".e to fix this error?
Dim proces As New Process
proces.StartInfo.UseShellExecute = False
proces.StartInfo.RedirectStandardOutput = True
[code].....
View 1 Replies
Oct 9, 2010
How do I make a splash screen with a progressbar that value changes base on the MainForm_load event? Example:When the mainform finished executing part of mainform_load, the progress bar in the splash screen changes to X value (eg 50)When mainform_load is executed completely, the progress bar moves to 100%, the splashscreen closes and mainform opens.
View 1 Replies
Apr 7, 2011
LOGIN SCREEN
code:
View 8 Replies
Mar 13, 2010
I am trying to add buttons on the form using code; i need this for a program I want to makeHow can i do this? I am new with .net guys. Sorry for my stupid questions. Will be lots of them.
View 3 Replies
Feb 2, 2012
In VB2010, is there a way to use the Immediate Screen to test code such as:
? InStr("AString","ring")
This was convenient in VB6 which would have printed to the screen a "4".
View 4 Replies
May 4, 2012
I'm trying to accomplish something fairly simple in VB that I do everyday in JavaScript.I need to parse text between two strings (HTML tags mainly) that have multiple occurrences.
Sample Data:
<tag>test</tag>
<tag>test2</tag>
<tag>test3</tag>
If I wanted to grab the data in the 2nd <tag> in JavaScript I would simply do this:
var result = string.split('<tag>')[2].split('</tag>')[0];
And the only way I seem to get that to work in VB looks like this...
Dim from = string.IndexOf("<tag>")
Dim [to] = string.IndexOf("</tag>", from)
Dim result = string.Substring(from + "<tag>".Length, [to] - from - "<tag>".Length)
View 1 Replies
Jan 11, 2009
I have a VB.NET application with Enable application framework checked, and Splash screen set. At the same time, I need to run some code before the splash screen is loadedMyApplication_Startup seems to go later, so it's not suitable. I understand it's possible with custom splash screen, but would prefer any other way to make it without more complex customization.
View 15 Replies