|
|
Hello
Well this right click issue is not a major draw back in WinForms -I think-. Yet you can still do it in C#.
Handle the Click event in your menu, and call a method to do the job from there. Then handle the MouseUp event in your MenuItem, check if(e.Button == MouseButtons.Right), and call the same method.
Regards
|
|
|
|
|
I finished a web site using Visual Studio 2005 ( ASP.NET ) and C# language.
In the Visual Studio internal server, it works perfectly, however after transferring the “SI” folder ( that contains the web site pages ) inside the “C:\inetpub\wwwroot”, and I typed its URL address in the browser, http://pegasus/SI/default.aspx, I get this error message:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Server Error in '/SI' Application.
--------------------------------------------------------------------------------
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred loading a configuration file: Failed to start monitoring changes to 'c:\inetpub\wwwroot\web.config' because access is denied.
Source Error:
[No relevant source lines]
Source File: c:\inetpub\wwwroot\web.config Line: 0
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The strange thing is that there is no "web.config" file inside "wwwroot" folder.
How can I fix this problem and make the web site run inside IIS ?
( My OS is Windows XP )
|
|
|
|
|
Hy,
Try creating a virtual folder in IIS and then copy the site in that folder.The folder is located in wwwroot
Do your best to be the best
|
|
|
|
|
Hi
I already have done it but I continue receiving the same error message.
|
|
|
|
|
Hi guys,
I have a picture box with a picture on an mdi form but the problem I am facing is to always having the picture box centered on the mdi form. If the mdi form is maximized than it automatically centers the picturebox and if the mdi form size is reduced than it automatically centers in reference to the mdi form.
Please help!!
sasa
|
|
|
|
|
If you want the picturebox always centred then (if you're only displaying a picture) then you can set the PictureDisplay (or some property along the same lines) to Centre which means the picture will always be displayed in the centre, then dock the PictureBox to Fill and voila.
Other options include handling / overriding the Resize event and using your own code to reposition the picture box as you want.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
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
|
|
|
|
|