|
yea sure it is
jamil abou khalil
|
|
|
|
|
can u say its exact name and its namespace?
sakthi
|
|
|
|
|
please guide me about creating a horizontal dockable window within Mdi childform.
* I just want to create a MDI interface.
* a child form that can be minimized, maximized in MdiParent client area.
* Also a dockable window (similiar to output window in visual studio 2003) that makes it space with childform.
Please reply.
|
|
|
|
|
if you are creating an MDI, then all the childforms have bydefault the funcationality of minimized, maximized.
can you clear your question about dockable window (similiar to output window in visual studio 2003).
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Dear sAqIb!
I need a single dockable window (similar to output window in IDE) alongwith that child form in the area of Parent form.
Thank you.
|
|
|
|
|
I was looking for the same sort of functionalities described above.
Try
http://sourceforge.net/projects/dockpanelsuite/[^]
There is a good sample app to get you started too.
Set the parent form's IsMdiContainer property to true.
-- modified at 19:47 Wednesday 8th November, 2006
|
|
|
|
|
Thank you dear.
I have seen that project at sourceforge.net but how can i modify it for my functionality?
Can u guide?
Regards
|
|
|
|
|
Hi
I have a ComboBox control and i wrote comboBox1_SelectedIndexChanged() event for it.
Now ReFilling combobox causes to running SelectedIndexChanged() event each time when new item added to combobox and this slows the program or maybe cause to unwanted problems.
I use below code but i want a better way or setting a property of combobox which i don't know about it:
private bool allowCmbChange;
Form_Load()
{
allowCmbChange=false;
for (int i=0;i<10;i++)
{
comboBox1.Items.Add(i.toString());
}
allowCmbChange=true;
}
private void comboBox1_SelectedIndexChanged()
{
if (allowCmbChange==false)
return;
.
.
.
}
Thank you for helping me.
|
|
|
|
|
Hello,
Instead you could unlink the event before you start the Items.Add and link it agein when you are done.
Form_Load()<br />
{<br />
this.comboBox1.SelectedIndexChanged-= ...<br />
for (int i=0;i<10;i++)<br />
{<br />
comboBox1.Items.Add(i.toString());<br />
}<br />
this.comboBox1.SelectedIndexChanged+= ...<br />
}
All the best,
Martin
|
|
|
|
|
Why are you doing this in Form_Load? Doesn't it load once when the form loads?
|
|
|
|
|
Hi
I just wrote it in Form_Load for an example.
I all over the code section a have this problem.
|
|
|
|
|
Before you fill it, store the selecteditem.
Fill it.
Restore the selectedItem.
|
|
|
|
|
Hello guys,
it is annoying, but I don't know what I can do else.
I have a single Form, without any Windows controls. It is just black.
I do some paintings like graphs, diagtrams and stuff like this.
In the previous version I redraw everthing cyclically in the Paint-Method of the Form,
by using "this.Refresh" in a timer. But the timer cycle is too fast, I had a high CPU load.
Now, I have several invalidation rectangles of those graphic parts, which has to be really redrawn.
I put all that rectangle together in one region called "myRegion", by using the myRegion.Union(anotherRect).
Finally i call in the timer this.Invalidate(myRegion). Afterwards I clean up this Region for next timer cycle.
All needed parts are redrawn correctly, but the CPU load is not much better.
I figured out, the more rectangles I combine with "myRegion", the more CPU load is needed.
I need urgent help. How can I fix this :-/
-- modified at 7:55 Wednesday 8th November, 2006
|
|
|
|
|
Is the display actually changing on each timer cycle? If it's not, you'd be better off driving the display off of changes in the data that creates the graphs as opposed to simply redrawing on each cycle no matter what. You could make this change to your code with very little work - do this data changing validation on the timer. In the long run, it'd be better to get rid of the timer completely, and make the drawing event driven, but at least you could check out the difference this way.
Also, with the invalidation of rectangles that you're doing - are you actually using the clip rectangle in your drawing code? If you're not actually using the clip recangle directly to determine what needs to be drawn, then the only speed gains you're getting is by GDI+ itself clipping, and that shouldn't be very significant (from your comment, it seems this is the case). Don't take this the wrong way - most of the GDI or GDI+ code I've seen that does this sort of thing has either ignored the clip rectangle or used it incorrectly - it can be difficult initially to use the clip rectangle correctly, and some apps may not benefit from it anyway - yours sounds like it would though.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
hi, thx fopr your reply.
Actually, I have have to update that paintings cyclically. There is no way out.
Your question concerning the rectangles,
actually I calculate few rectangles (Type Rectangle), where the redrwa has to take place.
Then, in the timer I make som myRegion.MakeEmpty(), afterwards I add those rectangles to this
myRegion with myRegion.Unioin(rectangle1), myRegion.Unioin(rectangle2), myRegion.Unioin(rectangleN)...
This works fine, and I can see, if an area outside the rectangles is not repainted, so I know that not the whole screen is repainted. I checked this also by disabling the double buffer (then it starts to flicker in that regions).
What did you mean with "clip recangle", isn't it that stuff mentioned above? Or is this a special type?
|
|
|
|
|
By invalidating regions, you are creating a clipping rectangle, and when Paint gets called, one of the properties of the PaintEventArgs is a "ClipRectangle". If possible, you should use this rectangle to only paint those items that got invalidated.
For instance, suppose you have two graphs on the screen, and your clipping region is around the 2nd graph (I apologize for the ASCII drawing here, I couldn't find a suitable image online quickly)
+--------------------------+
+---------------+ | +---------------+ |
| | | | | |
| | | | | |
| graph 1 | | | graph 2 | |
| | | | | |
| | | | | |
| | | | | |
+---------------+ | +---------------+ |
+--------------------------+
In your paint handler, you should be using this ClipRectangle value to draw only graph 2 - graph 1 has not been invalidated and does not need to be redrawn.
However, if your paint handler does not use the ClipRectangle value and draws everything, you are wasting CPU cycles, because not only does this not need to change, but the Graphics object passed into the handler is also setup with the clip rectangle value - and it won't even paint outside of that area (even if your drawing code does).
This is why only the areas you invalidated flicker when you turn off double buffering - the Graphics object has already been setup to clip the drawing, but you're still using CPU cycles attempting to draw outside this area.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
oh, nice!
This sounds really promsing. I didn't know, that that PaintEventArgs can handle such "Rectangles".
I cannot not test it currently, but: Is it possible, to take my calculated rectangles and combine/convert them into ClipRectangle?
-- modified at 13:50 Wednesday 8th November, 2006
HMmmm. it seems that I got you wrong. I should use that argument ClipRectangle to draw my stuff. But where does the form know, which areas has to be redrawn or which not? I thought I can affect this ClipRectangle. I'm wrong, right?
|
|
|
|
|
The ClipRectangle is the rectangle on the form that needs to be updated - and the form knows this from your calls to Invalidate, which is basically setting up the clip rectangle and telling the form that it needs to paint at some point. Other system events such as a different window moving over your form do basically the same thing, and only invalidate the portion of the form that it was over. If the entire form needs to be redrawn, the clip rectangle will be the size of your entire form, well the paintable portion of it anyway.
In short, you should use the ClipRectangle to determine which of your items need to be redrawn inside of the paint handler. Anything falling outside of the rectangle can be safely ignored, but anything that is entirely within or partially within that rectangle must be redrawn.
From the sounds of it, the only code of yours that needs to change is inside of the paint handler. You're already correctly invalidating only those portions of the form that need to be changed, now you just need to take it one step further inside of the paint handler and only draw those things that need to be drawn.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
"...now you just need to take it one step further inside of the paint handler and only draw those things that need to be drawn..."
sorry, but I don't get it. How it should look like?
I mean, I call this.Invalidate(myRegion), then the app goes into the Paint-method of the form.
What ist next step exaxactly? E.g. when I have a line to be drwan from left top corner to bottom right corner, and only a part has to be updated, where to tell this in the code, to ignore the outer parts of myRegion?
|
|
|
|
|
This isn't quite what you were indicating initially - from you initial post you indicated that you had a form with several objects in them (graphs, and I don't remember what else). Since each object only takes up a small portion of the form, invalidating small portions of the form (and therefore a subset of all drawn objects) is possible. If this isn't the case, then this isn't really the correct method for doing so (it could be done, but gets much more complicated).
When you call this.Invalidate(myRegion) , internally it will convert the region into a rectangle, and then flags the windows sub-system that the form needs to be painted. When the paint event is raised, this rectangle is passed in as the PaintEventArgs.ClipRectangle and is setup as a clipping region in the PaintEventArgs.Graphics object.
Here's what I'm trying to advocate as the next step (very simplified code, should be enough to get the gist of it):
class PaintObject
{
public Rectangle Rect;
public void DrawObject(Graphics g)
{
}
}
ArrayList paintedObjects = new ArrayList();
protected override void OnPaint(PaintEventArgs e)
{
foreach (PaintObject obj in paintedObjects)
{
if (e.ClipRectangle.IntersectsWith(obj.Rect) || e.ClipRectangle.Contains(obj.Rect))
obj.DrawObject(e.Graphics);
}
base.OnPaint(e);
}
Note that anything that is either fully contained in the clipping region or touches the clipping region in any way is redrawn using this method. Also note that none of your other code changes - correctly calling this.Invalidate(myRegion) is the key to this entire process, as it is the source of the clipping rectangle and what tells the form that it needs to paint.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
hmmmm, i guess this will not work in my case.
Imagine the following example:
I have a gauge on the screen (in fact 4 of them), with an arrow in the middle.
To reduce CPU load, i divided the gauge into 4 parts (quarters).
Befor Invalidation, I check the arror position and recalc the invalidation rectangle,
means: the quarter to be redrawn, the reminder (three) quarters of the gauge is beeing left, since there would be no change.
The gauge depends on the Form size (height, width).
Everything I have is now:
- the gauge's size (complete)
- the gauges' invalidation region (rectangle) to be redrawn
I must be dump like hell, but I cannot figure out, how your idea would work in my case :´-(
|
|
|
|
|
OK, that makes more sense now. Similar to how I thought it was originally, but not quite. The way you describe it, I don't see how it would work directly - plus invalidating a quarter of each gauge will end up creating a clip rectangle that covers most of the form (since each invalidated region gets added together to create a single rectangle).
However, you could probably still make it work with a bit more work on your part. Instead of drawing them all in the form's paint event, create a user control that encapsulates a single gauge. This will probably be a bit better anyway, as it could better handle some requirements changes (ie - what happens when the user decides that one of the gauges isn't important and wants it removed, or wants to add more, or even wants to adjust it dymanically).
The same concept applies to user controls as it does to forms - the paint event gets the same arguments and can be used in the same way. And once you have it narrowed down to a single gauge, then you're back to where we were, and you can begin to look at the clip region again to minimize drawing.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
hi,
i have to display date in the format as follows, mm.dd.yyyy( e.g. 12.31.2006)
How i will be able to do it in asp.net web application using c#?
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
yogita charhate wrote: i have to display date in the format as follows, mm.dd.yyyy( e.g. 12.31.2006)
How i will be able to do it in asp.net web application using c#?
This can be done in any C# application (ASP.NET is just a framework for designing web applications)
DateTime myDateTime = DateTime.Now;
string displayDate = myDateTime.ToString("MM.dd.yyyy");
|
|
|
|
|
Thank you very much Colin, I've successfully completed the functionality.
have a nice day!!!!!!!!!
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|