|
Hi,
I am developing a set of custom controls for work with very, very specific purposes. All of these controls are inheriting from the control base class.
My question is : Is there an easy way to 'hide' all of the default properties and only expose the ones I need or do I really have to hide them one at a time?? This seems like such a silly question, I know, but I'm at a loss - most of these controls only really need the default size and backcolor properties but absolutely none of the others and hiding them one at a time from the designer and intellisense is making for some extreme code-bloat...
Any help would be much appreciated...
Cheers
Ian
|
|
|
|
|
Add a custom designer to the project and override the PostFilterProperties method. Example:
public class MyDesigner : ControlDesigner
{
protected override void PostFilterProperties(System.Collections.IDictionary props)
{
props.Remove("property name");
base.PostFilterProperties();
}
}
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Background of my Project....
My project is an asp.net web page that is to run on local machines processing local reports. As of yesterday my web page is using a report viewer to load rdl's not rdlc's. It can handle subreports, drillthroughs, export to csv, expression evaluation, parameter input on the webpage, validation of parameter inputs, etc
Code change that leads to this issue....
I was given the task to find "Special Keys" in expressions for parameter default values and dataset parameter values and replace them with other data. I thought this wouldn't be a big deal until I get this error. I really dont understand why it is getting thrown.
Below is an sample of my code and everything runs fast except when it gets to the highlighted code. When it gets there I do a quick watch on rv.LocalReport.GetParameters() and the Value says Function evaluation is timed out.
The error that is getting thrown is a LocalProcessingException with a message of Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation. I think this is getting thrown because .Count on rv.LocalReport.GetParameters() is not able to be processed because of the function GetParameters() being timed out.
public RParameter[] GetRdlReport(ref ReportViewer rv)<BR>{<BR> // Always enable hyperlinks even if they do not exist.<BR> rv.LocalReport.EnableHyperlinks = true;<BR> rv.LocalReport.ReportPath = msReportFullName;<BR><BR> List<RParameter> rps = GetParameterAll();<BR> if (rv.LocalReport.GetParameters().Count > 0)<BR> {<BR> for (int i=0; i<rps.Count; i++)<BR> {<BR> RParameter rp = rps[ i ];<BR> foreach (ReportParameterInfo rpi in rv.LocalReport.GetParameters())<BR> {<BR> }<BR> }<BR> }<BR>}
Chris
|
|
|
|
|
I tried taking out the GetParameters function to see if I could still make the project work and now SetParameter function is encountering the same thing. Except SetParameter doesn't throw an error it just processes forever. I can't remove the SetParameter function because I need it to set the parameters.
Chris
|
|
|
|
|
To all those people out who where following along. I finally figured it out. Wow almost 8 hours on one little issue. After reverting some code and trying to pin point the issue, I finally got it.
This was NOT a C# coding issue. The issue lies in the RDL.
What I wanted was to be able to put special keys into the default value of report parameters. This was my default value <c>=CDate("%MyKey%") for a DATETIME report parameter. Then when reading this out of the rdl I was replacing the text %MyKey% with something like 4/2/2005. The resulting string would be <c>=CDate("4/2/2005"). Then this expression would go into my Expression Evaluation code and produce the result of 4/2/2005 into a DateTime object. Then I was going to loop through all the report parameters and set the default value of that datetime one as 4/2/2005. Which would result in the RDL loading properly. This is what I hoped for.
In all actuality when I try to loop through all the report parameters, the GetParameters function doesn't work because (I guess) it cant return all the parameters because there is one with an invalid default value (<c>=CDate("%MyKey%")). Well I dont know what I am going to do for report parameters other than strings.
Chris
|
|
|
|
|
Hi Guys,
In my application..
1)I am having one starting form with progress bar which shows the loading process...
2)After completing the progess its starting the actual application form.
3)But when I am closing the first form with progess bar..its closing the whole application..
4)Right now I am making the first form hidden, but I cant close it..
I completely want to close the form....
Thanx
Nishu
|
|
|
|
|
You can not close it nor dispose it. It is like the mother form. If the mother dies all the children will die too.
You must keep on hiding it.
Why are u insisting to completly close it??
Any good reason for that??
|
|
|
|
|
Right now I am doing that only..But is this the only solution...???
Nishu
|
|
|
|
|
|
Hi,
have a look at your Main method. Somewhere there you will find something like this:
Application.Run(new FormStartup());
Change it to something like this:
new FormStartup().ShowDialog();
Application.Run(new FormMainApp());
When FormStartup is done just close it and the other form will appear.
Robert
|
|
|
|
|
That sounds cool.
I will try it.
|
|
|
|
|
The functionality you're describing is called splash screen and there are some articles here on Codeproject that cover this topic and should give you some ideas how to implement this effectively and nicely. Just search the articles for "splash screen".
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
I'm inheriting TabControl in user defined class CustomTubControl, but when I try to open form with this control in Designer, I get error message: "TabPage cannot be added to a 'Microsoft.CompactFramework.Design.UnsafeControl'. TabPages can only be added to TabControls." on line:
this.m_Tab.Controls.Add(this.tabHeader);
Form builds, but it is not visible in Designer. How can the new control be visible in the Designer?
|
|
|
|
|
Hello,
The TabPage has to be added to the TabPages property of your TabControl.
this.m_Tab.TabPages.Add(this.tabHeader);
All the best,
Martin
|
|
|
|
|
I am having problem with control events.I am unable to raise overriden paint event.drag& drop event and mouse events.The control is dropped on a designer at runtime i.e control can be moved freely on the designer at runtime.
used delegate to raise the event but not working...
|
|
|
|
|
Hello,
Looks like you forgot to call the base.xxx Method of the overriden events.
like:
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint;
}
Hope that helps!
All the best,
Martin
|
|
|
|
|
I have called base.xxx method.
Eventhough i have kept a breakpoint at the beginning of the method ,it doesn't go to the method itself.
|
|
|
|
|
snoby wrote: The control is dropped on a designer at runtime
Ohh, now I understand.
Youre control is in design mode, or not?
Don't think that the event's are fired in this mode.
Sorry for not realy helping.
All the best,
Martin
|
|
|
|
|
Tell me how to get updated Coordinate position when control is dragged & dropped on any part of designer without using events.On designer also events are not getting raised.
|
|
|
|
|
I want to open mdi form from login form ....im using following code....
in Login form..but its not working.....
private void cmdsubmit_Click(object sender, System.EventArgs e)
{
frmmdi frm = new frmmdi();
this.Dispose();
this.Close();
frm.Show();
frm.Enabled=true;
frm.Visible=true;
}
ahmad.osama1984@gmail.com
|
|
|
|
|
Hello,
Osama123 wrote: this.Dispose();
This is not going to work, because you are Disposing the form wich holds the reference to your new form.
Osama123 wrote: this.Close();
Same here, because the Close method calls the Dispose method.
Osama123 wrote: frm.Enabled=true;
frm.Visible=true;
This is normaly the default setting, so you shouldn't need it.(But it's not wrong)
Osama123 wrote: this.Dispose();
this.Close();
You should use this.Hide() instead.
Hope that helps.
All the best,
Martin
|
|
|
|
|
Thanx Martin.........
|
|
|
|
|
Youre always welcome!
All the best,
Martin
|
|
|
|
|
try this.Hide() instead of close and Dispose.
In the closing event of frmmdi use Application.Exit().
Hope this satisfies ur needs...
|
|
|
|