I just started to use Gtk# today, and I'm astonished how few Documentation and exampleprojects are out there. Anyways I wanted to ask, does anybody know how to add a backgroundimage to a window or a widget?
Or I don't know is it possible to stack multiple widgets over each other beacause, because then it would be quite easy.
Gtk.Window is for the GUI, for background images you need to use Graphics i.e you need to access the underlying GdkWindow . In Gtk# simply use
Gtk.Window mwin = new Gtk.Window();
Gdk.Window gwin = mwin.GdkWindow;
then use Gdk.Pixbuf to set the background image. Here's a link that may be helpful, it is in PHP-GTK, but it shouldn't be too hard to convert to C#.
http://www.kksou.com/php-gtk2/articles/place-a-background-image-in-GtkWindow.php
Related
I am about to write a main menu for a Windows Forms application.
Rather than trying to explain my goal with a wall of text i made a quick(ugly) paint sketch:
As you can see here i want the Group Controls to automatically scale with their content(similar to the wrap_content attribute in android) and fit underneath each other if possible.
If anyone knows how to achieve this or even has a sample where he already did achieve it, that would help me massively!
thanks, Felix.
I'm coding a mobile application using xamarin forms and I want to use cocosSharp. I would like to add a background from a png image to a ccLayer or a ccScene but I found nothing about that. I hope someone has a solution.
Thanks,
Nicolas
You could add the images to a spritesheet and then call it from there. That will give you a better performance too. Please check this tutorial https://developer.xamarin.com/guides/cross-platform/game_development/cocossharp/ccspritesheet/
You could simply create a CCSprite and add it to your layer. Just make sure the ZOrder is lower than other objects on the layer.
var back = new CCSprite("mybackground");
AddChild(back);
I need to set a background image which is transparent and hasn't an opacity of 100%.
It is meant as a "loading screen" when the program starts.
I want it to be transparent and I am using a new form which has border style none.
I am not searching for this solution:
public Form1()
{
this.TransparencyKey = Color.Turquoise;
this.BackColor = Color.Turquoise;
}
because this is just unsatisfactory, because of the less than 100% opacity, that the picture has.
And I neither want to use opacity of the form to solve this, because I am already using it for a kind of "fade in" of the form.
Does anybody know how to do this? Maybe there is a much simpler way to do this, that I don't know?
Sorry for my bad English.
Greetings.
This is similar to this question and You can use link in the solution suggested there. It uses 32-bit PNG image and GDI functions. I haven't downloaded the source code, but in order to implement handling of Win32 calls, You can use pinvoke pages, where You should be able to find information about appropriate functions, for example GetDC, SelectObject or BLENDFUNCTION.
I'm making an application in which I need to print a content of the wpf richtextbox to an image, my application requires extremly fast perfomance, so the solution which uses WinForms RichTextBoxPrintCtrl (my own class with Handle on the control itself) with overlay, works way too slow for me, is there any way i can make a printable(saving as an image, or renderable to Bitmap) wpf richtextobx?
check these links hope help :
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.rendertargetbitmap.aspx
http://www.codeproject.com/Articles/103184/How-to-Render-Bitmap-or-to-Print-a-Visual-in-WPF
http://www.west-wind.com/weblog/posts/2007/Sep/10/Rendering-a-WPF-Container-to-Bitmap
I would like to know how to build an screenmate.
Something like this:
Example # 1:
http://www.youtube.com/watch?v=SHvDOPkGQqE
Example # 2:
http://www.youtube.com/watch?v=5tHpmeZseIs
Example # 3:
http://www.viddler.com/explore/myvirtuallady/videos/5/
I guess that there has to be a way to do it, but I don't know how.
Can this be done using some Microsoft frameworks? Maybe with C#?
To draw the screenmate itself you can use a normal Form that has no border and a TransparencyKey color to make the background transparent. You can then draw the animation by overriding OnPaint().
To get it to react to other windows like in the first video is a bit trickier, and requires some pinvoke into user32.dll. The function FindWindow gets the handles of other windows and GetWindowRect will let you get their position and sizes so you can write some code that makes the screen mate react to them.