hi,
I put an pictureBox in the form.
In the IDE,I can set an picture into the PictureBox by Property "Image".
but in the code I can't use this way to set an picture into the PictureBox:
PictureBox1.Image= Image.FromFile("a.bmp");

I checked for MSDN and found that in .net cf it doesn't support class member
"FromFile()" in Class "Image"
now I want to know how I should do when I want to use code to set an
picture?
who can help me,please

Re: How can I change PictureBox's Picture in vs.net by Tim

Tim
Sun Apr 18 10:52:26 CDT 2004

Yeah, the static "FromFile" method is not supported in the Image class. You
can load an image using the Bitmap constructor overload that takes a string.

PictureBox1.Image= new Bitmap("a.bmp");

--
Tim Wilson
.Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
"Choice" <yoyochoy@163.com> wrote in message
news:u486RdVJEHA.2244@tk2msftngp13.phx.gbl...
> hi,
> I put an pictureBox in the form.
> In the IDE,I can set an picture into the PictureBox by Property "Image".
> but in the code I can't use this way to set an picture into the
PictureBox:
> PictureBox1.Image= Image.FromFile("a.bmp");
>
> I checked for MSDN and found that in .net cf it doesn't support class
member
> "FromFile()" in Class "Image"
> now I want to know how I should do when I want to use code to set an
> picture?
> who can help me,please
>
>



Re: How can I change PictureBox's Picture in vs.net by Choice

Choice
Sun Apr 18 12:05:49 CDT 2004

Thank you very much.
And now there is another problem: how could the PictureBox support jpg or
gif format?



"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> дÈëÏûÏ¢ÐÂÎÅ
:OLoOS0VJEHA.556@tk2msftngp13.phx.gbl...
> Yeah, the static "FromFile" method is not supported in the Image class.
You
> can load an image using the Bitmap constructor overload that takes a
string.
>
> PictureBox1.Image= new Bitmap("a.bmp");
>
> --
> Tim Wilson
> .Net Compact Framework MVP
> {cf147fdf-893d-4a88-b258-22f68a3dbc6a}
> "Choice" <yoyochoy@163.com> wrote in message
> news:u486RdVJEHA.2244@tk2msftngp13.phx.gbl...
> > hi,
> > I put an pictureBox in the form.
> > In the IDE,I can set an picture into the PictureBox by Property "Image".
> > but in the code I can't use this way to set an picture into the
> PictureBox:
> > PictureBox1.Image= Image.FromFile("a.bmp");
> >
> > I checked for MSDN and found that in .net cf it doesn't support class
> member
> > "FromFile()" in Class "Image"
> > now I want to know how I should do when I want to use code to set an
> > picture?
> > who can help me,please
> >
> >
>
>



Re: How can I change PictureBox's Picture in vs.net by Tim

Tim
Sun Apr 18 12:47:56 CDT 2004

Just load a jpg or gif file in the same way. The Bitmap class can be used to
load image formats other than bmp's.

PictureBox1.Image= new Bitmap("a.gif");

--
Tim Wilson
.Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
"Choice" <yoyochoy@163.com> wrote in message
news:uoeQSdWJEHA.556@tk2msftngp13.phx.gbl...
> Thank you very much.
> And now there is another problem: how could the PictureBox support jpg or
> gif format?
>
>
>
> "Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> дÈëÏûÏ¢ÐÂÎÅ
> :OLoOS0VJEHA.556@tk2msftngp13.phx.gbl...
> > Yeah, the static "FromFile" method is not supported in the Image class.
> You
> > can load an image using the Bitmap constructor overload that takes a
> string.
> >
> > PictureBox1.Image= new Bitmap("a.bmp");
> >
> > --
> > Tim Wilson
> > .Net Compact Framework MVP
> > {cf147fdf-893d-4a88-b258-22f68a3dbc6a}
> > "Choice" <yoyochoy@163.com> wrote in message
> > news:u486RdVJEHA.2244@tk2msftngp13.phx.gbl...
> > > hi,
> > > I put an pictureBox in the form.
> > > In the IDE,I can set an picture into the PictureBox by Property
"Image".
> > > but in the code I can't use this way to set an picture into the
> > PictureBox:
> > > PictureBox1.Image= Image.FromFile("a.bmp");
> > >
> > > I checked for MSDN and found that in .net cf it doesn't support class
> > member
> > > "FromFile()" in Class "Image"
> > > now I want to know how I should do when I want to use code to set an
> > > picture?
> > > who can help me,please
> > >
> > >
> >
> >
>
>



Re: How can I change PictureBox's Picture in vs.net by Choice

Choice
Sun Apr 18 13:28:39 CDT 2004

oh~~
I just make a mistake.
I have used:
Bitmap img=new Bitmap(System.IO.Directory.GetCurrentDirectory()+"2.gif");

it said "NotSupport" means not support
"System.IO.Directory.GetCurrentDirectory()"

by the way ,how can I get Current Directory, I have tried all of below ,but
it doesn't work:
Environment.CurrentDirectory
System.IO.Directory.GetCurrentDirectory()
AppDomain.CurrentDomain.BaseDirectory
Application.StartupPath
Application.ExecutablePath
Environment.CurrentDirectory
Application.ExecutablePath


