How can I load a picture in a background of the inkzoom so when I use the ink to circle an area to zoom the background picture will zoom too.
Thanks,
CC.
one possible approach is to use an InkPicture control as outlined below:
- assign the picture to InkPicture's Image property
- set SizeMode=StrectchImage
- host the InkPicture in a Panel control to show the desired subset of the
picture
- to zoom now call Scale on the InkPicture and its Renderer with the same
scale factor and adjust its location in the panel
See some C# sample code below.
Thanks,
Stefan Wick
using System;
using System.Drawing.Drawing2D;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Ink;
public class Form1 : Form
{
private Panel panel1;
private Button button1;
private Button button2;
private InkPicture inkPicture1;
public Form1()
{
ClientSize = new Size(400, 350);
panel1 = new Panel();
panel1.Location = new Point(0, 0);
panel1.Size = new Size(400, 300);
panel1.Parent = this;
inkPicture1 = new InkPicture();
inkPicture1.Image = Image.FromFile(@"c:\test.jpg");
inkPicture1.Size = inkPicture1.Image.Size;
inkPicture1.SizeMode = PictureBoxSizeMode.StretchImage;
inkPicture1.Location = new Point((panel1.Width-inkPicture1.Width)/2,
(panel1.Height-inkPicture1.Height)/2);
inkPicture1.Parent = panel1;
button1 = new Button();
button1.Location = new Point(200, 312);
button1.Text = "Zoom In";
button1.Click += new System.EventHandler(button1_Click);
button1.Parent = this;
button2 = new Button();
button2.Location = new Point(288, 312);
button2.Text = "Zoom Out";
button2.Click += new System.EventHandler(button2_Click);
button2.Parent = this;
}
private void button2_Click(object sender, System.EventArgs e)
{
inkPicture1.Renderer.Scale(0.98F, 0.98F);
inkPicture1.Scale(0.98F);
inkPicture1.Location = new Point((panel1.Width-inkPicture1.Width)/2,
(panel1.Height-inkPicture1.Height)/2);
}
private void button1_Click(object sender, System.EventArgs e)
{
inkPicture1.Renderer.Scale(1.02F, 1.02F);
inkPicture1.Scale(1.02F);
inkPicture1.Location = new Point((panel1.Width-inkPicture1.Width)/2,
(panel1.Height-inkPicture1.Height)/2);
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"charliechau" <anon...@discussions.microsoft.com> schrieb im Newsbeitrag
news:D2F68C06-5CBF-49F4...@microsoft.com...