Im kind of new to vb.net drawing routines. Im reading a collection of 2d
points from a
proprietary file. These points are simply for drawing lines, I can draw the
lines fine using Graphics.DrawLi ne, but I need to scale all the lines to fit
a rectangle of a given width and height.
What is the best method to do something like this? Its also important that
the drawing retain proportion within the given rectangle.
Thanks
Craig 1 1177
Have you tried percentages?
I placed a picture box on a form. Named it picturebox1
and used this code
Private Sub PictureBox1_Pai nt(ByVal sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles PictureBox1.Pai nt
'Draw rectangle
Dim Rec As New Rectangle(0, 0, e.Graphics.Clip Bounds.Width,
e.Graphics.Clip Bounds.Height)
e.Graphics.Draw Rectangle(Pens. Green, Rec)
'Draw 2 lines
Dim p1 As New PointF(Rec.Widt h * 0.01, Rec.Height * 0.1) '1% of width,
10% of height
Dim p2 As New PointF(Rec.Widt h * 0.8, Rec.Height * 0.9) '80% of width,
90% of height
'Wrote out the ponts.
Console.WriteLi ne(Rec.ToString & " " & p1.ToString)
Console.WriteLi ne(rec.ToString & " " & p2.ToString)
'Draw line to box
e.Graphics.Draw Line(Pens.Blue, p1, p2)
End Sub
Private Sub Form1_Resize(By Val sender As Object, ByVal e As
System.EventArg s) Handles Me.Resize
'Code used to redraw.
Me.PictureBox1. Invalidate()
End Sub
Does this help?
Good luck!
--
Thiele Enterprises - The Power Is In Your Hands Now!
--
"Craig Lucas" <cr********@tds .netwrote in message
news:dw******** *********@newsr eading01.news.t ds.net...
Im kind of new to vb.net drawing routines. Im reading a collection of 2d
points from a
proprietary file. These points are simply for drawing lines, I can draw the
lines fine using Graphics.DrawLi ne, but I need to scale all the lines to fit
a rectangle of a given width and height.
What is the best method to do something like this? Its also important that
the drawing retain proportion within the given rectangle.
Thanks
Craig This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rich |
last post by:
I am trying to determine the best way to code a page with auto scaling
left/right margins as well as an auto scaling footer. Here is a basic
diagram of what I am hoping to achieve:
http://www.unionarts.com/layouttest.gif. Note the page content will be
in the center section and the lines should extend to the edge of the
browser window.
Any ideas? Would it be best to use a basic table structure or can this
be achived using divs?
|
by: Tomomichi Amano |
last post by:
Hello
How can I delete (clear) lines that were made useing Graphics.DrawLine() ?
Thanks in advance! Have a nice day!
|
by: Larry Serflaten |
last post by:
I am taking a 256 color bitmap from a file
and scaling it up X 16 to a 32bppPARGB bitmap
in memory. I copy that image to the screen.
After scaling, the edges of all the lines and
colors are blurred. I want the edges all
crisp, including inherent pixelation (jaggies).
Setting smoothing to none, or adjusting the
composting mode on the Graphics object still
|
by: MLH |
last post by:
I use A97 and do not always insert line numbers while
writing procedures. I find it necessary to go back and
add them later to aid in debugging.
Nearly 3 years ago, something was mentioned in this NG
to the effect that "...when you access a module programatically,
there is a lines collection..."
Have any of you experimented with your own procedures to
aid in numbering lines? Would the lines collection be of some
|
by: lovecreatesbeauty |
last post by:
For example, line L1 and line L2 are two lines in two-dimensional
space, the start-points and end-points can be described with following
the `point_t' type. The start-points and end-points are: Line L1
(L1_str, L1_end), L2 (L2_str, L2_end).
Can I compare the float value of sloping rate of two lines to determine
whether they are parallel lines? Some paper books tell that float value
can not be compared to float value. Some people also try...
| |
by: David Longnecker |
last post by:
I'm working to create a base framework for our organization for web and client-side
applications. The framework interfaces with several of our systems and provides
the business and data layer connectivity for basic operations and such.
I've ran into a snag that I just can't think myself out of.
Here's an example:
I have an object for a Student called StudentRecord. It has properties such
as name, grade, identification number, etc.
|
by: Pavan |
last post by:
Hi, I want to know if there is any software for measuring lines of
code of my c++ application.
I found out a tool, sloccount, but it gives only physical lines of
code.
I found out one more tool cccc , but iam getting many parse errors
with it.
If you know any other tool( to be used in linux) please let me know.
|
by: sagar |
last post by:
Hello Friends,
I am working on a web application in which I have a map loaded on the
page and I am required to dynamically draw points, lines, curves on
the map to show a location, road etc.
Kindly tell me if these is a javascript/ajax library/tool to perform
such actions.
|
by: pushpakulkar |
last post by:
Hi all,
Is garbage collection possible in C++. It doesn't come as part of
language support. Is there any specific reason for the same due to the
way the language is designed. Or it is discouraged due to
some specific reason. If someone can give inputs on the same, it will
be of great help.
Regards,
Pushpa
|
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...
|
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,...
| |
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,...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |