C# - How To Increase Performance Over GDI DrawImage (Unscaled)

Apr 6, 2010

In my user control's paint handler I iterate over a collection of predefined Bitmap objects and draw them to the client area thusly:

C# version:
private void Control_Paint(object sender, PaintEventArgs e) {
Graphics g = e.Graphics;
foreach (BitmapObj bmpObj in _bitmapObjCollection) {
g.DrawImageUnscaled(bmpObj.Bitmap, bmpObj.Location);
[Code] .....

The code works fine but starts to bog down when a dozen or so objects are added to the collection. My question is: Is there a way to speed this up? Would it be possible to use the Win32 bitblt function to replace DrawImageUnscaled? And if so how?

View 1 Replies


ADVERTISEMENT

How To Increase Page Performance In C#

Mar 28, 2012

I want to keep a track which pages are mostly accessed and heavy traffic.And page can be accessible to more user at any instant of time. As number of users increased then login page is not loading and site goes very slow

View 4 Replies

Increase The Printing Performance?

Feb 21, 2012

i have a problem for printing a crystal report using visual basic from access database ... whenever i click the print button .. it slow down a while around 10-30 seconds like that then only generate .. anyway how to increase the printing performance with a bit faster respond ?

here is my code for "print crystal report button " : --

'DELETE temporary table crystal report first
Call GetDeleteRecord("tblC8dtls")
Call GetDeleteRecord("tb8Status")
Call GetDeleteRecord("tb8Container")

[code].....

View 8 Replies

Increase Load Performance From A Relationship Table Adapter To Fill In Datagridview In Vb

Apr 22, 2011

i have problem when i generate my program the program takes time till in my datagridview from table adapter in which i already create in a dataset any way how to make the program fill the records faster and decrease the loading time when fill in the datagridview? [code]

View 1 Replies

Code An 'increase' Button To Prompt A User To Input A Rate By Which To Increase Select Prices In An Array?

Feb 16, 2009

I'm trying to code an 'increase' button to prompt a user to input a rate by which to increase select prices in an array.It should request the increased rate, then request a number from one to five, representing which price in the array to increase.Then, if 'increase' button is selected again and another number from one to five is chosen, then that element should be increased.It's working, but all the numbers in the array are changed. And, when I hit the increase button again, the array is repopulated below the first price increases instead of only replacing the designated price.

'declare 5 element array of prices
Dim prices() As Double = {12.2, 8.5, 12, 50, 2.4}
Dim rateIncrease As Decimal
Dim isConverted As Boolean

[code].....

View 1 Replies

Increase The Size Of The List Box As I Increase The Size Of The Panel?

Feb 25, 2010

I have added a Split container onto my Form and within bottom Panel I have added a list box.How can I increase the size of the list box as I increase the size of the panel?

View 3 Replies

.net - Making A DrawImage A Button?

Nov 14, 2011

I have these three images that I have drawn to my form.

GraphicsBuffer.DrawImage(ButtonEasy, New Rectangle(25, 330, 100, 50), 0, 0, 100, 50, GraphicsUnit.Pixel, ImageAttributes)
GraphicsBuffer.DrawImage(ButtonMedium, New Rectangle(150, 330, 100, 50), 0, 0, 100, 50, GraphicsUnit.Pixel, ImageAttributes)
GraphicsBuffer.DrawImage(ButtonHard, New Rectangle(275, 330, 100, 50), 0, 0, 100, 50, GraphicsUnit.Pixel, ImageAttributes)

But I want to make a Boolean expression for when they are clicked so I can trigger the events to load the game mode selected.

Do I do this through resource code or is there a simply way to do this. My idea seems like it would be bad and not syntaxically correct.

Edit: I've gotten to this:

Private Sub ButtonEasy_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) _
Handles ButtonEasy.MouseClick

[Code].....

View 1 Replies

DrawImage And DrawString Missing

Jul 8, 2009

At the top of my code I have:

imports system.drawing.graphics

but when I try to use it, no DrawImage or DrawString methods are available. I can get DrawImageAbort rather ironically.[code]...

View 16 Replies

Overwrite DrawImage In Picturebox (.NET)?

May 15, 2011

I've a program that draw an image in a picturebox with DrawImage. This image, a ball (.png transparent), every second is overwritten by another ball of different color. After 3-5 second the edge of the ball becomes bad, because of overwriting.

I tried to clean the background with a FillRectangle before any overwrite, but i need to preserve the windows form background. How can i do that?

View 1 Replies

2D RPG Game In VB Out Of Memory After Graphics.DrawImage

Jun 1, 2010

Well currently im programming a game in Visual Basic and I have it to the point where it draws a map on the form, it loads maps to different areas when you walk on the map, and I am doing so by using Graphics. DrawImage which redraws the map on the screen with the character in the new position. It was working quickly and smoothly until now.

I added some more sprites and now it starts to lag badly then it will throw a Out of Memory exception and it will display a big red x across the form. I watched the memory now as i move the character one spot on the forum and the memory increases 100mb's each time. It wasn't doing this before which is weird. I managed to fix the out of memory error using GC.GarbageCollect but I read that this is bad, also the character still lags across the forum. I really didn't want to release the source code until I was finished but seeing as I need help quickly because this is for a project I am working on for Thursday (End of semester Programming 2 Junior year of high school) I don't have many options.

View 8 Replies

Graphics.DrawImage Loses Resolution?

Dec 21, 2010

Graphics.DrawImage loses resolution

View 13 Replies

VS 2005 DrawImage Scales Incorrectly

Jul 18, 2010

Basically, what I am trying to do is scale part of an image. In VB6 the Scaling version of the BITBLT api worked fine, however in .NET's Drawimage version of it works okay, until a different destination size is specified.url...The red is from the next tile on the source image. and the bottom is missing one row of pixels.I have also screened this, and counted that the left side isn't properly doubled and the very first column of pixels is in 1x1 squares instead of 2x2 like the rest of the image.I don't get why it's obtaining outside the range I set, so here is my code incase it helps, note that you'll need to define a blocks array:[code]

View 3 Replies

Copy The Whole Source Picture Into Destination One Using DrawImage?

Oct 9, 2009

using DrawImage I can copy the whole source picture into destination one using its left&top corner and width&height sizes...butI would like to copy A REGION of source picture into destination one using my "starting corner" and my sizes.

View 5 Replies

DrawImage And Defining Color To Copy Instead Of Mask?

Feb 7, 2012

I am using VB 2008 & drawimage function to copy image A to Image B. My problem is image A has many different colored patches on it and I only want to copy the ones that have a certain RGB value. I was going to set the masking color to the RGB value but remembered that defines the color to ignore - Im interested in the opposite.

I know I could loop through all the pixels and check its color, but its way slow and Im hoping theres something better?

View 2 Replies

DrawImage Issues In A Dynamically Added Picturebox?

Feb 5, 2009

This is my first post to these forums so forgive me for any etiquette I may be disregarding.I am creating a custom control that has a TabControl on it. The user will then double click or right click the TabControl to display a ContextMenuStrip asking if they would like to add a new image (or tab) to the project. After they select the image file, I create a new tab, add that to the TabControl, and then I want to create a PictureBox that I draw on in a particular way depending on space available and several other factors.

Where I am having the issue is in drawing the image to the PictureBox, it is only displaying the BackColor and none of the DrawImage work. It is important to note that because of what I am doing it will not suffice to set the PicBox.Image = ImageFile or PicBox.BackgroundImage = ImageFile. I need to select tiles from the image file and then draw them into the PictureBox in a particular way, which changes if the control resizes. Also, I am using a PictureBox because the final image within it can potentially be larger than the containing tab page, and therefore I want the TabPage to generate an AutoScroll bar. If there is another way to do this, please let me know.

Below is a very simple example of what I have currently. What I suspect to be happening is that the PictureBox's Paint event is firing after I do my DrawImage work and basically overriding what I did, but I hope I am wrong.OpenAddTilesetForm() simply displays a form for the user to select which image to use, and the properties pertaining to it.

[Code]...

View 13 Replies

Drawimage On An Empty Picturebox Keeping Transparency?

Nov 15, 2010

In the following code is the way to make a picture transparent (picture i1 is emty and opacity can get values from 0.00 to 1.00[code]...

View 1 Replies

G.DrawImage And Distortion - Distort BmpR With DestinationPoints0?

Nov 30, 2011

[Code]...

I don't know how to distort bmpR with destinationPoints0. Which graphic method do I use to transform it? Muchas gracias, Onion Ring (fried) Onion is a recent refuge from Mac OS X and hates Mac App Store. System: Windows 7 x64

View 7 Replies

Graphics.DrawImage Call Runs Slow?

Jun 5, 2010

I'm trying to improve the speed of my call to:Graphics.DrawImage (Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes)I want to display two images, where the old one fades smoothly into the new one, driven by a Timer tick of 10 or 20 ticks a second. The following code runs fine on JPEG files of around half a megabyte or less, but takes much too long (up to half a second) fora 2MB JPEG. Using the Stopwatch control, I isolated the problem to the two .DrawImage calls. Do I need to do this in DirectX or is there a way to improve the efficiency of the routine? I thought of trying to resize the two images beforehand to fit the rectangle, but that's not a simple call (I don't think), and it might just mean moving the delay elsewhere.

(Dim fltOpacity As Single = 1.0F 'opacity value)
(Dim BGrafx As BufferedGraphics)
* * * * * * * * * *

[code].....

View 1 Replies

Graphics.DrawImage Mirror (Flip) Image?

Feb 20, 2009

How do I flip the image upside down (below the first image) Like as if a house were at the waters edge and you can see the house, and the reflection in the water?

code for drawing the image (which is a battery)

VB
'Finding center'
Dim batX As Integer = 160 - (imgDct(cbo_Battery.Text).Width / 2)
Dim batY As Integer = 200 - (imgDct(cbo_Battery.Text).Height / 2)
'Draw Battery

[Code]...

View 3 Replies

See If Image Drawn To Form Through Graphic.drawimage Has Been Clicked?

Nov 11, 2011

' Show game directions.[code]...

I think this is actually really easy to do that it isn't documented on here or msdn.

View 2 Replies

VS 2010 E.Graphics.DrawImage Is Fading Stretched Image

Dec 13, 2010

This is in a class, the class inherits Panel. VB.net

[Code]...

The goal is to have this image stretched to 300x50 Whenever I do it, it works, but it fades the image from left to right, so that at Left = 0, the image is solid, but at Left = 300, the image is transparent.

View 9 Replies

Avoiding Flicker When Drawing Multiple Bitmaps With Graphics.DrawImage

Mar 15, 2011

I need to draw a bitmap background with one or more moving bitmaps in the foreground; something like a chessboard where pieces move across it. I use a timer-tick event to redraw the background and then draw the relocated foreground image like the code below. But I get flicker, even though I set the form to use double-buffering. The culprit seems to be redrawing the background to refresh where the foreground images used to be; no flicker if I replace the background DrawImage with a simple Graphics.Clear. I think what I want to do is draw the background, and the foreground bitmap(s), in memory and then render it all. I used to do this with double-buffering, BitBlt, and .Refresh in VB6 but I haven't found the equivalent in VB2010. This must be a pretty common graphics requirement; what's the trick to it?

Dim Gfx As Graphics
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer, True)
Dim rectBrd As Rectangle 'use as clipping region for drawing

[Code].....

View 11 Replies

PictureBox Has An Image Alignment Or Offset Error When Using E.graphics.drawimage In The Picture Boxs' Paint Event?

Apr 17, 2010

I have tried to realign the image by down and right one pixel, but still only part of the first row and column are visible when zoomed.I can't find exactly what I'm looking for online.

My computer is an HP-Pavillion dv9600 Notebook PC.

OS: Windows Vista SP2 32-bit

The following code reproduces the problem:

Public Class PictureBug
Dim pxlColor As Color
Dim img As Bitmap = New System.Drawing.Bitmap(My.Resources.TestBug[code]......

View 7 Replies

How To Increase A Character

Jan 29, 2009

I have a string value "password" and i would like to increase each of the characters in the string by 2 position.

View 5 Replies

.net - Increase The Timeout Period?

Jun 4, 2009

I have to increase timeout period.Following is my code.

Private Function GetConnectionInstance() As SqlConnection
Dim objConn As SqlConnection
Dim strConnection As String
strConnection = ConfigurationSettings.AppSettings("conn")

[code]....

What code i have to add in above to increase timeout period.

View 3 Replies

How To Increase Desktop Fan Speed

Nov 6, 2011

I'm trying to make simple program that changes the fan speed using a Track bar. I checked on MSDN and Bing and nothing on VB.

View 4 Replies

How To Increase Height Of Top Form

Jun 20, 2011

See my screen shot to found that what is I want. I want increase top of my form in windows 7:

View 2 Replies

How To Increase Msgbox Size

Apr 3, 2010

How to incress msgbox size in vb.net

View 2 Replies

Increase Protection For Vb Compiled Exe?

Apr 13, 2010

i know that NO software is safe from hackers etc... i mean if Windows can be cracked and hacked (developed by possibly worlds most advanced programmers) then hobbyists and small developers have alot to hope for.But is there any way i can increase protection for my vb compiled exe?First of all is there a way to remove ALL comments from my compiled code?Is there a good obfuscrator for vb net 2008 code

View 4 Replies

Increase The Size Of A Form?

Apr 20, 2011

I made a questionnaire (form) in Visual Basic express 2010.The forms maximum size is width:710 (this is ok) and height:850.How to increase the height of the form?I'm asking this because when previewing the form the elements of the whole form are the half of a A4 paper size.I want to be the whole A4 paper.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved