Home > Net >  C # form mobile picture: how to make pictures from top to bottom, from left to right (from the top l
C # form mobile picture: how to make pictures from top to bottom, from left to right (from the top l

Time:10-19

How to make interface in c # of the three images respectively from left to right, from top to bottom, from upper left to lower right circulation mobile

CodePudding user response:

Constant change of the coordinates of the picture?

CodePudding user response:

https://bbs.csdn.net/topics/391833810
Similar this kind of problem?

CodePudding user response:

Modify the left and top coordinates

CodePudding user response:

reference 1st floor hanghangz response:
constantly changes of the coordinates of the picture?

Is the winform, three images can be fixed in a first position first, want to hand in, for help

CodePudding user response:

refer to the third floor is nu month god reply:
modify the left and top coordinates

Can you tell me about it in detail, to made, bosses for help

CodePudding user response:

Move the mouse, it is ok to coordinate with you to specify the coordinates of the
 
Using System;
Using System. Collections. Generic;
Using System. Drawing;
Using System. Windows. Forms;

The namespace Demo_1
{
Public partial class Form1: Form
{
Public class PanelEx: Panel
{
Public PanelEx ()
{
SetStyle (
ControlStyles. AllPaintingInWmPaint |
ControlStyles. OptimizedDoubleBuffer |
ControlStyles. ResizeRedraw |
ControlStyles. SupportsTransparentBackColor |
ControlStyles. UserPaint,
True
);
UpdateStyles ();
}
}

Public abstract class DraggableObject
{
Public abstract string Id {get; set; }
Public abstract int prim_X {get; set; }
Public abstract int prim_Y {get; set; }
Public abstract Rectangle Region {get; set; }
Public abstract Bitmap Setimage {get; set; }
Public abstract void OnPaint (PaintEventArgs e);
}

Public class Draggable: DraggableObject
{
Private string m_Id;
Private int m_primX;
Private int m_primY;
Private Rectangle m_Region;
Private Bitmap m_SetImage;

Public Draggable (string id of a Rectangle regin, Bitmap image)
{
M_Id=id;
M_Region=regin;
M_SetImage=image;
}
Public override string Id {get=& gt; M_Id; The set=& gt; M_Id=value; }
Public override int prim_X {get=& gt; M_primX; The set=& gt; M_primX=value; }
Public override int prim_Y {get=& gt; M_primY; The set=& gt; M_primY=value; }
Public override a Rectangle Region {get=& gt; M_Region; The set=& gt; M_Region=value; }
Public override Bitmap Setimage {get=& gt; M_SetImage; The set=& gt; M_SetImage=value; }
Public override void OnPaint (PaintEventArgs e)
{
Um participant raphics. DrawImage (m_SetImage m_Region);
}
}
Public List DesignObjects=new List (a);

Public PanelEx panelContent;
Public Label info.
Private bool Is_Dragging=false;
Private int index=1, record=1;

Public _click ()
{
InitializeComponent ();

PanelContent=new PanelEx ()
{
The Dock=DockStyle. The Fill,
BackgroundImageLayout=ImageLayout. Stretch,
The BackgroundImage=Image. FromFile (" back. JPG ")
};
PanelContent. Paint +=PanelContent_Paint;
PanelContent. MouseMove +=PanelContent_MouseMove;
PanelContent. MouseDown +=PanelContent_MouseDown;
PanelContent. MouseUp +=PanelContent_MouseUp;
This. Controls. The Add (panelContent);

PanelEx panelTop=new PanelEx ()
{
Height=30,
The Dock=DockStyle. Top
};
This. Controls. The Add (panelTop);

The Button []=new buttons Button [4];
String [] btnText=new string [] {" add elements ", "remove elements", "element forward", "element (one-way"};
for (int i=0; i<4. I++)
{
[I]=new buttons Button ()
{
Size=new Size (70, 25),
Location=new Point (10 + I * 80, 5),
The Font=new Font (" Microsoft elegant black, "9, FontStyle. Regular),
Text=btnText [I],
Tag=I
};
[I] buttons. Click +=Button_Click;
[I] buttons panelTop. Controls. The Add ();
}

Info=new Label ()
{
AutoSize=true,
Location=new Point (350, 5),
The Font=new Font (" Microsoft elegant black, "9, FontStyle. Regular),
};
PanelTop. Controls. The Add (info);
}

Private void PanelContent_Paint (object sender, PaintEventArgs e)
{
Foreach (DraggableObject item in DesignObjects)
{
Item. OnPaint (e);
}
}

Private void Button_Click (object sender, EventArgs e)
{
The Control pL=(Control) sender;

If ((int) pL. Tag==0)
{
OpenFileDialog openImgDialog=new OpenFileDialog ();
OpenImgDialog. Filter="image file (*. PNG; *.jpg. *. GIF. | * *. BMP). PNG; *.jpg. *. GIF. *. BMP ";
OpenImgDialog. RestoreDirectory=true;
OpenImgDialog. FilterIndex=1;
If (openImgDialog ShowDialog ()==DialogResult. OK)
{
Bitmap BMP=Image. FromFile (openImgDialog. FileName) as Bitmap;
Draggable draggableBlock=new Draggable (DateTime. Now. The ToString (), the new Rectangle (50, 50, BMP. Width, BMP, Height), BMP);
DesignObjects. Add (draggableBlock);
Record=DesignObjects. Count - 1;
The info. The Text="current element:" + (record + 1) + "ID:" + DesignObjects [record] ID;
}
}
The else
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related