Ok, dumb question, but how do you draw a single point in gdi? I thought you
could use the .DrawLine method and just specify the same start and end
point, but that does nothing. In otherwords, if I have:
g.DrawLine(myPe n,x,y,x,y)
nothing happens. I can have:
g.DrawLine(myPe n,x,y,x+1,y+1)
and I can see what I am wanting, but obviously it's kinda' wierd-ish. So
how do you draw an individual point? (DrawElipse has the same problem).
Thanks,
D
``````````````` ``````````````` `` 8 39474
Hi D, Hi,
As you've found, DrawLine (oPenSesame, X, Y, X, Y) gives you nothing.
This is by design - and I'd like to know by who, come on own up!! I first
came across it in VB3 when doing owner-drawn controls and it makes a right
mess of the code when you want to be pixel-perfect. A line is always drawn
just short of the specified endpoint so, to get your line, you have to extend
the co-ordinates. Bad news when doing diagonals! I think I read somewhere once
that it's something to do with making it easy to draw sequences of lines? I
wish they'd left it 'harder' for us.
Regards,
Fergus
"MC D" <as***@earthtal k.com> scripsit: Ok, dumb question, but how do you draw a single point in gdi? I thought you could use the .DrawLine method and just specify the same start and end point, but that does nothing. In otherwords, if I have:
g.DrawLine(myPe n,x,y,x,y)
nothing happens. I can have:
g.DrawLine(myPe n,x,y,x+1,y+1)
and I can see what I am wanting, but obviously it's kinda' wierd-ish. So how do you draw an individual point? (DrawElipse has the same problem).
\\\
Private Sub Form1_Paint( _
ByVal sender As Object, _
ByVal e As System.Windows. Forms.PaintEven tArgs _
) Handles MyBase.Paint
e.Graphics.Fill Rectangle( _
Brushes.Red, _
New Rectangle(100, 100, 1, 1) _
)
End Sub
///
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Hello, Fergus:
You have information about how lines and polygons are drawn in the DirectX documentation: http://msdn.microsoft.com/library/de...asp?frame=true
I hope its instructive.
Regards.
"Fergus Cooney" <fi******@tesco .net> escribió en el mensaje news:uf******** ******@TK2MSFTN GP12.phx.gbl...
| Hi D, Hi,
|
| As you've found, DrawLine (oPenSesame, X, Y, X, Y) gives you nothing.
|
| This is by design - and I'd like to know by who, come on own up!! I first
| came across it in VB3 when doing owner-drawn controls and it makes a right
| mess of the code when you want to be pixel-perfect. A line is always drawn
| just short of the specified endpoint so, to get your line, you have to extend
| the co-ordinates. Bad news when doing diagonals! I think I read somewhere once
| that it's something to do with making it easy to draw sequences of lines? I
| wish they'd left it 'harder' for us.
|
| Regards,
| Fergus
|
|
Hello, Herfried:
I don't know how GDI+ is internally optimized but, don't you think DrawLine consumes less process time than FillRectangle for the same purpose? Ok, I know that for a single dot it's not important, but it could be for a large number of dots.
Does anybody know why doesn't exist a DrawPoint function? Or a DrawMarker?
Regards.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> escribió en el mensaje news:ON******** ******@TK2MSFTN GP09.phx.gbl...
| "MC D" <as***@earthtal k.com> scripsit:
| > Ok, dumb question, but how do you draw a single point in gdi? I thought you
| > could use the .DrawLine method and just specify the same start and end
| > point, but that does nothing. In otherwords, if I have:
| >
| > g.DrawLine(myPe n,x,y,x,y)
| >
| > nothing happens. I can have:
| >
| > g.DrawLine(myPe n,x,y,x+1,y+1)
| >
| > and I can see what I am wanting, but obviously it's kinda' wierd-ish. So
| > how do you draw an individual point? (DrawElipse has the same problem).
|
| \\\
| Private Sub Form1_Paint( _
| ByVal sender As Object, _
| ByVal e As System.Windows. Forms.PaintEven tArgs _
| ) Handles MyBase.Paint
| e.Graphics.Fill Rectangle( _
| Brushes.Red, _
| New Rectangle(100, 100, 1, 1) _
| )
| End Sub
| ///
|
| --
| Herfried K. Wagner
| MVP · VB Classic, VB.NET
| <http://www.mvps.org/dotnet>
José Manuel Agüero <jmaguero, cliente de vodafone (es)> scripsit: I don't know how GDI+ is internally optimized but, don't you think DrawLine consumes less process time than FillRectangle for the same purpose? Ok, I know that for a single dot it's not important, but it could be for a large number of dots.
I remember DrawLine placed the point on the wrong position or it didn't
draw it at all...
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Hello, Herfried:
You are right... partially. In fact the last point of a line is never displayed. I haven't been able to find complete information, only a sample graphic in http://msdn.microsoft.com/library/de...asp?frame=true that doesn't contain an explanation. You can see in the line sample that the last pixel is not displayed.
So, to draw a pixel at (10, 20) you should use, for example, drawline(pen,10 ,20,11,20). That is, ending one pixel to the right (or up or left or down, it's the same)
Regards.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> escribió en el mensaje news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
| José Manuel Agüero <jmaguero, cliente de vodafone (es)> scripsit:
| > I don't know how GDI+ is internally optimized but, don't you think DrawLine consumes less process time than FillRectangle for the same purpose? Ok, I know that for a single dot it's not important, but it could be for a large number of dots.
|
| I remember DrawLine placed the point on the wrong position or it didn't
| draw it at all...
|
| --
| Herfried K. Wagner
| MVP · VB Classic, VB.NET
| <http://www.mvps.org/dotnet>
Hi Jose,
Thanks for the link 0 it was interesting. Makes you wonder when even such
small things as a two pixel lines is considered as a triangle!!
Regards,
Fergus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gernot Frisch |
last post by:
Hi,
does repeatingly doing this:
float num = GetRandomFloat();
for(;;)
{
float random = GetRandomFloat();
num*=random;
num/=random;
|
by: MC D |
last post by:
Ok, dumb question, but how do you draw a single point in gdi? I thought you
could use the .DrawLine method and just specify the same start and end
point, but that does nothing. In otherwords, if I have:
g.DrawLine(myPen,x,y,x,y)
nothing happens. I can have:
g.DrawLine(myPen,x,y,x+1,y+1)
|
by: Craig |
last post by:
Hi All,
I am working on a .NET application and I rendering data into a Bitmap
object. We draw symbols with a font that is selected by the customer. The
current version draws the symbol using an X and Y offset (in pixels) as a
representation of the symbols center point (each symbol has a different
center point which is based on its output image. An example would be a
square symbol would have an xy offset of 5,5 where a V symbol could...
|
by: uspensky |
last post by:
We are trying to setup a system to system failover cluster using two
nodes (x346) which each have a single hba running to seperate
controllers on the DS400.
For full redundnancy, IBM recommends dual path from each node but we
dont need that. The current setup has two completly seperate paths. hba
on node 1 to controller A on DS400 and hba on node 2 to controller B.
If i take a controller offline, failover works fine to jumo to other...
|
by: Paul Cheetham |
last post by:
Hi,
I have two projects where I want to use the same source file in each
project.
If I add the file to each project, then a local copy is made.
I want to be able to have a single source file used by both projects so
that I only have to change one file.
I am using compiler directives within the file, and so I can't just
build it into a DLL and do it that way, I really do need to make both
| |
by: RobinDiederen |
last post by:
Suppose I write a SQL query, giving a single point result (for instance, SELECT COUNT(*) FROM persons). After doing the query, I want a assign it's result to a variable with the identical type. How do I do that?
For example:
SQL = "SELECT COUNT(*) FROM persons"
Set Db = CurrentDb
Set rst = Db.OpenRecordset(SQL, dbOpenDynaset)
So, rst holds the result, which has to be an integer. Just... how can I use rst of the RecordSet type in...
|
by: Samir Chouaieb |
last post by:
Hello,
I am trying to find a solution to a login mechanism for different
domains on different servers with PHP5.
I have one main domain with the user data and several other domains that
need a login to show data.
I want the user to login only once when he visits any of my domains.
|
by: cppquester |
last post by:
A colleague told me that there is a rule about good stype that a
function in C++ should have only one point of return (ie. return
statement). Otherwise there might be trouble.
I never heard about it and doubt it.
Anybody heard of it? What would be the advantage?
Regards,
Marc
Example:
|
by: Roger Frost |
last post by:
I need to draw a single point with WPF but there doesn't seem to be a class
that represents the most fundamental geometric object.
Any idea's?
--
Roger Frost
"Logic Is Syntax Independent"
|
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: 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...
|
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: 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: 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...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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...
| |