|
The OnPaint() method is called by the guts of the WinForms library, and is wrapped in a try/catch block. The exception is being handled in a catch() handler there, which is why the debugger reports to you that it does not have the source code for the execution point.
You can handle this two ways:
- You can use the Debug | Exceptions dialog box to tell VS.NET to break immediately after any exception is thrown (whether or not it is handled). This will cause VS.NET to break inside your OnPaint() method.
- You can wrap your entire OnPaint implementation in a try/catch block so you handle all exceptions yourself (and possibly re-throw ones you can't recover from).
I would suggest the second option.
--
Russell Morris
"Have you gone mad Frink? Put down that science pole!"
|
|
|
|
|
how can i achieve video streaming using .NET technology. that is, capture video from my logitech web cam and transfer it to client broswer?
thank you.
regards
yccheok
|
|
|
|
|
|
quite nice. that that is nothing to do with live video streaming 
|
|
|
|
|
|
------------------------------------
Bitmap b = new Bitmap("\\live.jpg");
this.pictureBox1.Image = b;
------------------------------------
i make my picture box point to live.jpg. when i try to edit the live.jpg (ie:when i try to replace the live.jpg, or i try to call Bitmap.Save("live.jpg") in another thread), i was not allowed to do so.
i try to change the code to:
------------------------------------
Bitmap b = new Bitmap("\\live.jpg");
this.pictureBox1.Image = b;
b.Dispose();
b = null;
------------------------------------
this will cause the run-time error n make the picture box diaplay a BIG cross instead of the content of live.jpg.
i then try to duplicate the bitmap using:
------------------------------------
Bitmap b = new Bitmap("\\live.jpg");
this.pictureBox1.Image = b.Clone(new Rectangle(0, 0, b.Size.Width, b.Size.Height), b.PixelFormat);
b.Dispose();
b = null;
------------------------------------
now, i still cannot edit the live.jpg (ie:when i try to replace the live.jpg, or i try to call Bitmap.Save("live.jpg") in another thread).
how can i release the handle to live.jpg file and at the same time let the picture box to have the content of live.jpg.
thank you.
regards
yccheok
|
|
|
|
|
Hi,
Just wondered if anyone has tried this already?
I'm trying to write a button control that use
APIs in uxtheme.dll to draw its background image.
I also want to have an alpha blend option for the
button. My solution is to draw the theme background
on a temporary bitmap, do the alpha blending, and
then, copy it to the screen.
But here comes a problem. If theme background already
contains some pixels which are semi-transparent, these
pixels are drawn in black color on the target bitmap.
While there isn't any problem if I want the theme
background image to be drawn on the screen (alpha pixels
are rendered correctly on the screen, perfectly drawn on
top of whatever sits there.) Does anyone know the
solution to draw a theme background correctly onto a
bitmap?
Thanks
Li-kai Liu
|
|
|
|
|
how to uninstall a software programatically ?
r00d0034@yahoo.com
|
|
|
|
|
how to creat a setup project that will install an application through a wizerd ?
how to creat DNS programatically ?
how to logoff and login programatically ?
r00d0034@yahoo.com
|
|
|
|
|
I hope anyway!
I want to do (for example):
StreamReader sr;<br />
if (cond1)<br />
sr = new StreamReader(@"C:\temp.txt");<br />
<br />
for (int i = 0 ; i < 100 ; i++)<br />
{<br />
if (cond1)<br />
sr.WriteLine("{0},{1}",v1,v2);<br />
}<br />
<br />
if (cond1)<br />
sr.Close()
but the compiler flags up (sr) as unassigned. What's the easy way out of this?
Rgdz
B.
|
|
|
|
|
Why are you writing to a StreamReader?
My guess is that you really want a StreamWriter and because the file doesn't exist, new StreamReader(...) , it's returning null .
Paul
|
|
|
|
|
Oops, sorry typo. I wish that was the problem!
The trouble is I only want to use the StreamWriter (!!) if a certain condition is true. Otherwise, don't use it. Since C# uses references, if I don't declare it, the compiler flags it as null regardless of what conditional it's inside
In C++ I could do:
Writer* pWriter;<br />
if (cond1)<br />
pWriter = new Writer;<br />
<br />
if (cond1)<br />
pWriter->WriteLine()<br />
<br />
without any trouble, which is what I'm trying to achieve in C#
Rgdz
B.
|
|
|
|
|
Barry Lapthorn wrote:
Oops, sorry typo. I wish that was the problem!
Well, you said it was simple.
If I'm understanding you correctly, I think this might help.
You can set a StreamWriter to StreamWriter.Null which does all the work for you. You can write to it as much as you like and it all just disappears into Bill Gates ass (or something like that ).
Paul
|
|
|
|
|
Almost but I want it for a generic object as well. I think the next item in the thread answers it.
I'm a C# noob I'm afraid
B.
|
|
|
|
|
Sorry, yeah, I missed the point completely again. My biggest fault is always looking for something bigger than it actually is. I should have read the bit about assignment a bit more carefully
I'd still advise using StreamReader.Null [edit]StreamWriter.Null, duh![/edit] purely because it means you don't have to worry again about whether it's null or not.
Paul
|
|
|
|
|
I wasn't exactly on top form either as the compiler error message does actually say that the variable was unassigned/undefined! Which tells you that you should set it to something. Doh!
Thanks
Barry
|
|
|
|
|
Paul Riley wrote:
My guess is that you really want a StreamWriter and because the file doesn't exist, new StreamReader(...), it's returning null
I didnt even see that!
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
StreamReader sr = null;
That should the compiler behave null is an assignment.
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Ah ha! That solves my problem.
I'm just getting started on C#. I should have realised that straight away though!!
Thanks.
B.
|
|
|
|
|
Using the setup template, that came with VS.NET, I successfully created an installer for my application. Behind the scenes, it creates two seperate user interface sets. One for the admin and one for the normal users. I have a few bugs in the 'normal users' installation.
How do I limit the installation to allow only administrators to install the application?
Im sure someone knows. Thanks in advance.
|
|
|
|
|
I found a solution! Here it is:
First, download the MSI sdk, and Install it. Then install Orca. Orca is used to edit the setup database tables. Open the msi package in orca. Go the the Control Conditionals table and set a conditional disable to the next button on the Welcome page. Also add another string to explain that admin rights are needed (Added to the controls table). Set a conditional show and hide on the text strings.
The result:
When a normal user tries to install the can only click on exit.
When admin tries to install they can click next and go on.
I hope this helps someone. Orca is very cool. Can be complex to use, but very cool nevertheless.

|
|
|
|
|
Is it better than the MSI projects in VS.NET? I have a couple MSI projects and was wondering if there was a benefit to using Orca and the SDK instead of just VS.NET.
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
I've been playing with asynchronous streams and have a question. When I use the beginRead method for asynchronous reading, the for loop in the code below never gets called until the entire file(fairly large) is completely read(ie. mutiple begin reads and callbacks). I thought that the code should process the for loop while doing some reading of the file and when the read completes right it to the screen. This continues until the entire file is read thereby alternating the output from the for loop and the reading of the file. This is not occuring for me. Is there something I'm missing? I've tried this numerous times using different types of streams and the same thing occurs. Code snippet below:
FileStream inputStream; // inputStream is a filestream
public void Run()
{
inputStream.BeginRead(buffer,0,buffer.Length,new AsyncCallback(this.Callback),null);
for(long i = 0; i <500000; i++)
{
if(i%10000 ==0)
Console.WriteLine(i.ToString());
}
}
public void Callback(IAsyncResult ar)
{
int bytesRead = inputStream.EndRead(ar);
// write output to screen
}
|
|
|
|
|
does anyone know where to start?
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|