|
Hello,
I want to ask if anybody know how to render (show) image really fast. Because if I override OnPaint in user control and I use GDI+ function drawImage it is really slow for bigger images (2000px x 1500px) especially on my EEE notebook, and redrawing image when main menu disappear is terrible slow.
|
|
|
|
|
Split the large image up into smaller images, and only draw the ones that overlap the invalidated region when the menu disappears
|
|
|
|
|
|
Hi,
here are some ideas:
- if the destination's resolution is different from the image one, your image is getting rescaled; you could cache the image at the right size, that would speed up the repaints.
Example: Bitmap bm2=new Bitmap(bm1, destSize);
- if the image has to come from disk and is compressed (e.g. JPEG) it may be worthwhile to keep an uncompressed copy (say a BMP); the file would be larger, painting it could be faster.
- even without chopping it up into subimages, you could just repaint the part that needs repainting by using one of the more complex overloads of DrawImage().
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I wanna include the images in my windows form where am doing globalization. Normal Label,textbox values are working perfectly but am clueless abt including image
|
|
|
|
|
Does this mean that you require different images for each language?
It is not really clear from your OP.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have the following situation:
- A Timer tick event handler that puts some data on a queue
and sets a manualresetevent.
- A background thread (an infinite loop) that sends the data in the queue to some devices.
-> if the queue is empty, the thread uses manualresetevent.Reset()
to block this thread on manualresetevent.waitone()
-> if the queue is getting to long, the older data is considered obsolete
and just thrown away.
Using the multimediatimer makes the timing more accurate,
but if the background thread is blocked and I use manualresetevent.set().
how long wil it take the background thread to continue?
15-20ms? Is there a way to improve response time?
15-20ms is not a big issue, but faster is always better
(note: the background thread is just a regular thread, not a backgroundworker)
|
|
|
|
|
You should be seeing a delay in the order of 10x10-6s because you are incurring a context switch. This is roughly how long the windows takes to schedule a thread and resume running it on a CPU. If you are seeing 10x10-3s, this is a quantum and will occur if you are running too many threads for the number of cores in your machine.
The only way to speed this up is not to put your thread in a wait state in the first place. If the delay is really too long, you can try spinning the thread instead of using a wait. This of course has one big drawback: you will be using one core all the time, most of it wasted.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Hi.
I have a string ( e.g "Regex" )
Now I want to find the equal class with its name , if exist (programmatic).
Actually, I'm going to create a simple colorize code editor !
Could you guide me ?
Thanks a lot.
|
|
|
|
|
well.... number of ways to proceed....
here one...
1.Set the name of the class exactly as you want (Note: this will be the key)
2.Get the types available in the executing assembly.
by
Assembly myAssembly = Assembly.GetExecutingAssembly();
3.Then iterate on each type and compare it with your string and do whatever...
like
foreach (Type mytype in myAssembly.GetTypes())
{
if(mystring == type.Name)
{
}
}
if yo have 10 class types in your assembly all of them will be listed and you can use it further.
Have a Happy Coding.....
|
|
|
|
|
King Julien wrote: 1.Set the name of the class exactly as you want (Note: this will be the key)
It means , I have to set the name in a string manually ?
Sorry , I'm novice in Reflection
|
|
|
|
|
Not actually.
You can have any name for the class as you want. And you can check and compare any string with the available types(i.e. the classes)
for e.g,
if your string is blue, then if a type (class) with the same name is available i.e. A class called blue then the condition is validated. Thats why i meant that the string is the keyword.
Note Case sensitive issues can be solved by parsing.)
Have a Happy Coding.....
|
|
|
|
|
Hello,
I'm making a game called CursorDancing.
It's very similar to Dance Dance Revolution.
Now i've got a few problems.
1: How do i get the Top Arrows to light up?? You know the ones that stay in place.
2: How can i link the Top Arrows to my arrows keys on my keyboard???
I'm not using GDI or XMA
Thank you very much
Love & Peace Daphne
|
|
|
|
|
These are fairly simple things to do - I'm guessing you're learning C#, but making a game isn't necessarily the way to learn.
Anyway, the answers
1) Draw a different image when you want them to light up
2) Put in a keyboard handler
|
|
|
|
|
this[^] will help
I misunderstood
To light up change the picture or draw similar transparent color over it by using Alpha of Color
and you can use KeyDown and KeyUp event
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I had small application of BHO using c# through which I had pass other PDF file in palce of a original pdf file on
browser (i.e., during navigation between web pages). I had been doing all these with the help of WebBrowser
events following: http://msdn.microsoft.com/en-us/library/aa768283(VS.85).aspx
If I try to navigate the PDF file on my desktop in place of a pdf file on browser, as many events get fired
continuously, the replaced file is blinking continously. I don't want this phenomenon.
So I choose Property change event. In this also, i'm unable to get url names in which pdf file is opened.
How can I do this?
Is there any other way to achieve this using BHO?
Is there any other events through which I can get this?
|
|
|
|
|
I'm executing following program, which is having two interfaces with same function name. So can anybody let me know actually which one or which interface's function is being executed or called
interface intf1
{
void get();
}
interface intf2
{
void get();
}
class A : intf1,intf2
{
public void get()
{
Console.WriteLine("Hello");
}
}
static void Main(string[] args)
{
A e = new A();
e.get();
Console.ReadLine();
}
|
|
|
|
|
While implementing interfaces, you just state that the functions you put into your interface are accessible in the class which implements the interfaces.
So if you have this interface:
interface intf1
{
void get(int i);
}
interface intf2
{
void get(boolean b);
}
Your class will look like this:
class A : intf1,intf2
{
public void get(int i)
{
Console.WriteLine("Number: " + i);
}
public void get(boolean b)
{
Console.WriteLine("Bool: " + b);
}
}
|
|
|
|
|
You are executing functionality of the object and not interface.Interface is abstract, it does not have any implemntation, it is just a way of specifying a contract satisfied by the object.
|
|
|
|
|
You don't call an interfaces function as it provides no implementation.
In your example any instance of class A is also intf1 and intf2, but the get method used is the class instance's implementation.
If you want differering implementations, you can declare one or more of them explicitly.
void intf1.get()
{
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I'm declaring my function(s) as given below but now it's letting me to create an instance of the function(s) to call
interface intf1
{
void get(int a);
}
interface intf2
{
void get(int a);
}
class A : intf1,intf2
{
void intf1.get(int a)
{
Console.WriteLine(a);
}
void intf2.get(int a)
{
Console.Write(a);
}
}
A e = new A();
//How to intf1.get(....) and intf2.get(....)
|
|
|
|
|
There's several ways.
(Example 1)
If you're absolutely sure that A implements the interface in question then you can do an implicit conversion).
(Example 2)
Normally it's better to check first. Also, if you don't want to keep a new object then you can explicitly cast and call the method.
A a = new A();
intf1 a1 = a;
a1.get(1);
if (a is intf2)
{
((intf2)a).get(2);
} Incedently, it's better to stick with general naming conventions i.e.
interface IMyRandomInterface{ ... }
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
modified on Wednesday, March 25, 2009 12:40 PM
|
|
|
|
|
Yes, it's rocking but can you explain your last post a bit more
You don't call an interfaces function as it provides no implementation.
In your example any instance of class A is also intf1 and intf2, but the get method used is the class instance's implementation.
which get() method is called, of both interfaces or a class instance.
Actually, if we don't implement function(s) defined in interfaces, it arises exception
|
|
|
|
|
don't be lazy, read a book and perform an experiment. You could find out in a matter of minutes.
.NET- India wrote: it arises exception
No exception, it's a compiler-generated error message.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
It's because of the two different methods of implementing.
You can implement an interface implicitly or explicitly. Consider the sample below. IMyFirstInterface is implemented implicitly. That is the implementation that will implicitly be used unless you explicitly state otherwise.
IMySecondInterface is implemented explicitly - you have to explicitly state that you want to use that implementation.
MyImplementingClass implementingClass = new MyImplementingClass();
implementingClass.Method(1);
if (implementingClass is IMySecondInterface)
{
((IMySecondInterface)implementingClass).Method(1);
}
public class MyImplementingClass : IMyFirstInterface, IMySecondInterface
{
#region IMyFirstInterface Members
public void Method(int value)
{
Console.WriteLine(value);
}
#endregion
#region IMySecondInterface Members
void IMySecondInterface.Method(int value)
{
Console.WriteLine("Value = {0}", value);
}
#endregion
}
public interface IMyFirstInterface
{
void Method(int value);
}
public interface IMySecondInterface
{
void Method(int value);
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|