|
It must be something else in the call to FillRectangle. I use the same approach you are all the time, without problems.
|
|
|
|
|
theRealCondor wrote: new SolidBrush(myColor
You shouldn't do this, you should do:
using (SolidBrush theBrush = new SolidBrush(myColor)
{
Graphics.FillRectangle...
}
so that it's Dispose method is called right away. You're leaking GDI resources here.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian,
I plan on implementing that. I'm just running quick deployment to test out why the variable input isn't working. Then I'll go back to the original code that handles the GDI resources correctly.
So have you any thoughts on why I'm not getting my colors?
Michael
|
|
|
|
|
Hello Christian,
Christian Graus wrote: using (SolidBrush theBrush = new SolidBrush(myColor)
{
Graphics.FillRectangle...
}
I never worked with the using "region"(don't know whats the real expression) and now I'm currious about it.
Christian Graus wrote: so that it's Dispose method is called right away. You're leaking GDI resources here.
Does that mean that you would not need to call "theBrush.Dispose();"?
Are there more advantages by using "using"?
Thanks for your time and patients!
All the best,
Martin
|
|
|
|
|
the using keyword simply saves you from having to worry about calling dispose. That's all it does, is insert the code to call dispose, so you can see at the point of creation that an object will not leak.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Wrapping a disposable object within a using (that has rare resources) will always do two things
a) If the object within the using contains a Close() method, then Close is called.
b) The object MUST contain Dispose and Dispose() will be called.
This will happen anytime you exit the using(){} whether due to falling through the bottom or by getting blown off with an exception.
|
|
|
|
|
Thank you for the info!
theRealCondor wrote: or by getting blown off with an exception.
This is what I like most!
All the best,
Martin
|
|
|
|
|
Code is:
DataBinder.Eval(Container, "DataItem.id_produs", "detalii_produs.aspx?id={0}") + DataBinder.Eval(Container, "DataItem.categoria", "categoria={0}")
Result id
url: http://localhost/magazin_admincs/detalii_produs.aspx?id=5categoria=memorii
this is wrong: 5categoria=memorii
i need to show like: 5memorii
|
|
|
|
|
ujupanmester wrote: 5categoria=memorii
You seem to be asking for that.
ujupanmester wrote: categoria={0}
remove the format string altogether if you don't want it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I need 2 parameters
first param to be 5
second param to be memorii
It is posible to be array format?And how it should appears to be good
Thancks
|
|
|
|
|
OK, then put an & in front of memorii.
That's not what you said you wanted, you said you just wanted it to say 5memorii
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I trying to convert:
PropertyInfo pInfo = myobject.GetType().GetProperty("Date");<br />
pInfo.SetValue(myobject, Convert.ChangeType(DateTime.Now, pInfo.PropertyType), null);
I get a System.InvalidCastException, how i fix it?
Thanks in advance....
-- modified at 17:02 Thursday 8th February, 2007
|
|
|
|
|
Well, obviously the date cannot be converted to your property type. What IS your property type?
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
My property type is a Nullable DateTime...
|
|
|
|
|
i want to add a space to the property name of my class to be readable for the user when he browse it in the property grid control.for example "mypropertyname" i want it to be "My property name" . any idea?
Thanks
|
|
|
|
|
I don´t have ideia how to do this, but, use the attribute [Description("your text here")] and override the propertygrid to use this.
|
|
|
|
|
While it may make you feel good to see a 'human readable' name for your property, you may want to consider NOT doing that purely for design reasons: The purpose of the PropertyGrid is to reflect exactly the state of the object as reported by its properties.
Giving it a human readable name obscures which actual property it is reflecting (and although it may just be the same name with spaces, the point remains - the purpose of the property grid is to list the *Properties* of the object).
|
|
|
|
|
The main reason to use the space in the propertygrid is that i have an visual application used to generate a command line script, the command lines have a lot of parameters, at least 17 parameters. and i found, by using the propertygrid, it's very easy to manage this parameters. Actually, the application works normally right now,but i'd like to add this function to it.
in SQL 2005 i notes that, you can find it here:
http://home.arcor.de/sql2005/2_SQL-Login/140_SQL_byStudioCsharp/051_WhoKonwsWhatHasToBeChangedHere.jpg
it's an advanced properties dialog
Thank very much
|
|
|
|
|
The property grid exposes everything via reflection and parameters. So you need to carefully name your visible properties in PascalCase to make the names as readable as possible. In the Description() attribute, include the full name and help text.
|
|
|
|
|
i have a vb 6 activex dll and i am able to run a form inside of the dll is it possible to do the same thing in csharp ( run a form from a dll) or is there no UI in csharps DLLs?
Thanks,
Chad Aiena
|
|
|
|
|
You can just wrap up your form inside the DLL. As the form is just another class, you can pretty much do what you want with it (well, within reason).
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
can you give me a quick code snip of how i would put it in the dll (sorry i am still learning csharp)
or something like this but how to i show it
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace dllform
{
public class Class1
{
Form test = new Form()
}
}
Thanks,
Chad Aiena
|
|
|
|
|
I'll tell you how to do one for yourself. Start off by developing a form in the designer as an executable. You can then change the application type to DLL in the project properties. Compile it up and you have a form inside a DLL.
Next, create a new project and reference the DLL. Then, in your code you just need to call the form. To do this (assuming your form is called MyDllForm in the namespace MyNamespace):
MyNamespace.MyDllForm form = new MyNamespace.MyDllForm();
form.Show();
I hope that helps.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I'm using the VS 2005 control System.Windows.Forms.WebBrowser. I want to be able to track button clicks. If I've navigated from a page with multiple buttons, how can I tell which button was clicked?
|
|
|
|