|
humm .... let's see whether i get your idea, because i am kind of new ^^''
public class myUserControl : System.Windows.Form.UserControl
{
public myUserControl {
get all UserControl properties and override the "BroswerAttribute" for all properties
}
}
so then my created UserControl will derive from myUserControl instead of Window UserControl ?
Is this right ??? ... if so i think i will try tomorrow and i will let you know.
|
|
|
|
|
Tee+ wrote:
so then my created UserControl will derive from myUserControl instead of Window UserControl ?
Exactly. An additional advantage of doing things this way is that any similar behavior of your 20 controls (e.g., methods, properties, etc) can be added to myUserControl. This also can make easier for you to write generic code.
Yes, even I am blogging now!
|
|
|
|
|
Here is my code:
AttributeCollection attributes = properties.Attributes;
BrowsableAttribute myAttribute = (BrowsableAttribute)attributes[typeof(BrowsableAttribute)];
properties.Attributes[typeof(BrowsableAttribute)] = BrowsableAttribute.Yes;
It said it is read-only. Can i reset the browsableattribute in this way or i miss something?
|
|
|
|
|
use System.Design.dll to hide the unwanted property which is avilable from any base to your derived.
<br />
using System;<br />
using System.Windows.Forms.Design;<br />
<br />
namespace CusControl<br />
{<br />
public class MyControl:ScrollableControlDesigner<br />
{<br />
public MyControl()<br />
{<br />
}<br />
<br />
protected override void PreFilterProperties(System.Collections.IDictionary properties)<br />
{<br />
properties.Remove("BorderStyle");<br />
}<br />
}<br />
}<br />
<br />
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I have tried what you have gave me ... Here is my code:
protected override void PostFilterProperties(IDictionary properties)
{
PropertyDescriptor _locked = (PropertyDescriptor)properties["Locked"];
PropertyDescriptor _name = (PropertyDescriptor)properties["Name"];
PropertyDescriptor _tabindex = (PropertyDescriptor)properties["TabIndex"];
PropertyDescriptor _location = (PropertyDescriptor)properties["Location"];
PropertyDescriptor _size = (PropertyDescriptor)properties["Size"];
properties.Clear ();
properties.Add ("Locked", _locked);
properties.Add ("TabIndex", _tabindex);
properties.Add ("Location", _location);
properties.Add ("Size", _size);
properties.Add ("Name", _name);
base.PostFilterProperties (properties);
}
Anything look good but what i found is the "Name" properties doesn't restore successfully ... what happen with that ?
|
|
|
|
|
properties.Clear (); This line put me in confusion. Just comment this and try. And the Name property is used to idetify a control no matter if it design time or run time. So i am not sure about removing Name property from Base.
please refer MSDN System.Design.Dll namespace.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hi
How i can open window folder programmatically??
Thank
|
|
|
|
|
Call System.Diagnostics.Process.Start(folderName), e.g.:
<br />
System.Diagnostics.Process.Start("C:\\windows");<br />
Yes, even I am blogging now!
|
|
|
|
|
|
...writing an ASP.NET enterprise apps, one of the desired feature is database vendor independence. I've tried surveyed and tested two options:
1. Mimer (take a look at their docs, it's quite simple to use)
2. Data Access Components By stephanpeters4000
Both are nice. But:
a. Steph's DAC has a low rating it seems.
b. Can't find much documentation on Stephan's DAC, so, if you need to switch from M$SQL to, say, Oracle... then you'd need to dig into his code... I'm not even sure if factory for Oracle and MySQL is implemented. (There's Ole/ODBC provider however) - in any case, if you want ADO.NET with Oracle and MySQL, you need to spend some time to implement:
- connection string factory
- connection factory
c. Also, seems like Mimer is a more established project with a larger following and much better documentation/support.
d. Good thing is, with Stephan's DAC, deployment is simple as DAC comes in as a class library. Mimer, on the other hand, comes in as a MSI package. This include a datasource manager - "Mimer Data Provider Manager", and a bunch of binaries which gets installed in GAC... Not sure if there's any issue with deployment yet, but I have a feeling that it will complicates matters in that regards. I can imagine you'd need to do a few things:
- install Mimer and programmatically configure Mimer's datasource (Mimer Data Provider Manager) DURING installation process (installation of my enterprise app - not Mimer)
- connection factory (implements IDbProviderFactory)... perhaps not... not sure yet.
e. Also, Mimer doesn't has a connection factory class.
f. Mimer definitely has support for Microsoft SQL Server, Oracle and MySQL - so, besides installation/deployment... Mimer seems to be the better choice.
Any advise?
Norman Fung
|
|
|
|
|
norm wrote:
Any advise?
Yes: database independence is not easy to achieve, and, unless you'll be running only the simplest queries, you'll need to use specific database features, especially when you're coding reports.
More than this, don't forget that you'll need to provide scripts for database creation, version upgrades, maintenance, etc. All those scripts will be database dependant.
So, my suggestion is: code your DAL in terms of interfaces, and rewrite those interfaces for each database you'll support.
Yes, even I am blogging now!
|
|
|
|
|
Thanks Daniel. I'll be wrapping a lot of stuff in Stored Proc's and in application level, I'm using interfaces only: IDbConnection, IDataReader...
With DAC's, I still need to code Connection factory because:
IDbConnection = factory.CreateConnection(conn string here)
Connection strings are vendor-dependant. Adding to it, seems like ADO.NET data provider for Oracle/MySQL isn't implemented in DAC's class library.
Mimer is nice, and seems more established (with a larger following) but it seems like there're more work to do with respect to deployment.
Norman Fung
|
|
|
|
|
Hi,
How to insert a separator in a combobox???
thanks,
Bye.
|
|
|
|
|
Would an empty item help? Or an item that reads "(separator)".
You would have to validate when retrieving the selected value that it's not a separator.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
asfasfafafasfa
asfasfasfasfafs
________________ <---- this is a separator but i do this with many undescores
afadsfasdfasdfasdf
|
|
|
|
|
Use an empty string.
cmb.Items.Add("Option 1");
cmb.Items.Add("Option 2");
cmb.Items.Add("Option 3");
cmb.Items.Add(" ");
cmb.Items.Add("Option 4");
cmb.Items.Add("Option 5");
if((string) cmb.SelectedItem == " ")
{
MessageBox.Show("Select a valid option.");
return;
}
DialogResult = DialogResult.OK; Alternatively you could use an ownerdrawn combo box and paint the separator in a way that it can't be selected, but I think it's way too much work.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Sorry,
this alternately I don't like. Really I have already do this but I don´t like I see a C++ project which it is possible to introduce a separator. You can see this in
http://www.codeproject.com/combobox/zsepcmb.asp[^]
Do you know how to convert a c++ project in c#?
Thanks
|
|
|
|
|
Dany Ramos wrote:
I see a C++ project which it is possible to introduce a separator.
It can be done in C# too. But you need to subclass the control. That article you mention syas how he did it, by subclassing the control and using WM_CTLCOLOR message to paint the separator; that is to avoid the use of an ownerdrawn combobox, which is a much more work for something so simple.
Alternatively you could try writing an ownerdrawn control. I've never done this myself so I can't offer much help. But for a start, see the documentation for the DrawMode property and DrawItem event of the ComboBox control.
It'd go something like this: set the DrawMode to OwnerDrawFixed when you create the item. Insert your separators as a regular item with " " as text. When you get the DrawItem event for your separator, draw a single line in the middle of the rectangle. When you get that event for a regular item, check its State to see if it's selected or not, and paint it accordingly.
Dany Ramos wrote:
Do you know how to convert a c++ project in c#?
It's not possible to convert a C++ projecto into C# automatically (at least not in the general case.) But you can see how it's done in C++ and reimplement it in C#.
I hope this helps,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi all.
I'm writing an application where I have a few forms linking up events to other form's methods. I have to manage this eventhandlers clean up to kill any reference I might have through the events when i close one of the forms.
My first approach was calling a disposeEvents() method from the Dispose(bool dispose) method on each form and unlinking (-=) al eventhandlers.
I was just wondering if this could be done by simply callinh myForm.Events.Dispose()? or is it better to do it as I have it right now and unlink one by one all eventhandlers that point to an object outside myForm?
thnks.
|
|
|
|
|
Hi,
My code draws a large graphic (e.g. a rectangle) and the window initially displays only part of it because the window size is small. When I enlarge the window, it will show the whole graphic. However, instead of enlarging the window, if I scroll the scroll bar to the right, then the graphic will be redrawn so I always can only see the first part of the graphic and cannot see the remaining part. How can I fix this display problem to see the whole graphic? Thanks in advance for your help.
|
|
|
|
|
Read "Professional C# - Graphics with GDI+" here at cp.com.
Should be: http://www.codeproject.com/books/1861004990.asp
Cheers
Sebs
|
|
|
|
|
I need an Information icon (similar to System.Drawing.SystemIcons.Information) but I need to resize it down to (16,16), does anyone know how I go about doing this in C#?
|
|
|
|
|
I want to invoke the format command of OS(XP) im my C# code:
string VolumeName = "UDISK";
string FormatW2K = "CMD.EXE";
string FormatW2KParam = string.Format("/C \"format.com {0}:/q/x/V:{1}\"",driverletter,VolumeName);
Win32.ShellExecute((IntPtr)0,"open", FormatW2K, FormatW2KParam, string.Empty, Win32.SW_SHOW);
I have got two problems:
1,the format function always compels me to click the Enter key to go on the format operation.I want to my code can do it for me.So,my program will invoke the Format command and do format operation automatically and never bother me.Then how to realize my dream?
2,When the Format command has been invoked,my program automatically perform the following code no matter if the format operation finished or not.But I hope that the following code should be perform as long as the format operation finished.So,how to settle this problem?
Thanks!
|
|
|
|
|
Hi ,
Yeah I m facing one major problem in my project.Here is the situation in which i want help.
Suppose there is one plane page in which one image of Rectangle is placed but it is any where in the page.Now i have to find out the location of that Ractangle in page.For that i m finding any three corner point(in co-ordinate).
by that i can findout the ractangle.
but major problem is that how to find out exact location of that ractangle in a page?
if any one have any clue the tell me.
Regards.,
Hteen24
|
|
|
|
|
You can also construct a Point object by passing a Size object. In this case, the Size object's width will become the abscissa of the Point, and the Size object's height will become the ordinate of the Point object. For example:
Size mySize = new Size(13, 133);
Point myPoint = new Point(mySize);
System.Console.WriteLine("X: " + myPoint.X + ", Y: " + myPoint.Y);
Sreejith Nair
[ My Articles ]
|
|
|
|