|
Thanks once again actually the memory flucate it goes like, starts with 377,000k then when i click quickly couple of times on the downScrollbar it jumps to 415,000k then 500,000k and goes back like 314,000k. The maximum it goes up to 550,000k, haven't seen crossing that. Another thing i noticed that when i click on the downscrollbar button listbox flick and i can see that it's drawing. I put this in the constructor but no result
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
In your last post you were saying "perhaps creating these bitmaps and disposing of them over and over is the reason the number is so high ? " if i do'nt create them how else i can do what i am want to do. Can you please show me in ur examples.
I mistakenly deleted the Font code the are as follows.
e.Graphics.DrawString("Picture" + (e.Index + 1), f, Brushes.Black, e.Bounds, StringFormat.GenericDefault);
One of the most important thing i have seen is that i added 200 images in Ms power point too. but when i look at it its memory like 228,000k. and all those clips load way to faster than my application. What may i do to achieve the same result.
Thanks for readign this much.
|
|
|
|
|
netJP12L wrote: if i do'nt create them how else i can do what i am want to do.
By creating them once and keeping them in memory to draw as needed. This would also speed things up, which could help your flicker issues.
netJP12L wrote: One of the most important thing i have seen is that i added 200 images in Ms power point too. but when i look at it its memory like 228,000k. and all those clips load way to faster than my application. What may i do to achieve the same result.
First of all, you're wasting your time watching memory usage this closely ( it just isn't that accurate, and the fact that it goes back down shows there is no leak ). The best way to use less memory is to use C++, like powerpoint does. But, I am sure it would cache the images and not create them every time, as you are doing, that should be enough to solve the issue.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am trying to bold certain paragraphs in a rich text box and have the other text regular then print the document. Can anyone assist me?
Thanks
|
|
|
|
|
Use RichTextBox.SelectionFont, RichTextBox.SelectionStart, RichTextBox.SelectionLength and RichTextBox.SelectedText properties.
|
|
|
|
|
I want to add an object in my listview i can add string but not any controls
Object obj = new Object();
listviewItem itm = new listviewItem(obj);
listview1.Items.Add(itm);
Thanks
|
|
|
|
|
What are you trying to do?
only two letters away from being an asset
|
|
|
|
|
I have seen ListBox.Items.Add which takes an object i want to do the same thing with the listview but listview doesn't take anyother objects other than string. so i can control the drawing of each listviewitems.
|
|
|
|
|
MSDN[^]
It takes a string or a ListViewItem. Create your own class inheritting from ListViewItem and do the manipulation you require in there. When returning an Item(s) just cast it to your class type and any extra properties/methods etc will be available.
Dave
|
|
|
|
|
Hi Guy
I think Listview directlly not support add object.You one option to do this, create a own object with inherit in ListViewItem,add ur a collection or any other kind of list. after add to that listViewItem into ListView.
i hope this is help to u.
Thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
Something like what DaveyM69 suggested. SIX hours ago.
only two letters away from being an asset
|
|
|
|
|
I have had to, on a number of occasions, do something like the following:
switch (a.GetType().FullName) {
case "System.Int32":
...
break;
case "MyNamespace.SubNamespace.MyClass":
...
break;
...
} The problem is that if I change class name or the namespace of MyClass, the above breaks without generating a compile-time error. The way that I would like to perform the above is by using the type itself, and have "case typeof(MyClass):", but that DOES generate a compile-time error. I am wondering, then, if there is some method like typeof that gets a constant string representing the class name at compile time, so I could change the above code to...
switch (a.GetType().FullName) {
case nameof(int):
...
break;
case nameof(MyClass):
...
break;
...
} This way, I would get compile-time errors instead of run-time errors if I changed the classname but didn't update the above code. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
switch cases take constants so you can't call a function in a switch case, so you'll use if statements
if (a.GetType() == typeof(Int32))<br />
...<br />
else if (a.GetType() == typeof(MyClass))<br />
...
Eslam Afifi
|
|
|
|
|
Hi Guys
this is correct way when we are compare own object or own defiened class object with runtime. typeof keyword is very very useful.
Thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
I just want to add that this code provide direct type comparison. If you want to compare the inheritance hierarchy use the is keyword as Luc Pattyn mentioned here.
Eslam Afifi
|
|
|
|
|
1. You can use if-else/if statements, instead of a switch
2. Or you may be able to use:
case typeof(MyClass).FullName:
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Once you start relying on the fully qualified name of your class as a string value in another class or application they are pretty much bound to one another.
only two letters away from being an asset
|
|
|
|
|
Hi Jeff,
you should try not to rely on type names, since doing so will fail for derived types.
The way to go most often is using the "is" or "as" keywords, as in:
if (obj is Font) {
... do someting fonty (probably will need a cast)
} else if (obj is Panel) {
... deal with a Panel (probably will need a cast)
} etc.
or
Font fnt=obj as Font;
if (fnt!=null) {
... do someting fonty to fnt (no extra cast required)
}
Panel pan=obj as Panel;
if (pan!=null) {
...
}
The above will also match mySpecialPanel and the like, something typename-dependent code
would typically not do.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- 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 PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
You could also use some lookup pattern.
setup type -> action association
Dictionary<type, somedelegate> myLookup = new .....
myLookup.Add(typeof(string) , () => MessageBox.Show("Its a string!"));
myLookup.Add(typeof(int) , () => Console.WriteLine("ooh an int.."));
and then replace your switch/if with:
------
SomeDelegate action;
if (myLookup.TryGetValue( a.GetType() , out action ) )
{
action();
} ----
So you replace your switch/if completely with the lines above...
But it depends on what you actually want to accomplish.
See the post above mine regarding subclasses.
|
|
|
|
|
hi ,
i've defined a class named vector that it includes two Points and one void for drawing that and ..., i just want to know how can i find the angle between two vectors that start from one point?,
does anyone know know it's code (for C#)
|
|
|
|
|
Did you try searching Google? First find out formula for finding the angle and then write corresponding c# code.
|
|
|
|
|
|
You mean this?
Y1 Y2
| /
| /
| /
| /
|α/
X
You want to find the angle Α between vector Y1 and Y2?
If so convert the points to vectors (like you said) and subtract the angles, then you have the angel between the points.
α = Y1∠θ - Y2∠θ
If you mean you have something like this:
Y1_________________________________________Y2
\ /
\ /
\ /
\ /
\_________________________________/
Y3 Y4
X
Where you are looking for a part of the circle (the lines between Y1,Y2 and Y3,Y4 are arcs from the circle drawn from radius from circle( (Y1)∠θ ) - circle ( (Y3)∠θ ) sectioned between Y1∠θ and Y2∠θ
|
|
|
|
|
Hello,
I have some gawk scripts that i want to run in C# code.
Is it possible?
|
|
|
|
|
You can achieve the same goal using Regular Expressions. But this would mean rewriting those gawk scripts.
Just because we can; does not mean we should.
|
|
|
|
|
Greet to all
I am facing problem in accessing data of ms word to my project of c sharp .net 2005
I want to access the data word wise so that I can put it in Sql table
hoping for the good reply from you all
thanks
|
|
|
|