|
Could you please be a little more specific. I am a newbie in C#. Please
sasa
|
|
|
|
|
Ok, of the two alternatives you can
- Set the Dock property of the
PictureBox to DockStyle.Fill (or as in the properties window: Dock ). You can then set the BackgroundImage property of the PictureBox to what you want. If you want it centred in the middle of the window then set the BackgroundImageLayout property to ImageLayout.Centre . - Second method is more complex but basically if you handle the Resize event of the MdiForm. Go into the code-window and start typing:
protected override void OnResize...
Then the designer should fill in the rest of the method for you. This method is fired whenever the form is resized so in this you can perform some calculations to resize the PictureBox. E.g. a simple example would be (simulating what happens when Dock is set to Fill):
protected override void OnResize(EventArgs e)
{
pictureBox.Location = new Point(0, 0);
pictureBox.Size = this.Size;
} Hope that helps a bit.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
tabControl1.TabPages.Insert(tabControl1.TabPages.Count, newtabpage);<br />
MessageBox.Show(Convert.ToString(tabControl1.TabPages.IndexOf(newtabpage)));
i use a breakpoint on the first line... and when i do, tabcontrol1.tabpages.count comes up as 5, therefor it should be inserting this new tabpage @ index 5... but the next line shows a messagebox, showing which index the tabpage i JUST added is at, and shows 0.
the visual output of this, is that it creates 2 tabpages one at index 0, or at the front or left side, and one at the back or right.
i don't understand how a single line of code could insert 2 tabpages...
because of the breakpoint and messagebox i don;t think the rest of the function is relevant but i'll post it anyways, because i really just want some help on this.
public void addatab(string title, string url, string tooltip)<br />
{<br />
TabPage newtabpage = blanktabpage;<br />
foreach (WebBrowser i in newtabpage.Controls)<br />
{<br />
i.Name = title;<br />
}<br />
newtabpage.Name = "tab" + title;<br />
newtabpage.Text = title;<br />
newtabpage.Tag = url;<br />
newtabpage.ToolTipText = tooltip;<br />
tabControl1.TabPages.Insert(tabControl1.TabPages.Count, newtabpage);<br />
MessageBox.Show(Convert.ToString(tabControl1.TabPages.IndexOf(newtabpage)));<br />
}
also i tried using .add first, and that produced the same thing... i used .insert so i could blatently point out the conundrum =P
i've had the problem posted on microsofts site... msdn or something like thatm, but didnt get a response for a month... and i posted on my university forum, but the one person who kept helping me out, appears to be taking a break from the forums... so i've finally came here, because i know this place has some notbad tutorials and such, it's gotta have some smart people
also while im waiting i'll look more indepth of what exactly insert and add does for collections, to see if i can get an awnser there.
FFXI ftw
beatmania IIDX ftw
Soccer ftw
|
|
|
|
|
Well the .Add method seems to work fine for me, although the .Insert doesn't but I'm sorry that I don't have more time to investigate at the moment, if anything crops up I'll let you know.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
One thing I notice about your function is this line:
TabPage newtabpage = blanktabpage Where is blanktabpage initialized and created? The question is important because I think your code is not actually creating a new TabPage every time the function is called. The reason for this is that class types are reference types, which means that unless you actually have the new keyword in there, you are not creating another instance of the class in memory. I'm not completely sure I have this down properly (I may have been wrong in my explanation), but have a look at this article by Jon Skeet[^] on the distinction between reference types and value types.
What this means (I think) for your code is that newtabpage refers to an already existing TabPage in memory. Changes that you are making with the variable newtabpage are affecting what blanktabpage points to. I'm not sure that this will necessarily produce the effect you are describing, but it is a problem.
Try this instead: at the beginning of your addatab function, use the new keyword instead, like this:
TabPage newtabpage = new TabPage() Then set the properties of the tab page based on the properties of blanktabpage and see what happens when you call Add or Insert .
I'm fairly sure what I have said in this post is correct concerning reference types, but if I am wrong, I would welcome a correction from anyone who knows better.
Sincerely,
Alexander Wiseman
|
|
|
|
|
thanks for the idea, i tried changing it to new tabpage(); then making the tabpage equal to my blanktabpage, but that didn't solve it. i also read the article, and although it isn't 100% clear to me right now, because of how many times he says value to reference and reference to value =P, i still figure theirs no way my blanktabpage is changing value, because it is initialized in load_form.
...
...
OK IGNORE EVERYTHING I JUST SAID!
i just tried creating a fresh tabpage, and new webbrowser, and setup the webbrowser and added it to the tabpage, then setup the tabpage and added it to the tabcontrol and that worked! no multipuls of tabpages!... i still have no idea how 2 tabpages were added from a single .insert call, but whatever XD
thanks alot for your help alexander
w00t i can finally finish my project!!!
|
|
|
|
|
I'm glad you figured it out!
You said in the first part of your response:
"i tried changing it to new tabpage(); then making the tabpage equal to my blanktabpage"
Setting the tabpage equal to blanktabpage would defeat the purpose, because you are changing what your variable refers to. The main point was to create a wholly new tab page and add that to the tab control. I see that is what you did, which is great.
As far as two tab pages getting added, I have an idea about it. I did not want to mention it in my previous post because I wasn't sure if this was the issue. Here goes:
I was thinking that perhaps you did not actually have two tab pages being added, but rather the first tab page in your control changing to look exactly the same as the other tab page, since you only really have one tab page in memory. Thus, when your function got called, the tab page in memory got changed to look exactly the same as the "new" tab page you were adding. You could verify this by checking how many tab pages total there are before and after the call to your function. If there are two more than before, then I am simply wrong. If there is only one more tab page total, then I think what I said is happening. If you get a chance, could you check it out, I would like to know. This is a really interesting issue!
Sincerely,
Alexander Wiseman
|
|
|
|
|
ya i think that is what was happening too =P
i just couldn't understand why if you made variable b equal to a, why changing b changed a... i could understand if b was a reference to a, that changing a would change b, but i would have never figured it to be the opposite x.x... in any case, i've found .equals() is the perfect solution... cause it allows me to copy the same specification as the tabpage, without changing the original ^^
|
|
|
|
|
Hello!!
I am developing a control that serialize a DataSet and i want to use it in web but i have a problem, i get a System.Security.SecurityException, this is my code:
---------------------------------------------------------------------------------
BinaryFormatter myFormat = new BinaryFormatter();
MemoryStream myStream = new MemoryStream();
myFormat.Serialize(myStream, myDataSet); // here is were i get the exception
---------------------------------------------------------------------------------
I read in the VS documentation that i need to use a SecurityPermissionAttribute, but i don't know how to use this:
[SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
SecurityPermission(SecurityPermissionFlag.SerializationFormatter).Demand();
Somebody knows how can i use this to avoid that exception??
Thanks,
Alberto Martinez
|
|
|
|
|
I would like to take the following 5 lines of code:
Button BUTTONx = new Button();<br />
BUTTONx.Size = new System.Drawing.Size(80, 40);<br />
BUTTONx.Location = new System.Drawing.Point(buttonXPos += 50, buttonYPos += 50);<br />
BUTTONx.Text = buttonName[counter];<br />
Controls.Add(BUTTONx);
And place it inside a loop, however I am unsure how to format the BUTTONx variable so it can contain a unique button name on each iteration ... any advice on how I can achieve the following would be welcome.
while (buttonName[counter] != null)<br />
{<br />
Button BUTTONx = new Button();<br />
BUTTONx.Size = new System.Drawing.Size(80, 40);<br />
BUTTONx.Location = new System.Drawing.Point(buttonXPos += 50, buttonYPos += 50);<br />
BUTTONx.Text = buttonName[counter];<br />
Controls.Add(BUTTONx);<br />
}
This would enable the automatic generation of buttons, which is variable
-- modified at 16:40 Thursday 20th July, 2006
|
|
|
|
|
you can just create an array of Button and access it by the index or the text value.
Ankita
|
|
|
|
|
You can't create class variables dynamically, however...
Controls.Add(BUTTONx);
That puts the new button into the Controls collection so you can retrieve it when you want it.
So each Button a unique name value
BUTTONx.Name = String.Format("DynaButton{0}", counter);
Then look at how you can use the name to get the button from the Controls collection
Controls.Find(...);
|
|
|
|
|
Perfect
Thank you.
|
|
|
|
|
hi all i dont know its right forum to ask this quesion i had made the help files using html workshop. my html help files also shows the screenshots.
but when i compile these help files using html workshop the final help files .chm files do not display the images/screen shots.
Tasleem Arif
|
|
|
|
|
You might need them to be referenced as relative paths, I've never had a problem before using images in the workshop. Just lay it out like a simple website (and always use relative paths where possible) and it should be quite happy.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
i made html files through MS word and save as web page, and made the chm file using html workshop but the chm files do not show the images. u mean give the paths in chm file or simple html files.
Tasleem Arif
|
|
|
|
|
I always hand-code the html documents (be it for a website or a help file) so maybe the best example I can give is this:
<html>
<head>
<title>Hello World</title>
</head>
<body>
<img src="images/helloworld.png" />
</body>
</html> Hope that helps. I don't know how Word references the images.
tasleem143 wrote: u mean give the paths in chm file or simple html files.
I mean that the paths are relative in the html files. All that the project files for HHW do is define the structure of the TOC and Index and Search words. It then references all the files you want to add and simply compiles them. As far as I know it does not do anything more complex than that. An analogy would be it simply zips all the files with a TOC, Index and Search Keyword file which the HtmlHelp Viewer then unzips and parses the TOC, Index and Search files to produce the listings in the Help Window.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
thanks it works
Tasleem Arif
|
|
|
|
|
I built a library in .net using the xml tags for all the methods like this:
///
/// Apply non linear filters.
///
public void A(){} After I marked the option to generate XML Documentation File in the Project Properties. What do I must to do to include the xml documentation in my class library? My goal is to show all my method comments in a client class of another project. I know that exist some tools to generate the chm with all the documentation but I want to show it in design time, in others words, when I'm using the class library in the IDE as a client. Can you give me some hint?
Thanks you very much,
Marcel
|
|
|
|
|
I'm not 100% sure but I think you just need to make sure that the xml file produced is in the same directory as the dll being referenced by the IDE, i.e. VS will probably make a local copy if it's not in the GAC so the xml doc file needs to be in the bin\Release or bin\Debug directory (sorry you'll have to find out by trial & error or just put it in both).
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Thanks you very much. I got it. You only must refering to the dll in design time and will appear the comments. After when you build the solution in the client project VS will generate the xml doc file in the bin\Release or bin\Debug directory. I was doing that but I don't refreshed the reference.
Now I want to change the icon to the dll and I know that I can do it setting in
HKEY_CLASSES_ROOT\dllfile\DefaultIcon but for all the dll. Is it possible for this one?
Thanks a lot,
Marcel
|
|
|
|
|
You should be able to just use the properties page in VS to set the icon of the dll. There is no point in using the registry. Just use the same method as you would for a WinForms application.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Sorry, I don't understood your explanation because I added in properties of project/resources/icon the the .ico and when I build the solution continue the default image in the dll. Can you explain in more detail?
thanks again,
|
|
|
|
|
Double Click Properties in Solution Explorer
Goto Application tab
In the Resources group box select "Icon".
Either:
Select the icon (if already in project)
Add the icon to the project by clicking the ... to the right of the combo box.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
hi i was looking for help in making a simple application for myself to convert my divx avi files to mp4 (ipod format)... i know there are a few free softwares available.. but i wanted to improve my programming skills and as i need such a program for myself currently i would be glad if i am helped in how to go about it in C#.NET FM2 or C++...
if someone has a link for such a tutorial or book. plz help me out.
or if someone can guide me throu this i will be more than glad..
thanks.
|
|
|
|