|
I am working with a DataGridView and I am subscribing to DataGridView.Scroll events. As soon as I get a scroll-event, I query the new cell display area:
private void dataGridView1_Scroll(Object sender, ScrollEventArgs e)
{
Rectangle r1 = dataGridView1.GetCellDisplayRectangle(0, -1, true);
Console.WriteLine("New cell position after scrolling: " + r1.X + ", " + r1.Y);
}
However, it seems the CellDisplayRectangle isn't updated by the time I get the scroll-event. What event should I subscribe to instead to get the correct CellDisplayRectangle after the DataGridView was scrolled?
|
|
|
|
|
I would put a boolean value to true, and handle event: RowPostPaint. This event occours after DataGridViewRow finish painting. And there it would check for that boolean property and execute.
private void dataGridView1_Scroll(Object sender, ScrollEventArgs e)
{
scrolled = true
}
private voud dataGridView1_RowPostPaint(Object sender, DataGridViewRowPostPaintEventArgs e)
{
if (scrolled)
{
Rectangle r1 = dataGridView1.GetCellDisplayRectangle(0, -1, true);
Console.WriteLine("New cell position after scrolling: " + r1.X + ", " + r1.Y);
scrolled = false:
}
}
|
|
|
|
|
Seems to work fine, thanks for your help!
|
|
|
|
|
Hi all,
I want to resize my string, getting rid of the last 5 chars.
for example:
after I do this:
string a= "example string 4444";
SomeMethod(a);
I want 'a' to become "example string" and " 4444" chars will be lost.
Is there a built-in function for such thing or should I create a simple algorithm?
Thanks...
|
|
|
|
|
Something like SubString?
|
|
|
|
|
I knew there was sth like this, I remember it from C times.
All I've got to do is to assign the "string size - 5" for starting pos.
thanks for reminding
|
|
|
|
|
Emmet_Brown wrote: assign the "string size - 5" for starting pos length
FTFY
|
|
|
|
|
string a= "example string 4444";
int numToRemove = 5;
a = a.Remove(a.Length - numToRemove - 1, numToRemove);
|
|
|
|
|
Hi,
use the substring function.
eg. a.SubString(0,14);
modified 27-May-14 4:57am.
|
|
|
|
|
Hi,
I am creating a deployment project. Everything works well except the uninstall of the previous version. if I look in the Programs and Features window in Windows 7 the new version is updated in the version column, but the application still picks up the old version. When I run the msi again it asks for repair or uninstall. I uninstall, run it again, install and then it works.
Can anyone maybe help.
Thank you
|
|
|
|
|
my app. send SMS in bulk
wat i want is to display the progress of SMS send.
Thread.delay (1000); is working but im not able to display that progress in lable.
why and wats the remedy???
|
|
|
|
|
if your app is a WinForms app and all of your code is running on the main thread, then Thread.Sleep(1000) will stall the GUI, which is not really acceptable; you should either use a timer to create a period of inactivity (a Windows.Forms.Timer keeps you on that main thread); or better yet, delegate the slow operations to another thread, have a look at BackgroundWorker.
Warning: you may want to read this[^].
|
|
|
|
|
Dear friends,
Small clarification.
Can some one tell me which one will be faster?
int a =100000;
string b = a.tostring();
string c = convert.tostring(a);
string d =""+a;
By
Joe.I
|
|
|
|
|
I think in release mode B and C have the same result. But for the purpose a.ToString() is the best one.
The D case is a coding horror for me.
|
|
|
|
|
Short answer: test it
I took a little look with the Reflector and I'm willing to hazard a guess: the first one. Because: the first one just calls Number.Format(something) which is an extern function, the second one calls int.ToString(some stuff) so basically it just adds a method call (which could be inlined by the JIT engine) and the last one also does some string appending, to which JIT magic may also happen, it might have an "if (first.Length == 0) return Second" and then the optimizer in the JIT compiler might decide that since the string is a constant, its Length is also constant, and then it might optimize that test away and skip the string appending completely.
That is very optimistic.
So, still test it..
Who knows, maybe it's even possible to write a faster IntToString method? I would look into it. Especially if a lot is known about the input (probability distribution etc). I wouldn't count on it, but you don't know until you try..
|
|
|
|
|
I don't know exactly. Test it!
However if you use a lot of int to string and then something like "string total = a+b+c+.... "
where a,b,c are strings obtained from ints than StringBuilder is the fastest and less
memory hungry.
|
|
|
|
|
I want to know how can I place a button or clickable label on the windows task bar so when clicking it will show a window just like Microsoft Windows Search?
|
|
|
|
|
jrahma wrote: I want to know how can I place a button or clickable label on the windows task bar so when clicking it will show a window just like Microsoft Windows Search?
Sounds like you're looking for an "Explorer Band"[^]
I are Troll
|
|
|
|
|
Google for "Windows 7 Taskbar .NET Integration" and you'll find an SDK you can use that might supply what you need.
|
|
|
|
|
Hi
I have cretae one table in database right?
then added Record in datatable finaly i make update datatable using commmand adapter
It work fine with added row
but when i make delete row then it Give error Like
"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information"
Thanks In Advance,
Jitendra
|
|
|
|
|
You need to use the data adapters delete command to delete a row
More here[^].
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Dear all,
I made a setup project for my application. How can i set my onw logo in the setup wizard windows?
Thanks
|
|
|
|
|
In the user interface designer you can change the banner bitmap property to your own image.
|
|
|
|
|
hi,
Can I change the buttons labels from the setup ?
I mean: a button label "NEXT" to this "->", or a button label "CANCEL" to "EXIT SETUP"
Cheer's,
Alex Manolescu
|
|
|
|
|
Not in the Visual Studio designer, though I believe you can control that if you use WIX[^] or some other installer designer to create your installer package.
|
|
|
|