473,382 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Clearing selection in InkPicture

Hello everybody,
I have a simple form where I have added an 'inkpicture' and 2 buttons. One
of them changes the inkpicture.editing mode to 'select' and the other one
does the same with 'ink' mode. The problem is that when i select a stroke in
'select mode' and then change the inkpicture mode to 'ink', the selected
stroke remains white as when selected. I would like to obtain the same result
as when doing left mouse click in the inkpicture while in 'select mode', this
means, clear the selection and redraw. I would like to do this without
setting the 'autoredraw' property to false and overloading the paint method.

Anybody could help?
Thx
Feb 6 '06 #1
1 2455
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.Ink;

namespace DumbPictureBox
{
public class Form1 : System.Windows.Forms.Form
{
private Microsoft.Ink.InkPicture myInkPicture;
private System.Windows.Forms.Button button_toInk;
private System.Windows.Forms.Button button_toSelect;
private System.ComponentModel.Container components = null;
Graphics g;
public Form1()
{
InitializeComponent();
g=myInkPicture.CreateGraphics();
myInkPicture.DefaultDrawingAttributes.Color=Color. Black;
myInkPicture.DefaultDrawingAttributes.Width=10;
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Código generado por el Diseñador de Windows Forms

private void InitializeComponent()
{
this.myInkPicture = new Microsoft.Ink.InkPicture();
this.button_toInk = new System.Windows.Forms.Button();
this.button_toSelect = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// myInkPicture
//
this.myInkPicture.BackColor =
System.Drawing.SystemColors.ControlLightLight;
this.myInkPicture.Location = new System.Drawing.Point(16, 80);
this.myInkPicture.MarginX = -2147483648;
this.myInkPicture.MarginY = -2147483648;
this.myInkPicture.Name = "myInkPicture";
this.myInkPicture.Size = new System.Drawing.Size(256, 160);
this.myInkPicture.TabIndex = 0;
this.myInkPicture.Paint += new
System.Windows.Forms.PaintEventHandler(this.myInkP icture_Paint);
//
// button_toInk
//
this.button_toInk.Location = new System.Drawing.Point(32, 32);
this.button_toInk.Name = "button_toInk";
this.button_toInk.TabIndex = 1;
this.button_toInk.Text = "To Ink";
this.button_toInk.Click += new System.EventHandler(this.button1_Click);
//
// button_toSelect
//
this.button_toSelect.Location = new System.Drawing.Point(128, 32);
this.button_toSelect.Name = "button_toSelect";
this.button_toSelect.TabIndex = 2;
this.button_toSelect.Text = "To Select";
this.button_toSelect.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button_toSelect);
this.Controls.Add(this.button_toInk);
this.Controls.Add(this.myInkPicture);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
myInkPicture.EditingMode=InkOverlayEditingMode.Ink ;

}
private void button2_Click(object sender, System.EventArgs e)
{
myInkPicture.EditingMode=InkOverlayEditingMode.Sel ect;
}

private void myInkPicture_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
}
}
}
Thx

Feb 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Cy | last post by:
I have a script that uses the DOM to draw to the page depending on a selection by the user. Problem is that if they hit the selection again it draws the info again creating more than one instance...
2
by: Rams | last post by:
Hi All, iam writting an application which has inkpicture as white board for writting purpose and audio to capture voice. iam saving ink annotations along with its audio time stamp in xml file....
0
by: Rams | last post by:
hi iam writting application where rendering point by point on inkpicture captured by newpackets event in another application. i have two problems here. if i use inkpicture.creategraphics () ink is...
0
by: hafrkamp | last post by:
I have programmed an Access 2007 database and I have what I thought was a relatively easy feature to add but I cannot figure it out. I have an InkPicture on a Access Form that I need to save to a...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.