473,888 Members | 1,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pen / Drawing Field

Hi,

I need to create a box / field that the user can draw into (with some
kind of pen). I also need to know how I can edit the size of the pen
style and how I can "transport" the drawn image into a
smaller box (that is only around 10x10 pixel so the original image
must be comprimized onto that 10x10 pixel field..) and how to center
it. ( if you guess that this is about neural networks you're right :)
)

THANKS A LOT for any help.
Nov 15 '05 #1
5 2430
T.F.
You may want to start with this article:

http://msdn.microsoft.com/library/de...ignsurface.asp

Also you may want to look at the Scribble sample included with VS.NET.

Hope this helps
Jay

"T. F." <re*******@gmx. net> wrote in message
news:um******** *************** *********@4ax.c om...
Hi,

I need to create a box / field that the user can draw into (with some
kind of pen). I also need to know how I can edit the size of the pen
style and how I can "transport" the drawn image into a
smaller box (that is only around 10x10 pixel so the original image
must be comprimized onto that 10x10 pixel field..) and how to center
it. ( if you guess that this is about neural networks you're right :)
)

THANKS A LOT for any help.

Nov 15 '05 #2
See the System.Drawing namespace

Look at the System.Drawing. Pen class for the pens that you can set color /
width.
ControlPaint.Dr awReversibleLin e for the drawing

Handle the mousedown, mousemove and mouseup events as needed to draw lines.
There's an article on codeproject that has some good reader comments:
(in vb.net)
http://www.codeproject.com/dotnet/ru...asp#xx414104xx
and a slightly different C# version on the same page
http://www.codeproject.com/dotnet/ru...asp#xx559274xx

Then you'll want to reconstruct the drawn lines onto an image object. I
suggest you keep an arraylist in memory of each line as it is drawn
(possibly a rectangleF struct or some other object of two points). Then
when you want to resize, create a Bitmap object (System.Drawing .Imaging
namespace) and redraw all the lines onto it. Then you can draw this new
image onto the control using Graphics.DrawIm age function (this has plenty of
overloads to assist with reducing size). (see
http://www.bobpowell.net/faqmain.htm for more GDI+ tips)

For more details on drawing directly to a picturebox, check out this
article:
http://www.bobpowell.net/pictureboxhowto.htm

Here are some articles on allowing the user to draw, but this is a bit more
involved than what you need. And it is in vb.net, but it should give you
some ideas
http://msdn.microsoft.com/library/de...ignsurface.asp

Hope all of this helps. Sounds like an interesting project.

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
"T. F." <re*******@gmx. net> wrote in message
news:um******** *************** *********@4ax.c om...
Hi,

I need to create a box / field that the user can draw into (with some
kind of pen). I also need to know how I can edit the size of the pen
style and how I can "transport" the drawn image into a
smaller box (that is only around 10x10 pixel so the original image
must be comprimized onto that 10x10 pixel field..) and how to center
it. ( if you guess that this is about neural networks you're right :)
)

THANKS A LOT for any help.

Nov 15 '05 #3
Thanks a lot, both of you!

The project is interesting but nothing special; it's a pattern
recognition program where a neural network recognizes letters which
the user writes into a box (one of the "standard" examples of neural
networks..).
Nov 15 '05 #4
Oh and btw, i don't need to draw lines, i just need the pen. Is that a
seperate class or do i also need to use
ControlPaint.Dr awReversibleLin e?
Nov 15 '05 #5
Look at docs for these two classes:

System.Drawing. Graphics
System.Drawing. Pen
(yes pen is a separate class)

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
"T. F." <re*******@gmx. net> wrote in message
news:62******** *************** *********@4ax.c om...
Oh and btw, i don't need to draw lines, i just need the pen. Is that a
seperate class or do i also need to use
ControlPaint.Dr awReversibleLin e?

Nov 15 '05 #6

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

Similar topics

4
1386
by: SimonH | last post by:
Hi everyone, If anyone can help me with this I would be really really greatful. I have a custom object that I can't change. Two of the properties (hair colour and eye colour) are of type Drawing.Color Unfortunately I cant change the class implementation to make these properties more friendly.
0
1385
by: Kathy | last post by:
Hi and Thanks for you help! Several years ago I created a Product Specification db that displayed AutoCad 2000 drawings in a report (The Spec Sheet) Recently we upgraded our AutoCad to the 2004 version. Now, we can insert a drawing into a table and if we double click the drawing (an ole object)AutoCad will open and you can edit the drawing with no problem. However if you run a query including the drawing field and doubleclick the colum in...
20
2415
by: Greg | last post by:
I'm fairly new to access (using 2002) and am setting up a DB for work. along with each record the user also needs to make a flow diagram (previously, these reports were composed in word and they used the autoshapes to create this diagram). I was wondering what the best way to incorporate this into the DB. I have read about how saving them as pictures in the DB bloats the size, which is unacceptable, but it needs to be easy to do (not...
2
12350
by: Champika Nirosh | last post by:
Hi, I want to create drawing board application that can draw Line, rectagle, circle and free hand drawing. Each drawing need to be transparent, moveable (draggable), have bring to front and send to back feature etc. How can I do this .. where should I start?
2
13472
by: Josema | last post by:
Hi, I get from database a field of type binary (its a gif image) into byte until here no problem, cause i veryfied that the binary its stored into the byte variable (called arrayb in my application). Im trying show into Internet explorer this byte (arrayb its the name of the variable) this way: 1) MemoryStream imgStream=new MemoryStream(arrayb,0,arrayb.Length, false,
2
234
by: Vishruth Ranjit | last post by:
Would anyone of you could please help me in solving this problem.Please. Public Class Form1 Inherits System.Windows.Forms.Form Dim CN As New ADODB.Connection Dim RS As New ADODB.Recordset
4
3662
by: Darrel | last post by:
I'm grabbing a file from a file upload form field. This is a 'system.web.httppostedfile' I would like to modify the image (Cropping/scaling) using system.drawing.image. Is there anyway to go from 'system.web.httppostedfile' directly to 'system.drawing.image'? Normally, I'd grab the System.Drawing.Image from a file itself:
9
3194
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I want to be able to draw lines in a picturebox based upon certain data points I have received. I dragged a picturebox from the toolbar onto my form, but after having gone through the help files, looking online and trying a variety of things, I...
2
2332
by: ThatsIT.net.au | last post by:
I have this code that writes a pie chart in a asp.net page, but I want to use it in a server control. When I try I get a error on the last line "Response.OutputStream" Obviously there is no response object but how do I write it to screen? Dim objBitmap As New System.Drawing.Bitmap(400, 440) Dim objGraphics As System.Drawing.Graphics objGraphics = System.Drawing.Graphics.FromImage(objBitmap) objGraphics.Clear(Drawing.Color.White)
0
9961
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9800
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10778
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10886
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10439
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9597
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7990
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7148
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
3252
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.