Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!
I need develop application for Linux. I use IDE MonoDevelop 3.0.2 for it. You can see my GUI definition on next code's:
<?xml version="1.0" encoding="utf-8"?>
<stetic-interface>
  <configuration>
    <images-root-path>..\..\ElectronicPay</images-root-path>
    <target-gtk-version>2.12</target-gtk-version>
  </configuration>
  <import>
    <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
    <widget-library name="../bin/Debug/ElectronicPay.exe" internal="true" />
  </import>
  <widget class="Gtk.Window" id="MainWindow" design-size="400 325">
    <property name="MemberName" />
    <property name="Title" translatable="yes">MyMainWindow</property>
    <property name="TypeHint">Splashscreen</property>
    <property name="WindowPosition">CenterAlways</property>
    <property name="AllowGrow">False</property>
    <signal name="DeleteEvent" handler="OnDeleteEvent" />
    <child>
      <widget class="Gtk.Fixed" id="fixed1">
        <property name="MemberName" />
        <property name="HasWindow">False</property>
        <child>
          <widget class="Gtk.Button" id="button1">
            <property name="MemberName" />
            <property name="CanFocus">True</property>
            <property name="Type">TextAndIcon</property>
            <property name="Label" translatable="yes">GtkButton</property>
            <property name="UseUnderline">True</property>
            <property name="Xalign">1</property>
            <signal name="Clicked" handler="button1_Click" />
          </widget>
        </child>
        <child>
          <widget class="Gtk.Image" id="image1">
            <property name="MemberName" />
          </widget>
          <packing>
            <property name="X">289</property>
            <property name="Y">87</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</stetic-interface>

Now I want to load imagefile "D:\\DeleteIt.JPG" to image1. I made ​​several attempts for this:
C#
private void button1_Click (object sender, System.EventArgs e)
{
//image1.SetAccelPath ("D:\\DeleteIt.JPG", new AccelGroup ());
//image1.Pixbuf = new Gdk.Pixbuf ("D:\\DeleteIt.JPG");
image1.File = "D:\\DeleteIt.JPG";
image1.Show ();
}

But this code is wrong. How can I load imagefile to image1?
Posted
Updated 15-Jan-22 12:03pm

1 solution

image1.File = "D:\\DeleteIt.JPG";
Is incorrect. the File system is different. Linux is a directory based file system whereas Microsoft OSes use a Drive:Directory based filesystem.

This means that you would load the file like this:

image1.File = "/home/user/filename.jpg";
 
Share this answer
 
Comments
Dave Kreskowiak 15-Jan-22 18:16pm    
Cool and all, but a little under 10 years too late.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900