|
Skippums,
Thanks for your suggestion. I've indeed done as you said one time before, and it works. However, as far as I understand it, reflection done in this fashion is very slow when compared to a normal method call.
In this part of the application, I can't really afford the performance loss. That leaves me with delegates as my only choice since they are, as I understand it, much faster than reflection.
Leonardo Pelisoli
|
|
|
|
|
It is my understanding that delegates are by design bound upon creation. Therefore, you either need to have the object being bound in your static constructor, or you need to use reflection.
Another alternative that may help is a hybrid of the two, where you would add a value to the dictionary so you keep BOTH the delegate AND the method info. Then, whenever you call the method that needs to use the delegate, check if the delegate is null, and if so, bind the delegate at that time and save it in the dictionary. Since dictionary lookup is an O(1) operation, the only noticable performance penalty would occur the first time you called the method. Alternatively, you could do this work in the instance constructor for the class, which would eliminate the slight overhead in the methods that use the information. Anyway, let me know if this will work for you.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Skippums,
I ended up filling the dictionary in the instance constructor of the class, as you said, so that I can bind the delegates at that time. It works!
Thanks a lot for your help.
Leonardo Pelisoli
|
|
|
|
|
Hello,
Is there any way to disable the scrollwheel function for a ComboBox?
Thanks
R.Myers
|
|
|
|
|
The combobox has a MouseWheel event but it appears to have no way of altering the data (the properties are all read only) or cancelling.
You may have to invesigate in the API: WM_MOUSEWHEEL[^]
|
|
|
|
|
This works!
namespace WindowsFormsApplication1
{
public partial class Form1 : Form, IMessageFilter
{
private const int WM_MOUSEWHEEL = 0x20A;
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == WM_MOUSEWHEEL && this.ActiveControl == comboBox1)
{
return true;
}
return false;
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Application.AddMessageFilter(this);
}
}
}
|
|
|
|
|
Thanks! That worked great!
R.Myers
|
|
|
|
|
Does anyone know how to embed hidden characters in a rich text box? I am trying to do some custom advanced formatting, and I would like to embed hidden characters to trigger start and end formatting..
Thanks!
|
|
|
|
|
I hope you know how to use Google, since that's how you will find what you need[^] I guess.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
C# vs2005. Im creating a simple web page image upload program.
The user enters a local directory and the web page displays thumbnails of all the images in that directory.
This works fine if I create thumbnail files on the server and display the images using their virtual paths eg "/images/image1.jpg"
Copying the files can be time consuming so im trying to get the same result without creating my own thumbnail copies.
I create ImageButtons and set the image url to be the absolute location of the image on the client eg "c:\temp\images\image1.jpg"
When I run the app the images are not displayed. If I copy the generated html and load it in another instance of internet explorer the images are displayed fine.
How can I get images to be displayed using absolute paths when the images reside on the client?
Many thanks,
Chas
|
|
|
|
|
I have created an invoice like crystal reported,
Which gets it data from a stored procedure with 1 parameter which tells which invoice data to use.
Now the problem is that it always tryes to execute this stored procedure from the server it was created on, I have set the database login but it still doesnt execute from that database.
Now im either looking for a method of fixing this or another method to get the data in.
I have tryed using a dataset using the SetDataSource function but i have no idea how i can assign or even get the fields in the crystal report designer mode to there proper locations.
Thanks
ReportDocument Report = new ReportDocument();<br />
if (File.Exists("factuur.rpt"))<br />
{<br />
Report.Load("factuur.rpt", OpenReportMethod.OpenReportByTempCopy);<br />
}<br />
else if (File.Exists("..\\..\\factuur.rpt"))<br />
{<br />
Report.Load("..\\..\\factuur.rpt", OpenReportMethod.OpenReportByTempCopy);<br />
}<br />
else<br />
{<br />
MessageBox.Show("Factuur.rpt niet gevonden, opdracht kan niet uitgevoert worden");<br />
return;<br />
}<br />
Report.SetDatabaseLogon(settings.user, settings.password, settings.server, settings.db);<br />
Report.SetParameterValue("@FactuurID", ID);<br />
crystalReportViewer1.ReportSource = Report;<br />
<br />
|
|
|
|
|
Strange but give this a try -
Within crystal reports, ensure file/ report options/ 'save data with report' is unselected.
Ensure settings.server value is the correct one you want.
In the Report.Load try only sending the filename.
Failing that I would just open the report in crystal reports and under database - set datasource location use the final database you want.
Thanks,
Chas
|
|
|
|
|
hi how can i changed the components icon,
pelase check the link
Sample.jpg
(32 KB)
i can change the Toolbox icon for new components but when i dragged it into form i have got the default icon . how to solve it !!
Thanks in ADvance
|
|
|
|
|
How are you setting the toolbox icon? Using the ToolboxBitmapAttribute, it sets the icon in the toolbox and in the form's component area.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Dear guru's,
I want to start my first WPF-exercises.
Can you give me a hint, which components I need to download for this purpuse?
(e.g. NetFramework 3.0)
Another stupid question: Are WPF-applications possible on Win-XP?
Thank you for your help
|
|
|
|
|
Hi there
In order to run WPF applications, you'll need at least .NET 3.0, but if possible, use 3.5, which are both supported by xp as well. If you're a novice developer, have a look at Visual Studio 2008 Express for Windows - it'll give you everything to get started.
http://tinyurl.com/yrxzhk[^]
Happy coding!
Philipp
|
|
|
|
|
C# Express 2008 has built in support for WPF projects - nothing extra required - as has Visual Studio 2008. Most sites with articles on WPF seem to use expression blend for UI designing, but it's not necessary - just easier.
No problems running WPF apps on XP!
|
|
|
|
|
Thank you for your help! ! !
|
|
|
|
|
Hello every body.
My project is C# project on VS2005 .net
How can I catch a key pressed but not like event for a Form , tabControl and other component, for all program.For exapmle:
If my program is started and is pressed keys like F1,F2,F3... and etc. I want to make some function on this Keys pressed.
Thanks for all in advance.
|
|
|
|
|
t_nedelchev wrote: How can I catch a key pressed but not like event for a Form
What do you mean?
only two letters away from being an asset
|
|
|
|
|
I think he means an application wide keypress event handler.
|
|
|
|
|
Have a look here[^]. I haven't tried it but it looks like it'll do what you want.
|
|
|
|
|
|
Hi,
yes you can create system-wide hotkeys.
My Code Rescue article[^] uses them (but does not mention it in the article itself).
There is some P/Invoke involved, calling Win32 functions.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hello every body.
How can I catch Key press but not like event for a Form or other component.
For exapmle:
if my program is started end is presed keys F1,F2,... and etc. I want to catch this Keys presed.
Thanks for all.
|
|
|
|