|
to close all forms that embedded in tabpage more. how can i do?
i can close only one form but i want all form close which opened.
|
|
|
|
|
I'm trying to develop a forumn page like code project's. The client-side expand and collapse function is what is attractive to me. I've noticed the main property that makes the client-side code work is that all hyperlink ID's are set to the name: id=DynMessLink.
The problem is that asp hyperlink IDs cannot be the same name but I need the databinding functionality for setting the text property.
Any ideas?
"Make it as simple as possible, but no simpler" Issac Newton
|
|
|
|
|
Emit a javascript array with all the id's, pass that to the client-side code.
|
|
|
|
|
In my application I have an array of custom objects that I want to search by one of the properties of the custom object (the ID property which is an int), please see the code below to understand what I'm trying to do:
private CustomObject[] _customObjects;
public CustomObject CustomObjects
{
get
{
if(_customObjects == null)
{
CustomObject[] customObjects = CustomObject.GetCustomObjects();
Array.Sort(customObjects);
_customObjects = customObjects;
}
}
public IsIDInList(int id)
{
return Array.BinarySearch(CustomObjects, id) >= 0;
}
I could use a dictionary of course but I don't want to for some reasons specific to my application. Any suggestions are highly appreciated...
|
|
|
|
|
Hi,
I suggest you have a look at this overload:
Array.BinarySearch Method (Array, Int32, Int32, Object, IComparer)
and if necessary read up on IComparer.
|
|
|
|
|
Hi, thanks for your reply, actually I know about IComparer and IComparable and I use them very often in my code but I never had the need to compare objects of different types, this is why I'm a little confused, I know it's not possible using the generic version of IComparer, are you referring to the non-generic version? A short code sample would very helpful, thanks a lot.
|
|
|
|
|
All your objects are of type CustomObject, aren't they? (either directly or by inheritance)
If you can Sort the Array, why wouldn't you be able to BinarySearch it?
|
|
|
|
|
Hmm, seems you didn't read my post very carefully , I have an array of CustomObject objects, CustomObject has a property named ID which is an int, I want to search the array for a custom object with that ID or in other words I want to be able to know whether there's a CustomObject in the array with that ID, I'm not interested in returning the object, I just want to know whether it's in the array or not.
Regards
|
|
|
|
|
Array.BinarySearch will look for an element with a specific Property, provided your
IComparer is based on that same Property, hence the Array must be Sorted accordingly.
And it will return a positive index when found, or a negative number when not found.
|
|
|
|
|
I only have the value of the ID property (have a look on the code), I don't have the object, can I pass objects of different types to IComparer.Compare()?
|
|
|
|
|
Hi,
if your IComparer only looks at the object's ID, you could pass it a dummy object with the
ID value you are looking for.
|
|
|
|
|
Hmm, so this means to create an object and assign it the value I want for the ID just for the sake of passing to the IComparer, is my understanding correct? So, as far as I can see, comparing objects of different types is not directly supported by the framework, is this correct?
|
|
|
|
|
Waleed Eissa wrote: to create an object and assign it the value I want for the ID
that was the idea yes
Waleed Eissa wrote: comparing objects of different types is not directly supported
objects of different types are different by definition, no need to compare them.
this is not related to any framework, they differ by definition in OO. chairs aren't tables.
If your different types have a useful common ancestor (say furniture) you should
use that as the basis for your logic.
|
|
|
|
|
How do you divide an image? Say i have a 64x64 pixel image and i want to divide this into two equal and separate triangles (triangle1 U triange2 = original image). I was thinking of using points to create regions. Since the image has four corners that i can use as four starting points, i can choose three of them to "bound" a region. Is this possible? If so could someone provide some sample code?
|
|
|
|
|
No bitmap is ever a triangle. Do you want to create bitmaps that each contain a triangle ?
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
|
Your only other option is a byte array that cannot be displayed until you put it in a bitmap. All bitmaps are square. That's why I'm trying to clarify what you need here.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
So then if i want to create a bitmap that contains a triangle, would I create a bitmap that can enclose the triangle and fill the rest with something like null pixel value?
|
|
|
|
|
No such thing as null, you'd need to choose a color to fill the rest with.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
From what i see in System.Drawing.Region, correct me if Im wrong, I can create a region of any size and shape. System.Drawing.Rectangle uses four points to specify the size of the rectangle using four points, but i dont suppose its possible with System.Drawing.Region using three points? Im not sure if im making sense.
From reading previous posts, i implied that i needed to save these two triangles separately, which meant that i need to display the divided image. However, this is not the case. I just need to divide up an image, perform some changes within those triangles and display them altogether with the changes that were made.
|
|
|
|
|
You can create a region, but that's not a bitmap. I thought a region specified an area on a bitmap, not an irregular bitmap itself.
Yes, I believe the graphics object has a number of methods that take a region and only operate within that region on the bitmap. What sort of changes ?
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Just changing the value of the pixels. Nothing complex. So to create a region using System.Drawing.Graphics, i just use a Point array?
Thanks for the responses.
|
|
|
|
|
yeah, I believe so.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
|
Ok few more questions:
1) How is the coordinate plane set up? Like where would the origin be?
2) could a point be outside of an image?
|
|
|
|