|
You don't "call" a variable, so you probably need either a method or a property. Put the code to return the correct value inside the method or property.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Wogboiii wrote: Is there a way to assign a variable a series of values?
Use a collection.
|
|
|
|
|
Yes, if you make the variable a property of a (static) class that provides the behavior you want.
Console.WriteLine (Variable.Value.ToString());
Console.WriteLine (Variable.Value.ToString());
Console.WriteLine (Variable.Value.ToString());
Console.WriteLine (Variable.Value.ToString());
will print
5
9
46
152
/ravi
|
|
|
|
|
Somewhere in the Microsoft guidelines it sure is stated one should not use properties to return changing data; properties should be pretty constant, such as Environment.NewLine . One of the wildest but acceptable exceptions being DateTime.Now .
When real data is to be offered, a method should be used; that is why Directory.GetFiles() and Random.Next() are methods and not properties.
|
|
|
|
|
Luc Pattyn wrote: Somewhere in the Microsoft guidelines it sure is stated one should not use properties to return changing data; properties should be pretty constant,
Yes, that's CA rule #1024[^].
I used a property for ease of understanding. It could of course be replaced by the method .Value() .
/ravi
|
|
|
|
|
You don't need ToString with WriteLine.
|
|
|
|
|
Imho, it's good practice to use ToString() for at least 2 reasons: (1) it provides deterministic formatting and (2) it takes advantage of a custom object's display format. (1) makes it easier to perform regression testing and (2) allows meaningful information to be displayed vs. just the object's fully qualified type name.
/ravi
|
|
|
|
|
What do you think WriteLine will do if you leave it off?
|
|
|
|
|
You're right in saying you don't need to ToString() an int (and many other types) because WriteLine() will display an acceptable form of the type without it.
But you seem to have missed the point I was trying to make.
/ravi
|
|
|
|
|
You may have missed the point <i>I</i> was trying to make...
Ravi Bhavnani wrote:
WriteLine() will display an acceptable form of the type without it.
... by calling ToString.
|
|
|
|
|
Yes, you are correct. As I said in my previous post.
/ravi
|
|
|
|
|
hi everyone, When debugger works, it comes to a procedure, enters in, runs a few lines of code and goes out without completing whole procedure and finishes debugging without any error. Your valuable comments are welcomed, thanks
|
|
|
|
|
Is it an OnPaint or something like that? There are sneaky hidden try/catches around some the of WinForms methods that "eat" your exceptions before you see them (you can work around that a bit by putting a try/catch around the code and put a breakpoint in the catch)
|
|
|
|
|
|
If you're debugging a multithreaded app, this could happen.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I have a custom control containing a movable Thumb (similar to ScrollBar Thumb), drawn using a System.Drawing.Rectangle which can be clicked and dragged etc
As I am showing ToolTips for other controls within this custom control, I would like to be able to show a similar style ToolTip for the Thumb (and other similar pseudo controls) .
My understanding is that as the Thumb is not based on Control, the ToolTip class cannot be used to do this.
Do I need to make my Thumb a Thumb class based on Control, to attach ToolTips?
Is there a way to attach a ToolTip to Rectangles etc in another fashion?
Thanks for any help or suggestions.
AussieLew
PS.. I have done a fair bit of searching on this and have found nothing helpful even though I thought it would be a common question.
|
|
|
|
|
When developing your application you need to keep aware of what occurs in other applications you use. The scroll bar (or Thumb as you call it) is just a slider within another containment object. A tooltip is useful for the data container but really useless for the scrollbar. If you do need a tooltip for that, then the users have NO PC experience what-so-ever and the problem should be address via training instead of an improper use of tooltips.
|
|
|
|
|
The custom scrollbar(not based on Scrollbar for various reasons) is being used on a control in a situation where the user may view it as a position indicator only. As I have provided ToolTips for all other controls (ToolButtons, TextBoxes etc) within this control, in the interests of consistency, I thought it proper to also provide a ToolTip for non-control based items that can provide actions.
All this aside though, provision of a ToolTip for non-control based items must be a common need surely.
Examples that spring to mind are:
.. A drawing or cad situation where you could provide instant feedback of line & shape properties.
.. Flowcharting and Statistical charts etc where hovering over a particular area would provide additional detail.
.. Breaking up a graphic eg a Map, to provide additional info for various segments, States or legends etc.
.. Inline Text within a document, where intellisense type information could be provided on mousehover.
|
|
|
|
|
How can I have a page folding (page turning) effect in WinFom so it wil be an image at the button which use will click the it will be an effect like page is turning?
|
|
|
|
|
|
Hello everyone,
I have a C# application that allows users to write some plugins. I have an app that I have written in C++ and OpenGL and I want to write a plugin that encapsulates that app.
So, what I wanted to do was create an unmanaged C++ DLL which I could load from my C# plugin and have methods to initialize OpenGL and handle all the drawing etc.
I have an exported method init_gl that seems to work. All it does is initialize OpenGL and creates and enables the rendering context.
How do I handle all the paint events etc.? Normally, in a pure C++/OpenGL app, I would have a message loop that would call the animation code.
My question is how can I delegate the resize, paint events or any other message that might be of interest to the DLL from my C# app. Also, is it a good way to do this? My C++/OpenGL app is quite complex and rewriting it all in C# is not really an option.
So, at the moment, I create my winform and the host control and pass its handle to the DLL and call OpenGL methods on it.
Would really appreciate any help.
Thanks,
keith
|
|
|
|
|
Keith,
Your wrapper would hold the responsibility of providing all of that functionality...but as you probably are aware of...it will take some work.
First you should define all of the methods that you want exposed (such as Resize) and the parameters that are required.
Then implement each of those methods in your wrapper and have those methods call into your C++ DLL. Your wrapper basically becomes a means of marshalling the C# calls into the C++ applications.
Once you are done with it consuming it would be just like consuming any C# library.
|
|
|
|
|
I need form with shaded background.
One way, I can achieve it by making image of shaded color and set it as backgroundImage
Second way, I can use System.Drawing.Drawing2D.LinearGradientBrush class with Form paint event
My question is which one is good practice from the performance point of view ?
Thanks in advance
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim
So Smile Please
|
|
|
|
|
The difference will be trivial.
If you're generating your background image from within your program, you should consider that GDI will probably have better algorithms than you for doing this. Also if your form is resized, you'll have to recalculate your background at every resize. If the form is only displayed once, you'll take a performance hit from going to an outside file, or paging in the resource you're using for the background. (bigger executable = larger loading time).
But again, this are trivial performance differences.. Since you're displaying a form, I suspect that you want some user interaction. The user won't notice the difference.
|
|
|
|
|
Hi,
Great fan of the codeproject and the people who contribute.
I want to provide the ability to change a jpeg brightness and contrast.
Peoplae have suggested that I want a Window/Level approach. However I am not an Image processing guru (and I mean that). I did what any thickie might do and banged the Window/Level into google. This seems to comeback with cxImage and vtk.
So far, vtk seems to play nicely with Windows Forms and I have not investigated cxImage.
I am not a MS guru either (I know it gets worse), but know enough to create application can call unmanaged C++.
Regards,
Iain
|
|
|
|