|
-
Sep 5th, 2006, 02:49 AM
#1
Thread Starter
Member
[RESOLVED] scrolling marquee - clickable links
Hi,
I want to import articles links/titles from an xml feed and display this using a scrolling marquee. I want the text in the marquee to be clickable so that when the item is clicked it opens up a browser window and displays the related article.
Is there anyway to do this and can anyone help me complete this task?
Many Thanks!
Al
-
Sep 5th, 2006, 06:37 AM
#2
Re: scrolling marquee - clickable links
First of all... Welcome to the Forums
It's not hard to do...
show us what you have so far and what problems do you face and we'll try to help you
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 5th, 2006, 01:43 PM
#3
Thread Starter
Member
Re: scrolling marquee - clickable links
Hi ComputerJy,
So far I have my winform that can be positioned either at the top or bottom of the available screen and the option to manage feeds. That is as far as I have got at the moment. I have examples and I am sure I can load the xml into my application but I am having difficulty finding any articles or solutions on how to create the scrolling marquee on my winform where the text is clickable (like a hyperlink) that opens up a url.
Can you please help me to create the marquee element to display my data or do you have any examples/articles on how this can be done?
Many Thanks,
Al
-
Sep 5th, 2006, 01:54 PM
#4
Re: scrolling marquee - clickable links
Hyperlinks can be "LinkLabel" controls, you'll need a "Timer" to move them on TimerTick
If you don't know how to use those controls go to MSDN and look there, you'll find great stuff
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 5th, 2006, 02:15 PM
#5
Thread Starter
Member
Re: scrolling marquee - clickable links
Thanks - I'll get looking at the LinkLabel straight away.
Do you have any idea - why this doesn't seem to assign the temp point to 720 (in my case)?
Code:
int total = 0;
int AppHeight = 25;
int AvlScreenHeight = (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height);
total = AvlScreenHeight-=AppHeight;
this.Height = AppHeight;
this.Width = (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width); // 100% width
Point tempPoint = new Point(0,total);
this.DesktopLocation = tempPoint;
this.TopMost = true;
-
Sep 5th, 2006, 02:24 PM
#6
Re: scrolling marquee - clickable links
Replace "WorkingArea" with "Bounds" in the 2nd line
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 6th, 2006, 06:40 AM
#7
Re: scrolling marquee - clickable links
By far the easiest way to achieve this is to use a WebBrowser control, you manually stuff it with the HTML code to give you a linked marquee. Then you just handle the navigation events of the control.
Don't bother using timers or linklabels. The Webbrowser woul dmake a much better job of it and it would look authentic too.
I don't live here any more.
-
Sep 6th, 2006, 07:18 AM
#8
Thread Starter
Member
Re: scrolling marquee - clickable links
 Originally Posted by wossname
By far the easiest way to achieve this is to use a WebBrowser control, you manually stuff it with the HTML code to give you a linked marquee. Then you just handle the navigation events of the control.
Don't bother using timers or linklabels. The Webbrowser woul dmake a much better job of it and it would look authentic too.
Do you have any examples of displaying xml in a html page via c#? Would this approach require greater resources than the linklabel approach?
Thanks for your input wossname.
Al
-
Sep 6th, 2006, 12:10 PM
#9
Re: scrolling marquee - clickable links
Code:
myWebbrowser.DocumentText = "<?xml...blah blah...?><html>....marquee code goes here...</html>";
If you stick a marquee in there it should work like normal.
No witchcraft involved.
I don't live here any more.
-
Sep 17th, 2006, 06:48 AM
#10
Thread Starter
Member
Re: scrolling marquee - clickable links
Hi ComputerJy,
After playing with the WebBrowser suggestion I think the linklabel/timer is the way i'd like to do it.
I need to be able to use a linklabel.LinkCollection so I can load in multiple links (from an XML feed). I don't know how to get a linklabel text to move left upon a timer_tick. Would you or anyone else be able to demostrate how this can be done? I have hunted high and low for a working solution but I can't find one.
Many Thanks,
Al
-
Sep 17th, 2006, 07:22 AM
#11
Re: scrolling marquee - clickable links
You don't move text within a label. You'd have to remove the leading characters from the text to get the others to move left. The way to do it would be to put the label in a Panel and then on the Tick of the Timer decrement its Left property to move it left. Once it has moved all the way to the left, i.e. its Right property is zero or less, then you move it al the way back to the right to start again, i.e. set its Left property to the Width of the Panel. Relatively elementary stuf. Give it a go and see what you can come up with.
-
Sep 21st, 2006, 03:09 PM
#12
Thread Starter
Member
Re: scrolling marquee - clickable links
jmcilhinney - Upon a timer_tick how can I remove a pixel from the left of the panel and then add one to the right of the panel?
I have tried this but this doesn't work
Code:
private void timer1_Tick(object sender, EventArgs e)
{
linkLabel1.Left = -5;
//linkLabel1.Right = +5;
}
The linkLabel1.Left just moves the entire linkLabel1 to the left on the first tick. After that nothing happens. The code for the right handside is commented out as this throws an error up compiling.
Am I going in the correct direction with this? and could anyone give me a hand to move the linklabel upon the timer_tick?
Thanks for your time,
Al
-
Sep 21st, 2006, 03:23 PM
#13
Re: scrolling marquee - clickable links
I don't live here any more.
-
Sep 21st, 2006, 03:51 PM
#14
Thread Starter
Member
Re: scrolling marquee - clickable links
cool - I wasn't so far off!
Now I have changed it to this:
Code:
private void timer1_Tick(object sender, EventArgs e)
{
if (linkLabel1.Right <= 0)
{
linkLabel1.Left = 500;
}
else
{
linkLabel1.Left += -5;
}
}
which enables the scrolling but is using an if statement is the best solution for this?
Last edited by Muller2; Sep 21st, 2006 at 04:01 PM.
-
Sep 21st, 2006, 05:41 PM
#15
Re: scrolling marquee - clickable links
Code:
linkLabel1.Left += -5;

Code:
linkLabel1.Left -= 5;
-
Sep 21st, 2006, 06:25 PM
#16
Re: scrolling marquee - clickable links
 Originally Posted by Muller2
Code:
private void timer1_Tick(object sender, EventArgs e)
{
if (linkLabel1.Right <= 0)
{
linkLabel1.Left = 500;
}
else
{
linkLabel1.Left -= 5;
}
}
which enables the scrolling but is using an if statement is the best solution for this?
I have fixed the code above, as jmc pointed out 
Also, there really isn't a better way than an if conditional. The only other way would be a switch...but its pointless for something so small:
PHP Code:
switch (linkLabel1.Right)
{
case -1:
linkLabel1.Left = 500;
break;
default:
linkLabel1.Left -= 5;
break;
}
...
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Sep 21st, 2006, 06:48 PM
#17
Re: scrolling marquee - clickable links
Code:
linkLabel1.Left = (linkLabel1.Right <= 0 ? linkLabel1.Parent.Width : linkLabel1.Left - 5);
Not necessarily better but another way.
-
Sep 21st, 2006, 06:50 PM
#18
Re: scrolling marquee - clickable links
Been awake for almost 19 hours now, brain is kinda dead 
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|