|
Is there a way to change the default node class type used by a TreeView control? I would like the TreeView to operate normally, but instead of creating TreeViewNode objects, to create MyTreeViewNode objects. I would like the node to expose an additional attribute.
class MyTreeViewNode: TreeViewNode
{
public string ExtendedProperty
{
get
{
}
}
}
|
|
|
|
|
astibich2 wrote: Is there a way to change the default node class type used by a TreeView control?
If I remember correctly, the answer is NO.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
You'll need to create your own MyTreeView that takes your TreeNode Type in place of the System.Windows.Forms one by creating the new properties and methods you need and hiding the old ones, as well as creating MyTreeNodeCollection etc...
Then you can just use your MyTreeview instead.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hello everyone,
Does anybody know how I would go about creating a tab control that allows you to add a tab, and then add a NEW web browser control to that newely created tabpage, and then be able to perform actions on the webbrowser control in the currently selected tabpage (i.e. GoBack(), GoForward(), Stop(), Navigate..) and I also want to be able to display the title of the website on each tab?
I am having lots of trouble with this, have found zero help on Google, MSDN, and about 5 other search engines i've looked on. Does anybody have any sample code, tutorials, or advice that you could share as I am completely baffled . I'd appreciate any kind of help at all from anybody, thanks in advance.
Regards,
j.t.
|
|
|
|
|
|
Thanks for the reply, though they did not provide useful as they did not demonstrate what I am trying to do. I am using the WebBrowser control not the aX one... And I am doing it a different way too...
|
|
|
|
|
Hmm...
What i would do is:
Once the new tab is clicked, create a panel, then add all the controls you want to it, then add the new web browser control, then attach the finished panel to the new tab panel, and dock it so it fills the tab panel. Then you can use something like this.form.currentpanel.activetab.panel.goback() or something similar. And when the browser control is navigated to a page, simply update the tabs title.
You could then add/delete tabs as needed, each one containing a web browser + associated controls.
Hope that helps...
|
|
|
|
|
Thanks for that! Would you know how to updates the tabs title to show the current website name? As this is one of the mainn problems I've been having and I've tried everything i could possibly think of..
|
|
|
|
|
You could do it when the navigating or navigated event is raised.
To get the page title, try webbrowser1.Document.Title.
e.g.
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
TabPages[currentTab].Text = webBrowser1.Document.Title
}
|
|
|
|
|
You know how some winform controls have a drag handle in the upper left corner, inside the winform designer (eg. the groupbox)? Is there an easy way to make my custom UserControl have the same drag handle button?
Thanks,
Aaron
|
|
|
|
|
I would imagine it's overriding OnPaint, OnMouseEnter and OnMouseLeave - checking the DesignMode Property and if true calling Invalidate() in the last two, checking the same property in OnPaint and drawing accordingly.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi,
I am in need of assistance...again!
I want to create a generic list<t> object that I can use to run my LINQ queries against. The problem is that I want to populate the list using an XML file.
I have only seen tutorials that shows how to create a list<t> and manually put information into it.
Have someone added data from an XML file into a list object before??
Thank you in advance!!
Illegal Operation
|
|
|
|
|
Why not use LinqToXml? You'll find it in the System.Xml.Linq namespace.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
To keep the backstory short i want to create a screen toggle for my laptop.
Now my first version made done using the SendMessage (SC_MONITORPOWER),
This ofcourse worked but turned the screen back on with everything even with low level hooks preventing keystrokes. (and sometimes made my screen flikker on off for a while)
My second idea was to set my VGA out to be the primary monitor (this failed due to nothing being connected) but i switched it around to TV.
Now this also had allot of downsides i could be toggled but during this time it would reset your color quality for a second messing up your taskbar icons and it also resizes to 640x480 for a second moving stuff around.
Now i know of a program called net support which is like a teacher tool to use in a class room which had the ability to turn off client monitors without any of the downsides mentioned.
So anybody have another idea?
Any ideas are welcome but the perfect thing would be something that can turn off my screen be enable by spefic keystrokes and doesn't mess with resolutions or color qualitys..
Thanks!
|
|
|
|
|
Scalee wrote: Now i know of a program called net support which is like a teacher tool to use in a class room which had the ability to turn off client monitors without any of the downsides mentioned.
Is it verified the monitors "go to sleep" or does it just create a full screen black window??
|
|
|
|
|
Full power off, not just a black picture.
(monitor light starts blinking)
|
|
|
|
|
Hi, I'm working on a part of a program where I have a list of file paths and I want to write a method to send each file to the printer. Files in the list would be stuff like .txt and .doc.
I've collected each path in a List<string> docPaths = new List<string>();
and I need to do something like:
foreach (string file in docPaths)
{
}
What would people suggest is the best way to go about this?
Thanks for any help
|
|
|
|
|
Something like this (untried!):
System.Diagnostics.Process printItem = new System.Diagnostics.Process();
printItem.StartInfo.FileName = file;
printItem.StartInfo.UseShellExecute = true;
printItem.StartInfo.Verb = "print";
printItem.Start();
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
|
I'm creating a class derived from System.Windows.Forms.TextBox. I need the Text property to have a default value of "0" and to force a repaint of another property so I've added this:
[DefaultValue("0"),
Category("Appearance"),
RefreshProperties(RefreshProperties.Repaint)]
public new string Text
{
get { return base.Text; }
set { base.Text = value; }
} and added Text = "0"; in the constructor.
The problem is the default value is always "" . If I set Browsable(false) then it acts as I expected. I'd like to be able to have the Text property in the property grid though.
Any ideas?
[edit] Full example code below. [/edit]
using System.ComponentModel;
using System.Windows.Forms;
public class TestTextBox : TextBox
{
public TestTextBox()
{
Text = "0";
}
[DefaultValue("0"),
Browsable(false)]
public new string Text
{
get { return base.Text; }
set { base.Text = value; }
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: public new string Text
Why are you using 'new' when you should be using 'override' ?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
No particular reason except I had forgotten that Control.Text was virtual
It doesn't help any though, even with override I get the same result.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I've figured a workaround.
1. Override OnTextChanged and implement ISupportInitialize
2. Setting / unsetting a bool flag field in BeginInit and EndInit, then testing for that and string.IsNullOrEmpty(Text) in OnTextChanged, and setting the text to "0" if both are true.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
modified on Monday, January 26, 2009 5:35 PM
|
|
|
|
|
hi.
im trying to download html text from 'amazon.com' using this method:
<br />
HttpWebRequest hRequest = (HttpWebRequest)WebRequest.Create(url);<br />
hRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*";<br />
hRequest.ContentType = "application/x-www-form-urlencoded";<br />
hRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; InfoPath.2)";<br />
hRequest.Headers.Add("Accept-Encoding", "gzip, deflate"); <br />
hRequest.Headers.Add("UA-CPU", "x86");<br />
hRequest.Method = "GET";<br />
<br />
HttpWebResponse hResponse = (HttpWebResponse)hRequest.GetResponse();<br />
StreamReader s =new StreamReader(hResponse.GetResponseStream(),Encoding.GetEncoding(hResponse.CharacterSet));<br />
<br />
<br />
string page = s.ReadToEnd();<br />
<br />
i know that amazon uses character set of "iso-8859-1", thats also returned by the httpwebresponse.characterset property.
but for some reason when i examine the string it contains scrambled charecters, so when i want to search that text using all sort of string methods it dosent work.
however if i use the "webclinet" object downloadstring method to retrieve the page it shows up fine, but it also takes him 30 sec to get the string!
i dont know if its like that because of a heavy processing or something else, but its not flexible enough and dosent answer my needs.
anyone have an idea why im getting an invalid string?
|
|
|
|
|
Did you try 'HtmlDecode' the read text?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|