|
Hello everybody.
I'm developing a windows form application with Visual Studio 2010 and C# in framework 4.
The main form has a picturebox object with a gif image as a background image which size is about 6 MB and it takes the whole screen.
In my local machine it works fine but when I run the application in other computer the gif image doesn't work in the same way that in my computer. The animation gets slower than in my computer and also the application gets slower too. I don't know why it's happening because is a new pc with 4GB RAM.
And I want to know how I can do to fix this problem. If there is any solution for gif images when it runs slowly.
Thanks in advance.
|
|
|
|
|
I would expect the rate of Gif animation to vary depending on cpu, ram, graphics card, etc. Knowing the file-size of the Gif file is 6mb. doesn't really predict the amount of memory used internally for the overhead/playback of the image in the PictureBox. Have you measured the app memory profile with and without the Gif file ?
One thing you can look at is trying to optimize the color palette of the Gif file, if it's not already optimized. Here's an open-source library with three types of tools for palette optimization based on a CodeProject article:
GifComponents (SourceForge): [^].
CodeProject article NGif: [^].
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
|
|
|
|
|
|
My stored procedure
ALTER PROCEDURE [dbo].[UpdateAllBooks]
@BookID int OUTPUT,
@GeneralID INT OUTPUT,
@FileName nvarchar(max),
@FilePath nvarchar(max),
@FileSize nvarchar(max),
@DateAdded date,
@MediaLength nvarchar(max),
@MediaType nvarchar(max),
@MediaSubType nvarchar(max),
@Thumbnail image,
@DateAcquired datetime,
@AuthorName nvarchar(50),
@ISBN nvarchar(max),
@Title nvarchar(max),
@Genre nvarchar (max),
@Series nvarchar(max),
@YearOfPublication date,
@Description text
AS
BEGIN
Update dbo.General
SET
FileName = @FileName,
FilePath = @FilePath,
FileSize = @FileSize,
DateAdded = @DateAdded,
MediaLength = @MediaLength,
MediaType = @MediaType,
MediaSubType = @MediaSubType,
Thumbnail = @Thumbnail,
DateAcquired = @DateAcquired
Where GeneralID = @GeneralID
Update dbo.Books
SET
AuthorName = @AuthorName,
ISBN = @ISBN,
Title = @Title,
Genre = @Genre,
Series = @Series,
YearOfPublication = @YearOfPublication ,
Description = @Description
Where BookID = @BookID
END
My code
private void Update_Click(object sender, EventArgs e)
{
if (connect.State == ConnectionState.Open)
{
connect.Close();
}
connect.Open();
cmd = new SqlCommand("dbo.UpdateAllBooks", connect);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@BookID", SqlDbType.Int, 4, "BookID");
cmd.Parameters.Add("@GeneralID", SqlDbType.Int,4,"GeneralID");
cmd.Parameters.Add("@FileName", SqlDbType.NVarChar, 50, "FileName");
cmd.Parameters.Add("@AuthorName", SqlDbType.NVarChar, 50,"AuthorName");
cmd.Parameters.Add("@ISBN", SqlDbType.NVarChar, 50, "ISBN");
cmd.Parameters.Add("@Title", SqlDbType.NVarChar, 50, "Title");
cmd.Parameters.Add("@Genre", SqlDbType.NVarChar, 50, "Genre");
cmd.Parameters.Add("@Series", SqlDbType.NVarChar, 50, "Series");
cmd.Parameters.Add("@YearOfPublication", SqlDbType.Date, 50, "YearOfPublication");
cmd.Parameters.Add("@Thumbnail", SqlDbType.Image);
cmd.Parameters.Add("@Description", SqlDbType.NVarChar, 50, "Description");
cmd.Parameters.Add("@FileSize", SqlDbType.NVarChar, 50, "FileSize");
cmd.Parameters.Add("@FilePath", SqlDbType.NVarChar, 50, "FilePath");
cmd.Parameters.Add("@DateAdded", SqlDbType.DateTime, 50,"DateAdded");
cmd.Parameters.Add("@MediaLength", SqlDbType.NVarChar, 50, "MediaLength");
cmd.Parameters.Add("@MediaType", SqlDbType.NVarChar, 50, "MediaType");
cmd.Parameters.Add("@MediaSubType", SqlDbType.NVarChar, 50, "MediaSubType");
cmd.Parameters.Add("@DateAcquired", SqlDbType.DateTime, 50, "DateAcquired");
cmd.ExecuteNonQuery();
connect.Close();
}
|
|
|
|
|
It looks like you've defined your BookID as OUTPUT, but trying to pass in the BookID in the line:
Where BookID = @BookID
Do you mean for the database to use BookID as an Identity object (in other words automatically set the ID number)? If so Google @@IDENTITY to see how to define this. If not, you might want to consider removing the OUTPUT keyword.
=======================
Every experience in life is a lesson to be learned
A. Stevens
B.S., Computer Science
|
|
|
|
|
As suggested the OUTPUT is a waste of time (I'm not aware that you cannot send a value in via n output parameter, I never use them), you never consume them just pass information in.
The error indicates that you are NOT passing in a BookID, so remove the OUTPUT and debug to parameter add value and make sure it has a value.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi,
for textbox I used multithread to insert words for autocompletesource. control is flickering while the thread is running. how to avoid the flickering? Suggestions please.
Thanks in advance.
Have A Nice Day!
Murali.M
Blog
|
|
|
|
|
|
|
Hi
I am planing to develop desktop application game for multiple players online and as idea to archive this i plan to use webservices to communicate players between them.
Does webservices are good for manage multiple players or is any better way to do this?
Thanks and regards.
|
|
|
|
|
|
Web services will be too slow for real-time video games, but could be OK for something like a chess or checkers game.
See Here[^] for a networked version of asteroids tutorial
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
Thanks Max
The game will have max 4 palyers so webservices are good choice to use for communicating between players?
|
|
|
|
|
Without knowing what type of game it is I can't comment
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
The game will have very simple graphic interface so all what the game will process that are few data rows and keeping updated some statuses which are stored in SQL Tables.
|
|
|
|
|
Connections via Web sockets would offer a more real time environment,
|
|
|
|
|
Thanks a lot Abhinav S I will check this too before i start developing project
|
|
|
|
|
Yes, you are right. Deploying web socket will increase your web communication speed.
|
|
|
|
|
Real time no, slow (the kind of thing that you get as browser games) yes as it means you don't need any custom central server, just a HTTP server set up with the service endpoint.
|
|
|
|
|
My Project is Windows Application C#
i Use in Connection String
connStr = String.Format(@"Data Source = {0}\{1};Mode = Read Only;Temp Path={2};",
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase),
sdfName,
System.IO.Path.GetTempPath());
My Project is Windows Application C#
i Use in Connection String
connStr = String.Format(@"Data Source = {0}\{1};Mode = Read Only;Temp Path={2};",
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase),
sdfName,
System.IO.Path.GetTempPath());
But Write in dvd Application Not Working
Error is :
The file name is not valid. Check the file name for the database
please help how project runing in cd-rom with sdf file (project is autorun)
|
|
|
|
|
If you break out that code and look at what it generates, it's fairly obvious what the problem is likely to be:
Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
AssemblyName nm = a.GetName();
string s = nm.CodeBase;
string p = System.IO.Path.GetDirectoryName(s);
AssemblyName.CodeBase returns a value of the form:
file:///D:/Folder/Application.EXE Which GetDirectoryName truncates to:
file:///D:/Folder
The chances are that the SqlCeConnection class does not like that. Try:
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) instead.
|
|
|
|
|
hi
the code not Working
Error
Format of the initialization string does not conform to specification starting at index 0.
|
|
|
|
|
So check the generated string and copy and paste it in here so I can see what it is.
|
|
|
|
|
Kindly Check Screenshots first
http://i.stack.imgur.com/VcKux.png[^]
http://i.stack.imgur.com/jSPwD.png[^]
Hi All,
I want to have a single project which holds the DataSchema files like EDMX files.
The problem which i am facing is if i create a reference of the PRJDataSchema Project project and try to query the EmployeeEntity i get a "type used in a using statment must be implicitly convertible to 'System.IDisposable'"
How can i resolve this problem.
If i create a class file in PRJDataSchema , like i have created a Test.cs file then i get no problem.
I want to fix the problem in screenshot 1.
any help would be appreciated.
Exploring the Unexplored.
|
|
|
|
|
Issue solved by manually adding reference of "System.Data.Entity" to PRJDataAccess and then add it as using System.Data.Entity to the EmployeeDAL.cs.
Stupid me.
Exploring the Unexplored.
|
|
|
|
|