|
Hello,
t2o2uk wrote: I don't know how to call this event
In general you can not call this event directly.
If you inherit a class from System.Windows.Forms.panel, you could override the OnPaint Method which is called from the event.
This would be recomended if you whant to change the behavior or style of more than one panel in your application.
Hope that helps.
All the best,
Martin
|
|
|
|
|
Add a Timer control to the page that you can use to update periodically. At each tick you call the Invalidate method of the control that you want to update, and it will be redrawn.
---
b { font-weight: normal; }
|
|
|
|
|
Was just whipping up a quick util which immediately executes an assembly normally run by a winservice at night. The assembly implements an interface exposing a DoWork() function.
I decided to play with the BackgroundWorker component to keep my utils UI responsive and show a little animation while it chugs along. So I have a worker class which essentially implements the interface and calls DoWork().
I thought it would be cool to implement a cancel button while I was at it. BackgroundWorker supports a CancelAsync() which requires the worker thread to check backgroundWorker.CancellationPending and then return. But what if my worker is calling in to an assembly which is performing the long process?
Just curious if there is a way to forcing a BackgroundWorker to immediately cancel. A call to Dispose() was ignored and I didn't see a way to force the thread to exit immediately.
|
|
|
|
|
There isn't a way, no. You can terminate the thread via Thread.Abort, but that's generally a bad idea since it can leave your code in a volatile, unstable state.
I recommend having your background worker spawn a new thread in the DoWork handler. Have that thread do the actual work, while the DoWork thread do 2 things: continually check for the cancel flag, and continually watch for completion of the spawned thread. When either the spawned thread finishes or the cancel flag is true, your DoWork thread can return, thus your RunWorkerCompleted handler will be fired.
p.s. check out Roy Osherove's extended BackgroundWorker[^], which includes a CancelImmediately() method that accomplishes pretty much what you're trying to do.
|
|
|
|
|
I make a chart in steema tchart and convert it in EPS file.
and now showing it in Latex, but it not work because EPS file is not standard.
Anybody please tell me what should i have to do?
Tahnks
ArvindHaritus
|
|
|
|
|
Hey guys,
I display a tooltip whenever a mouse moves over an item in my listview control. However, the width/height of the tool tip is determined by the content inside the tool tip. is it possible to override this and display a fixed width tool tip?
|
|
|
|
|
I'm trying to build prototype and want some objects filled with random data. I've copied my production interfaces into the prototype project and built some dummy classes based on them.
In the load method of one class i've added a bit of code to populate the private members with data.
When i instantiate a few objects and put them in a collection they all end up containing the same data. When i put a break point in the code to see what's going wrong though, they all come out with different values.
Does Random.Next() or Random.NextDouble() use the system time? I don't really understand what could be happening here.
Any ideas would be greatly appreciated
Russ
|
|
|
|
|
Use a single Random object in the code instead of creating a separate one for each object. The Random object is seeded from the system time when created, so if you create Random objects to closely in time, the randomness will not be good.
Another possible reason is if you actually don't instantiate separate objects, but instantiate only one single object and fill if with data over and over again. When you add the object to the collection, the object isn't copied, it's only the reference to the object that is stored. When you are done you have a collection full of references to the same object, which of course will contain the same data regardless of which reference you use to look at it.
---
b { font-weight: normal; }
|
|
|
|
|
i've just found a solution.
I tried to initialize the Random object with a seed of Environment.TickCount and still had the same problem when i ran it, but the second time i noticed the repeated number changed half way through my list. Made me think that maybe the Random seed only changes every 1 ms. I've added a Thread.Sleep(1) to my code and it works. It's only for building a prototype so i'm not too bothered how it works as long as it works.
Thanks for getting back Guffa (I thought i'd managed to use the same object for a while there too, had a long look to make sure i hadn't)
Russ
|
|
|
|
|
Well, anything that works...
The proper way to solve it is of course to use a single instance of the Random class. If you don't want to pass around the reference, you can make a factory method that will create a single instance:
private static Random rnd = null;
public static Random GetRandomGenerator() {
if (rnd == null) rnd = new Random();
return rnd;
}
---
b { font-weight: normal; }
|
|
|
|
|
hi
i have a datagridview and i want to change the current row style, changing its background color to yellow. it`s ok when i react to CellClick, but i want to select a row also if the user press the up or down keyboard keys.
ok, but, when i react to CellEnter or RowEnter, it`s coloring all the datagrid rows when the program first runs. how can i solve this problem? i just want to color a entire row when the current row cell is selected.
the code to color an entire row i`m using is the following:
<br />
foreach (DataGridViewCell cell in dgvPedidoItem.Rows[e.RowIndex].Cells)<br />
{<br />
cell.Style.BackColor = System.Drawing.SystemColors.Info;<br />
}<br />
thanks everyone in advance... XD
|
|
|
|
|
add the CellEnter or RowEnter event handler once the form has been drawn and the datasource set.
public Form1()
{
InitializeComponent();
dataGridView1.DataSource = ............;
//IN HERE FOR EXAMPLE
dataGridView1.CellEnter +=new DataGridViewCellEventHandler(dataGridView1_CellEnter);
}
|
|
|
|
|
Hi guys,
What I am having very hard time to achieve is to build an "Article Layout".
This means to have : Title, related image, and body-text, just like we can see in CNN articles for example.
Doing this in HTML is easy using the CSS float property.
I can't find a way to do it well in winforms.
I don't mean to create 2 columns: 1 for the image and 1 for the text, because thats easy.
I want to have the body text to wrap around (float around) the image.
Any idea will be appreciated.
Thanks.
|
|
|
|
|
Do you have any experience rendering (painting/drawing)? That is what you would have to do to achieve your goal. It basically involves a lot of pixel math and GDI calls to do the painting.
led mike
|
|
|
|
|
Hi
can i call a webmethod from another webmethod in the same webservice?
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
... you can ... Why do ask?
SkyWalker
|
|
|
|
|
Hi folks,
I am new for .Net 2.0, i want to use the appsettings values now i have using
following code and i add reference for configuration component manually but its not working.
|
|
|
|
|
- English please
|
|
|
|
|
hi folks,
I am new to .net , Now i have work with Windows application and i want to read the file from specific path. I have using filestream object for file access but it shows following error.
Access to the path 'C:\\Program Files\\AAA' is denied."
my code is,
FileStream FS = new FileStream(@"C:/Program Files/Psis/Conf.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
is anybody face this problem before plz tell me the solution.
|
|
|
|
|
You don't have permission to either read or write or both to that directory. Maybe you can't create a file in that directory, or that directory doesn't exist.
The most likely cause (if you're running as an Admin / Power User) is that the Directory "C:\Program Files\Psis" doesn't exists.
Ps. Not sure if it likes the forward slashes in the path, if the directory exists and you have permission to write to it then this maybe the cause, note that the @ symbol disables character escaping in the string so \ means \ rather than the prefix for an escaped character.
|
|
|
|
|
I'm wanna write a application that can control the iis,such as create virtual web site,set virtual directory,configure parameters,delete virtaul web site.
whether .net 2.0 have provide the such class??
where I can find such component??
have other method to finish such work??
whether you have wrote such application?can you teach me how to do??
KSCsoft
|
|
|
|
|
KSCsoft wrote: I'm wanna write a application that can control the iis,such as create virtual web site,set virtual directory,configure parameters,delete virtaul web site.
This is possible.
KSCsoft wrote: whether .net 2.0 have provide the such class??
Not sure but possibly available through some interop / WMI.
KSCsoft wrote: where I can find such component??
Here[^]KSCsoft wrote: have other method to finish such work??
Eh?
KSCsoft wrote: whether you have wrote such application?
No
KSCsoft wrote: can you teach me how to do??
Yes but no.
|
|
|
|
|
hey dude, you really go direct to the point! LOL
|
|
|
|
|
Well the way the question was asked deserved an appropriate response.
|
|
|
|
|
why? did he say: "hey, short answers please, cause i don`t like to read so much"?
|
|
|
|