|
Hi,
Didnt work as well!
Nuno
|
|
|
|
|
It's not clear to me from your post what behavior you're seeing with this. However, if I understand you correctly, you want a vertical splitter that contains a horizontal splitter in one of its two panels. In order to accomplish this, you need to add the horizontal splitter to the controls collection of the panel you want the horizontal splitter to be contained by. In the above code, whenever you call addNewRegion a new splitter is created and it is added to the form's controls collection. This won't work.
Also, it seems you are over complicated the problem. If you are setting the Dock property of the splitter to DockStyle.Fill, then the control will automatically fill the bounds of the form. So you don't need to set the location or the size.
I would try the following and massage it as needed:
// create the vertical splitter
SplitContainer verticalSplitter = new SplitContainer();
verticalSplitter.Orientation = Orientation.Vertical;
verticalSplitter.Dock = DockStyle.Fill;
// create the horizontal splitter
SplitContainer horizontalSplitter = new SplitContainer();
horizontalSplitter.Orientation = Orientation.Horizontal;
horizontalSplitter.Dock = DockStyle.Fill;
// add the vertical splitter to the form
this.Controls.Add(verticalSplitter);
// add the horizontal splitter to the first panel of the vertical splitter
verticalSplitter.Panel1.Controls.Add(horizontalSplitter);
...
Hope this helps.
|
|
|
|
|
Hi,
I have conscience of what you have just told me but i need to have the freedom to add as many splitContainers inside another splitContainer, recursively.
I don't know how am i gonna do that yet. I'm thinking in keep a structure, like a binary tree to keep track of the info of each splitContainer.
The first will be the root of the tree. If i then want another splitContainer inside the panel2 of the first splitContainer, i'll need to add a new node to the tree at the root's right. And if then i want another split container, inside the seconde split container, etc...
But, for now, i'm just testing the first level, with the most basic example.
My problem right now is with the form refresh.
As i said, the body, of the method, if executed inside the Form1_Load(..) will create a splitContainer soon as the program is executed.
However, if i call the code inside the AddNewRegion(..) method, it is not drawn.
Accidentally i found that, once executed the application, and pressed the button that executes code (which seems not to draw a thing), if i minimize and then restore the window, i can see the splitContainer drawn.
Did you understand me now?
Now i have sure that this is a refresh problem, but i still don't know how to solve it.
Any tips?
Thx,
Nuno
|
|
|
|
|
The SplitContainer control is meant to contain something. By itself, it doesn't always paint correctly. I'm not sure why this is but it is not too much of a problem because a SplitContainer that contains nothing should never exist in an application. Try putting something in the panels of the split containers and see if your problem goes away.
|
|
|
|
|
Nope... at least with what i done, which was the following:
<br />
SplitContainer region = new SplitContainer();<br />
Panel panel = new Panel(); <---<br />
<br />
region.SuspendLayout();<br />
this.SuspendLayout();<br />
<br />
region.Dock = System.Windows.Forms.DockStyle.Fill;<br />
region.Location = new System.Drawing.Point(0, 0);<br />
region.Name = "region";<br />
region.Size = new System.Drawing.Size(292, 266);<br />
region.SplitterDistance = Int32.Parse(p.width)/2;<br />
region.TabIndex = 0;<br />
region.Orientation = o;<br />
<br />
<br />
region.Panel1.Controls.Add(panel); <-----<br />
this.Controls.Add(region);<br />
region.ResumeLayout(false);<br />
<br />
regions.Add(region);<br />
<br />
this.PerformLayout();<br />
this.Refresh();<br />
|
|
|
|
|
I discovered why SplitContainers seem to paint strangely. They have not border by default. YOu have to set their BorderStyle property in order for it to paint borders.
Try:
region.BorderStyle = BorderStyle.Fixed3;
|
|
|
|
|
Yes, that's it!
Thank you very much!
Nuno
|
|
|
|
|
Hi,
I would your help again.
As i was inserting the splitContainer into the main form directly, it was being draw at the position (0,0), staying under a menu bar i had already defined.
To bypass this problem, i putted a panel to define the area i want for this control. Ok, the split container is now being drawn at the point (0,0) of the panel.
Now that i can see the splitContainer that is created i have another problem.
Altough the property dock is defined to fill, it doesnt appear filled, it appears with a very small size inside the panel.
When i move the spliter, the splitContainer becomes filled to the panel.
I tried to refresh() but it doesnt work.
Any tips?
Thx,
Nuno
|
|
|
|
|
I can't seem to duplicate your problem. Perhaps I don't understand you correctly.
I made a Panel smaller than the form's ClientRectangle and added it to the form. I then added a SplitContainer with a DockStyle of Fill to the panel. My SplitContainer fills the panel's client rectangle.
Am I misunderstanding your problem? You don't want your SplitContainer to fill the client rectangle of the form, so you created a panel with the dimensions and location you want the SplitContainer to have, then you added the SplitContainer (with DockStyle.fill) to the panel, but it doesn't fill the panel until you drag the splitter? Is that correct?
|
|
|
|
|
No, you are not fully understanding the problem.
The main difference is that i'm only adding the panel dragging and drop the control to the form, because the splitContainers are being added dynamicly with code.
I have bypassed the problem though, taking out the resumeLayout and SuspendLayout methods invocations.
I don't know if this is going to bring me problems in the future, but i have found someone here who doesnt use them without any problems.
Thx,
Nuno
|
|
|
|
|
As a side note, it is a programming convention to use uppercase names for methods, i.e. AddNewRegion rather than addNewRegion.
|
|
|
|
|
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I have alredy added a DataSet name Publications where I have add three tables.
Table(0) is Query_Volume_VolumeLessons
Table(1) is Query_Volume_Sectos
Table(2) is Query_Volume_Themes
Also put data on Table(0) from SQL SERVER DataBase
Now How can I put data to Table(1) From Table(0) , using a sqlQuery
Thanks
Sarfarj Ahmed
|
|
|
|
|
dear ;
i have a problem with my windows form because when i run the program which contains a graphs in pictureboxes the graphes appears but when i minimize the form and get it back ,,,the graphes dissapears ???!! really i want to know how to over come with this problem.
the second is how to print my windows form by clicking on print button??
thank you ... thank you....
ahmad al-omar
|
|
|
|
|
Are you painting the graph on the PictureBox?
If so, where is the painting code executed from?
Try using the form's Paint event in order to redraw the graph on the PictureBox.
Regards,
Shy.
|
|
|
|
|
the graph made by mouse move this is the code below :
Graphics gy = pictureBox4.CreateGraphics();
gy.FillEllipse(new SolidBrush(Color.Blue),i,y_pos[i]+50,3,3);
thank you
ahmad al-omar
|
|
|
|
|
When you paint something on a control you have to repaint it whenever the control repaints itself.
When you minimize the form and restore it, all of the controls on the form are automatically repainted.
However, any painting you made on the controls are not repainted.
Use the PictureBox.Paint event and place your code there in order to repaint the ellipse everytime the PictureBox repaints itself.
Regards,
Shy.
|
|
|
|
|
On top of shyagam's response, anytime you can elimineate the Control.CreateGraphics() call in GDI+, do it. If you are working extensively in GDI+ this is a rule you should embrace. Thus, when you re-Maximized the control from wich the graphis being painted, it will automatically repaint the graph and when a value changes that will affect the graph you can simply call Invalidate() on the control that is painting the graph.
"All of us who served in one war or another know very well that all wars are the glory and the agony of the young."
Gerald Ford
|
|
|
|
|
Hello friends
I want to build a PHP IDE that anyone can write farsi or arabic easily as in frontpage or MS word,
I want o use C# for this,
what is the start point in order to build this IDE?
Which things I must learn?
Any one has idea about this subject?
|
|
|
|
|
I think I would start by really boning up on Regular Expressions (google or CP-search) and other ways to parse text.
On the other side I would focus on getting to know as much as possible about PHP so you can define the boundaries of your project (if any ).
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
hi,
I am creating a editor in Richtextbox control.
and now i want to implement feature Undo and redo ..
I am not getting it.
pls help me
with regards
prasad
|
|
|
|
|
Check out this recent code project article.
Standards are great! Everybody should have one!
|
|
|
|
|
Here are some articles:
http://www.codeproject.com/useritems/useractionbasedundoredo.asp
http://www.codeproject.com/csharp/autoundoredo.asp
and this pattern looks promising too:
http://en.wikipedia.org/wiki/Memento_pattern
Although they will not be easy to implement with a RichTextBox I think.
A simple solution, that comes to my mind would be to save a copy of of the text when a change occurs. Then you can undo by replacing the current one with this copy. You should however limit the number of copies because it will consume a lot of memory when there is a lot of text.
Can you show us what you have thought of, or have tried already? Do you have a specific problem, or just no idea where to start?
I feel like a twat :p I didn't know RichTextbox has Undo/Redo functionality. Post your code, tell us what the problem is.
-- modified at 10:38 Wednesday 21st March, 2007
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
hi,
int ActiveUndoIndex = ActiveWindowStatus();
if (arrScrptDsgnrFrms[ActiveUndoIndex].RchtxtBx.CanUndo == true)
{
arrScrptDsgnrFrms[ActiveUndoIndex].RchtxtBx.Undo();
arrScrptDsgnrFrms[ActiveUndoIndex].RchtxtBx.ClearUndo();
}
this code is undoing the enitre actions not chracter by chracter ...
help me pls
|
|
|
|
|
Before you try to Undo something, you need to check to see whether or not it can be undone. To do this, you need to call CanUndo and only call Undo if it returns true. Similar logic applies to Redo/CanRedo.
Deja View - the feeling that you've seen this post before.
|
|
|
|