Rectangle in pixel, user coordinates in mm, TODO-draw the points correct.




Picture:
http://www1.minpic.de/bild_anzeigen.php?id=77964&key=8973453&ende

Project:
http://www.fileuploadx.de/478056

Hello,

I have a rectangle in pixels.
There I would like to draw a rectangle in mm in correct relation to
the panel.

Question: Transformation pixel in mm, see above.

My problem, understanding problem, how I get that now it?

If rectangle is ok, which define zero point, draw.
If that is ok, the list with points draws.

Finished .

Thanks.

Greeting Andreas



private void panelInput_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
int counter = 1;

Font drawFont = new Font("Arial", 10);
SolidBrush drawBrush = new SolidBrush(Color.Black);

// Pixel vom Panel ermitteln
int pixelLeft = panelInput.Left;
int pixelTop = panelInput.Top;
int pixelRight = panelInput.Right;
int pixelBottom = panelInput.Bottom;

// Außenmaße einholen
Maß abmessungen = produkt.Maße[0];

g.PageUnit = GraphicsUnit.Millimeter;

// Rechteck in das Panel zeichnen
// Create pen.
Pen redPen = new Pen(Color.Red, 20);
g.DrawRectangle(Pens.Red, FactorZollMillimeter * abmessungen.X1,
FactorZollMillimeter * abmessungen.Y1,
FactorZollMillimeter * abmessungen.X2,
FactorZollMillimeter * abmessungen.Y2);


Matrix mHelp = new Matrix();
// Verschiebung ?=
// mHelp.Translate(- 1, 0);

mHelp.Scale(-g.DpiX / FactorZollMillimeter, g.DpiY / FactorZollMillimeter);
g.Transform = mHelp;



foreach (Punkt p in produkt.Punkte)
{
// ** Umrechnung mm in pixel
ZeichneKreuz(g, p, 10);
g.DrawString(counter.ToString(), drawFont, drawBrush, p.X + 3, p.Y + 3);
counter++;
}
}



.



Relevant Pages

  • Re: Drawing Lines On Panels
    ... Panels have no Paint event, ... And Panel cant give Graphics, nothing, except Form, can do that. ... To draw on it, i create Image, draw on it and then insert that image into ... > int, int, int, int)) is currently supported directly through the CF. So if ...
    (microsoft.public.pocketpc.developer)
  • Re: Drawing Lines On Panels
    ... The Panel control does have a Paint event. ... > To draw on it, i create Image, draw on it and then insert that image into ... >> int, int, int, int)) is currently supported directly through the CF. So ...
    (microsoft.public.pocketpc.developer)
  • Re: Drawing Lines On Panels
    ... You need to hook into the Paint event for the Panel. ... private void panel1_Paint ... int, int, int, int)) is currently supported directly through the CF. So if ... > successfully able to draw a line on any component other then the frame ...
    (microsoft.public.pocketpc.developer)
  • Custom Draw LIstCtrl and scrolling
    ... I wrote a custom draw CListCtrl that allow to display different row height on windows mobile ... void CListCtrlCommands::OnSize(UINT nType, int cx, int cy) ... CRect rect; ... GetClientRect(&rect); ...
    (microsoft.public.vc.mfc)
  • Re: Graphics help please
    ... I've got something similar, with a 3D turtle. ... You can also draw a line from to, with the ... final int width = 1024; ... static public void main ...
    (comp.lang.java.programmer)

Loading