"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> дÈëÏûÏ¢ÐÂÎÅ
:#qIux0WJEHA.3184@TK2MSFTNGP10.phx.gbl...
> Just load a jpg or gif file in the same way. The Bitmap class can be used
to
> load image formats other than bmp's.
>
> PictureBox1.Image= new Bitmap("a.gif");
>
> --
> Tim Wilson
> .Net Compact Framework MVP
> {cf147fdf-893d-4a88-b258-22f68a3dbc6a}
> "Choice" <yoyochoy@163.com> wrote in message
> news:uoeQSdWJEHA.556@tk2msftngp13.phx.gbl...
> > Thank you very much.
> > And now there is another problem: how could the PictureBox support jpg
or
> > gif format?
> >
> >
> >
> > "Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> дÈëÏûÏ¢ÐÂÎÅ
> > :OLoOS0VJEHA.556@tk2msftngp13.phx.gbl...
> > > Yeah, the static "FromFile" method is not supported in the Image
class.
> > You
> > > can load an image using the Bitmap constructor overload that takes a
> > string.
> > >
> > > PictureBox1.Image= new Bitmap("a.bmp");
> > >
> > > --
> > > Tim Wilson
> > > .Net Compact Framework MVP
> > > {cf147fdf-893d-4a88-b258-22f68a3dbc6a}
> > > "Choice" <yoyochoy@163.com> wrote in message
> > > news:u486RdVJEHA.2244@tk2msftngp13.phx.gbl...
> > > > hi,
> > > > I put an pictureBox in the form.
> > > > In the IDE,I can set an picture into the PictureBox by Property
> "Image".
> > > > but in the code I can't use this way to set an picture into the
> > > PictureBox:
> > > > PictureBox1.Image= Image.FromFile("a.bmp");
> > > >
> > > > I checked for MSDN and found that in .net cf it doesn't support
class
> > > member
> > > > "FromFile()" in Class "Image"
> > > > now I want to know how I should do when I want to use code to set an
> > > > picture?
> > > > who can help me,please
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: How can I change PictureBox's Picture in vs.net by Tim

Tim
Sun Apr 18 13:34:37 CDT 2004

See the FAQ for how to accomplish this:
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/faq/default.aspx#7.1

--
Tim Wilson
.Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
"Choice" <yoyochoy@163.com> wrote in message
news:%23QzmULXJEHA.3848@TK2MSFTNGP09.phx.gbl...
> oh~~
> I just make a mistake.
> I have used:
> Bitmap img=new Bitmap(System.IO.Directory.GetCurrentDirectory()+"2.gif");
>
> it said "NotSupport" means not support
> "System.IO.Directory.GetCurrentDirectory()"
>
> by the way ,how can I get Current Directory, I have tried all of below
,but
> it doesn't work:
> Environment.CurrentDirectory
> System.IO.Directory.GetCurrentDirectory()
> AppDomain.CurrentDomain.BaseDirectory
> Application.StartupPath
> Application.ExecutablePath
> Environment.CurrentDirectory
> Application.ExecutablePath
>
>
> "Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> дÈëÏûÏ¢ÐÂÎÅ
> :#qIux0WJEHA.3184@TK2MSFTNGP10.phx.gbl...
> > Just load a jpg or gif file in the same way. The Bitmap class can be
used
> to
> > load image formats other than bmp's.
> >
> > PictureBox1.Image= new Bitmap("a.gif");
> >
> > --
> > Tim Wilson
> > .Net Compact Framework MVP
> > {cf147fdf-893d-4a88-b258-22f68a3dbc6a}
> > "Choice" <yoyochoy@163.com> wrote in message
> > news:uoeQSdWJEHA.556@tk2msftngp13.phx.gbl...
> > > Thank you very much.
> > > And now there is another problem: how could the PictureBox support jpg
> or
> > > gif format?
> > >
> > >
> > >
> > > "Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> дÈëÏûÏ¢ÐÂÎÅ
> > > :OLoOS0VJEHA.556@tk2msftngp13.phx.gbl...
> > > > Yeah, the static "FromFile" method is not supported in the Image
> class.
> > > You
> > > > can load an image using the Bitmap constructor overload that takes a
> > > string.
> > > >
> > > > PictureBox1.Image= new Bitmap("a.bmp");
> > > >
> > > > --
> > > > Tim Wilson
> > > > .Net Compact Framework MVP
> > > > {cf147fdf-893d-4a88-b258-22f68a3dbc6a}
> > > > "Choice" <yoyochoy@163.com> wrote in message
> > > > news:u486RdVJEHA.2244@tk2msftngp13.phx.gbl...
> > > > > hi,
> > > > > I put an pictureBox in the form.
> > > > > In the IDE,I can set an picture into the PictureBox by Property
> > "Image".
> > > > > but in the code I can't use this way to set an picture into the
> > > > PictureBox:
> > > > > PictureBox1.Image= Image.FromFile("a.bmp");
> > > > >
> > > > > I checked for MSDN and found that in .net cf it doesn't support
> class
> > > > member
> > > > > "FromFile()" in Class "Image"
> > > > > now I want to know how I should do when I want to use code to set
an
> > > > > picture?
> > > > > who can help me,please
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>