View previous topic :: View next topic |
Author |
Message |
peter
Joined: 05 Jun 2007 Posts: 7 Location: Germany
|
Posted: Tue Jun 05, 2007 8:58 am Post subject: Using PictureBox with STRETCH_IMAGE Mode |
|
|
Hi,
I am quite new to the D-Language, so please apologize if this question is silly.
I tried to change the pictureviewer example from the dfl package to be able to stretch or shrink an image.
Therefor I modified the source the following way .
private import dfl.all;
class PictureForm: Form
{
PictureBox pic;
this()
{
startPosition = FormStartPosition.WINDOWS_DEFAULT_BOUNDS;
text = "DFL Picture Viewer";
backColor = SystemColors.appWorkspace;
with(pic = new PictureBox)
{
// sizeMode = PictureBoxSizeMode.AUTO_SIZE;
sizeMode = PictureBoxSizeMode.STRETCH_IMAGE;
parent = this;
}
It compiles without errors, but is no longer able to load any image.
What do I do wrong ?
What I would like to do in my application is to load and show an image and
then give the user the possibility to zoom and to scroll this image.
Thanx for any help.
As a C, VB and Java Programmer, I was searching for a language
being fast (Compiler), with OOP and RAD and I think D is an excellent choice. _________________
|
|
Back to top |
|
|
cracki
Joined: 07 May 2007 Posts: 10 Location: Germany
|
Posted: Tue Jun 05, 2007 9:39 am Post subject: |
|
|
you need to set the docking of `pic` to FILL
see there for more
http://wiki.dprogramming.com/DflDoc/HomePage
please don't use classes just because you can.
there is no reason why you need a new class for a form that happens to have a picturebox on it. _________________ ...meh... |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Tue Jun 05, 2007 12:41 pm Post subject: |
|
|
cracki, I do recommend deriving from Form. It's just easier when you decide to add event handlers, you automatically have a place to put them. |
|
Back to top |
|
|
peter
Joined: 05 Jun 2007 Posts: 7 Location: Germany
|
Posted: Tue Jun 05, 2007 3:05 pm Post subject: Using PictureBox with STRETCH_IMAGE Mode - working |
|
|
Hi cracki,
thanx for the help
with DockStyle FILL it works.
with(pic = new PictureBox)
{
sizeMode = PictureBoxSizeMode.STRETCH_IMAGE;
dock = DockStyle.FILL;
parent = this;
}
I have read the picturebox entry and more at http://wiki.dprogramming.com/DflDoc
but for a newbie it is quite hard.
However, is there any more documentation about DFL ? _________________
|
|
Back to top |
|
|
|