зеркало из https://github.com/mono/mail-archives.git
187 строки
5.1 KiB
HTML
187 строки
5.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Gtk-sharp-list] Gtk.Image
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Gtk.Image&In-Reply-To=">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="010726.html">
|
|
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Gtk-sharp-list] Gtk.Image</H1>
|
|
<B>mono baumm</B>
|
|
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Gtk.Image&In-Reply-To="
|
|
TITLE="[Gtk-sharp-list] Gtk.Image">monobaum at gmx.ch
|
|
</A><BR>
|
|
<I>Tue May 31 09:40:59 EDT 2011</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="010726.html">[Gtk-sharp-list] Centering a ScrolledWindow
|
|
</A></li>
|
|
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#10727">[ date ]</a>
|
|
<a href="thread.html#10727">[ thread ]</a>
|
|
<a href="subject.html#10727">[ subject ]</a>
|
|
<a href="author.html#10727">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>Hello
|
|
|
|
I'm trying to create a screensaver kind of thing which shows in a given area a list of multimedia Files like Movies, Flash, Images etc.
|
|
|
|
I've done this sucessfully with WinFoms but had to change to something Linux Native because of performance issues.
|
|
|
|
Ok. The Problem i'm facing is the same for Flash and for Images and therefore i will only talk about the images.
|
|
|
|
Whats Happening:
|
|
I start the MainWindow, which holds two ImagePlayers ( gtk.Windows with a method to set the picture).
|
|
The Image is set to Player1 and the Player is shown with ShowAll() and i'm starting a timer which changes the Player every few secounds.
|
|
When the Timer elapses i set the Image to Player2, ShowwAll() Player two and Hide Player1 by moving it to nirvane(-1000, -1000).
|
|
The Fist Image shown in such a player shows fine. The images after wont get redrawn and the window remains Grey.
|
|
|
|
Since i don't know anything about Gtk i assume i just handle it wrong and so i hope you can help me to a better understanding.
|
|
I can't explain my self too well so i hope my Code speaks for itsself.
|
|
|
|
public partial class MainWindow : Gtk.Window
|
|
{
|
|
System.Timers.Timer changeMediaTimer;
|
|
|
|
IPlayer f1;
|
|
IPlayer f2;
|
|
|
|
MediaPlayData mpd1;
|
|
MediaPlayData mpd2;
|
|
|
|
bool IsLoading = false;
|
|
|
|
public MainWindow () : base(Gtk.WindowType.Toplevel)
|
|
{
|
|
Build ();
|
|
|
|
this.Move( -1000, -1000);
|
|
|
|
changeMediaTimer = new System.Timers.Timer();
|
|
changeMediaTimer.Interval = 3000;
|
|
changeMediaTimer.Elapsed += new System.Timers.ElapsedEventHandler( changeMediaTimer_Elapsed );
|
|
|
|
f1 = new ImagePlayer( new Rectangle (800, 130, 810, 475), 1);
|
|
f2 = new ImagePlayer( new Rectangle (800, 130, 810, 475), 2);
|
|
|
|
mpd1 = new MediaPlayData();
|
|
mpd1.url = "18617.jpg";
|
|
|
|
mpd2 = new MediaPlayData();
|
|
mpd2.url = "18618.jpg";
|
|
|
|
f1.SetMedia( mpd1 );
|
|
f1.ShowPlayer();
|
|
|
|
changeMediaTimer.Start();
|
|
}
|
|
|
|
private void changeMediaTimer_Elapsed (object sender, EventArgs e)
|
|
{
|
|
if ( IsLoading ) return;
|
|
IsLoading = true;
|
|
|
|
if ( !f1.IsBusy )
|
|
{
|
|
f1.SetMedia( mpd1 );
|
|
f1.ShowPlayer();
|
|
f2.HidePlayer();
|
|
}
|
|
else
|
|
{
|
|
f2.SetMedia( mpd2 );
|
|
f2.ShowPlayer();
|
|
f1.HidePlayer();
|
|
}
|
|
|
|
IsLoading = false;
|
|
}
|
|
|
|
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
|
|
{
|
|
Application.Quit ();
|
|
a.RetVal = true;
|
|
}
|
|
}
|
|
|
|
#
|
|
#
|
|
# Above is the Logic. And know comes the Player
|
|
#
|
|
#
|
|
|
|
public partial class ImagePlayer : PlayerBase, IPlayer
|
|
{
|
|
Gtk.Image img;
|
|
|
|
private ImagePlayer () : base()
|
|
{
|
|
this.Build ();
|
|
}
|
|
|
|
public ImagePlayer ( System.Drawing.Rectangle rect, int i ) : base( rect )
|
|
{
|
|
playerType = MediaPlayData.eType.Image;
|
|
|
|
img = new Gtk.Image();
|
|
this.Add( img );
|
|
}
|
|
|
|
public void SetMedia( MediaPlayData mpd )
|
|
{
|
|
string s = String.Format("/opt/aaa/Data/Medias/{0}", mpd.url);
|
|
|
|
img.Pixbuf = new Gdk.Pixbuf( s );
|
|
}
|
|
|
|
public void ShowPlayer( )
|
|
{
|
|
this.Move(bounds.X, bounds.Y);
|
|
this.Visible = true;
|
|
|
|
ShowAll();
|
|
}
|
|
|
|
public void HidePlayer( )
|
|
{
|
|
this.Move( nirvana.X, nirvana.X );
|
|
this.Visible = false;
|
|
}
|
|
public void Stop( )
|
|
{
|
|
|
|
}
|
|
}
|
|
--
|
|
NEU: FreePhone - kostenlos mobil telefonieren!
|
|
Jetzt informieren: <A HREF="http://www.gmx.net/de/go/freephone">http://www.gmx.net/de/go/freephone</A>
|
|
</PRE>
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="010726.html">[Gtk-sharp-list] Centering a ScrolledWindow
|
|
</A></li>
|
|
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#10727">[ date ]</a>
|
|
<a href="thread.html#10727">[ thread ]</a>
|
|
<a href="subject.html#10727">[ subject ]</a>
|
|
<a href="author.html#10727">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
|
|
mailing list</a><br>
|
|
</body></html>
|