|
That wont work.....
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Crap...I hate that...dammit, I'll correct it.
any idiot
can write haiku you just stop
at seventeenth syl
-ThinkGeek Fortunes
|
|
|
|
|
You want to split it into words?
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
My mistake. I splitted it like that:
string[] msgs = str.Split(Environment.NewLine.ToCharArray());
I corrected it. Tx all.
|
|
|
|
|
Form an article, I read that this enables double buffering on a form:
SetStyle(ControlStyles.AllPaintingInWmPaint, true);<br />
SetStyle(ControlStyles.DoubleBuffer, true);<br />
SetStyle(ControlStyles.UserPaint, true);
Well I tried it, using this code on an MDI child:
Graphics g = CreateGraphics();<br />
g.FillRectangle(new SolidBrush(somecolour), 0, 0, this.Width, this.Height);
When I enable both AllPaintingInWmPaint and DoubleBuffer, parts of the form don't get painted. I'm not sure what exactly happens, but here is an image: http://www.subspacedownloads.com/db.jpg[^]
On the image, I dragged the window from behind the left edge fast(If I do it slow, it gets painted almost completely. Leaves 2-5 pixels to the left).
How do I fix this?
|
|
|
|
|
I dont think you can UserPaint with the other two. Why are you using UserPaint? You should only use that AFAIK when you want to completely render the control without any help from Windows.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Well, the artice said to use that... anyway, that's not important. I'm getting the error just with the first 2.
|
|
|
|
|
I think that the problem is that your painting code (which I assume is in the Paint event handler) should use the Graphics object from the PaintEventArgs parameter rather than creating its own. This seems to fix the problem.
Chris Jobson
|
|
|
|
|
Aah, yees, that might be it. Thanks.
|
|
|
|
|
Hi all,
I have a simple task at hand. Does any one know a simple C# way to achieve the following:
1. Flash my applications taskbar icon, if my app isnt the forground application
2. Simply play any of the OS sounds from within a C# application (even beeping).
I am running under windowsXP..any suggestions/code snippets would be greatly appreciated..
thanks
|
|
|
|
|
For the flashing icon i think you will need two icons that you swap with each other at runtime (one could simply be transparent), using a timer.
Let me know if you need me to elaborate.
|
|
|
|
|
I am suffering a brain scramble.
Please remind me why we access members in a class via properties instead of directly through the instance vars. ?
Foo f = new Foo();
f.Name = "Fooby"; // Name is property
f.name = "Fooby"; //name is instance variable of Foo
TIA
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
One of the reasons is that you can control access with properties. You can't do this with inst. variables.
You could even raise exceptions if a value is out of bounds.
Cheers,
Simon
"I ask candidates to create an object model of a chicken.", Bruce Eckel on interviewing programmers.
animation mechanics in SVG (latest pic 1) (latest pic 2)
|
|
|
|
|
This is true thanks.
But, you can controling access with instance vars. too
private m_accessPrivate;
[modify]
good point about the exceptions too. Properties do give better control over the access of inst. vars, but I was just looking for specifics, (i.e. exceptions), I guess another reason would be calculations.
public string MiddleName<br />
{<br />
get<br />
{ return m_middleName; }<br />
set<br />
{ m_middleName = value != null ? value : "NA"; }<br />
}
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
I didn't really explain that right:
private string _name="";
public string Name{
set{
_name=value;}
get{return _name;}
}
By using a property here, we can validate the sets (and gets) for a property. How would you see this being done with instance variables?
Cheers,
Simon
"I ask candidates to create an object model of a chicken.", Bruce Eckel on interviewing programmers.
animation mechanics in SVG (latest pic 1) (latest pic 2)
|
|
|
|
|
When you said, control access , I thought you were refering to private,protected,public. Your example is exactly like mine, we are both on the same page.
Good day!
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
hi ,
anyone know if this is a confirmed bug?:
if i create a system.windows.forms.timer in a usercontrol , and attach an eventhandler to the timer , and set the timer.enabled = true.
the usercontrol can NOT get finalized nor disposed unless you either close the host application or call the .dispose() on the usercontrol yourself...
//Roger
|
|
|
|
|
Its not a bug. Its like that by design, as the timer still is being referenced, the GC will not clean it up, unless you close its parent container or call dispose explicitly.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
no , that is not true , all other eventhandlers are weak references , they does not keep the parent alive.
and in this case you can actually do:
---
system.windows.forms.timer t=new system.windows.forms.timer();
t.tick +=new eventhandler(this.somemethod);
t.enabled=true;
t=null;
g.collect();
---
in the above case , the timer will still be alive after you set t=null..
if you do the same with any other control they are gc'ed directly , even if they have eventhandlers on them...
there fore this problem prevents the parent of the timer to be disposed / finalized when the parent goes out of scope (unless you call .dispose yourslef or exit the host app) , since the timer for some reason holds a strong ref to the parent...
//Roger
|
|
|
|
|
When you add a Forms timer, this constructor is invoked:
this.timer1 = new System.Windows.Forms.Timer(this.components);
Thus it is still referenced in the containers components. To solve you problem I would just dispose of the timer or use System.Timers.Timer, but that wont run in the same thread as the form and could cause problems.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
not true either
same thing applies if the timer is created w/o the components param.
as:
system.windows.forms.timer t=new system.windows.forms.timer();
//Roger
|
|
|
|
|
I'm looking for info on Bluetooth programming. Anyone know of ANY sources other than the 3 pages you get on MSDN?
Me, wrong!?! Nah, you just need to change your thinking to make me right.
|
|
|
|
|
You probably have but: https://www.bluetooth.org/[^]
Some forums on there which might help as well.
Paul Watson Bluegrass Cape Town, South Africa
Macbeth muttered:
I am in blood / Stepped in so far, that should I wade no more, / Returning were as tedious as go o'er
DavidW wrote:
You are totally mad. Nice.
|
|
|
|
|
Thanks, nothing there I could find.
Me, wrong!?! Nah, you just need to change your thinking to make me right.
|
|
|
|
|
There is some kind of limitation about calling a web method from a timer method.
In my case the HelloWorld WebMethod is called in a client thread after every Second (Also tried other time intervals) but after making teh 18th call it stops calling.
The same method is called any number of times when called from a for loop rather then a timer method....
What can be the problem?
|
|
|
|