Please read the code snippets belo
snippet 1: Drawing rectangle using Device Context
----------------------------------------------------------------[System.Runtime. InteropServices .DllImportAttri bute("gdi32.dll ")
private static extern bool Rectangle
IntPtr hdc
int ulCornerX, int ulCornerY
int lrCornerX, int lrCornerY)
public void GetHdcForGDI(Pa intEventArgs e
// Create pen
Pen redPen = new Pen(Color.Red, 1)
// Draw rectangle with GDI+
e.Graphics.Draw Rectangle(redPe n, 10, 10, 100, 50)
// Get handle to device context
IntPtr hdc = new IntPtr()
hdc = e.Graphics.GetH dc()
// Draw rectangle with GDI using default pen
Rectangle(hdc, 10, 70, 110, 120)
// Release handle to device context
e.Graphics.Rele aseHdc(hdc)
-----------------------------------------------------------------
snippet 2: Drawing rectangle using PrintPageEvntAr g
-------------------------------------------------------------------
private void printDocument1_ PrintPage(objec t sender, System.Drawing. Printing.PrintP ageEventArgs e
Pen redPen = new Pen(Color.Red, 1)
e.Graphics.Draw Rectangle(redPe n, 100, 100, 100, 100)
---------------------------------------------------------------------
Please explain what is difference between drawing rectangle using Device Context and PrintPageEvntAr gs in terms of the concept and merits
regards 0 1229 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Atif |
last post by:
Hello all,
In my html page I want to add an image say of 800x600. Now I want that
when ever I am given two coordinates on this image say (x1, y1)=(50,
100) and (x2, y2)=(200, 300), the java script code will trace these
coordinates on the image and draw the line between these two points.
Can anyone please help me in writing the javascript code of this
problem?
Thanks and Regards
Atif
|
by: James Beswick |
last post by:
I want to do some primitive graphics work - drawing circles, squares,
lines and enable the user to manipulate these on an Access form. All
the drawing methods are on the report object so are there any (free)
third party controls or ways around this to enable drawing?
Any help would be most appreciated.
-- James
|
by: billy |
last post by:
I'm working on a sort of paint program that has the usual canvas pane in the
middle of the main form. I'm working on that class and have a couple quick
questions.. actually more like I'm looking for opinions.
1) I want a ruler running along from top left to top right and from top left
to bottom left. I want to use a skinny UserControl or something that runs
the respective length. I could simply track the mouse and draw the little
line on...
|
by: F. GEIGER |
last post by:
Crosspost:
microsoft.public.vc.mfc,microsoft.public.dotnet.languages.vc,microsoft.public.dotnet.languages.vc.libraries
Drawing lib for MFC apps?
Hi all,
I have to build drawing capabilities into an already existing MFC application.
|
by: Metallicraft |
last post by:
I have a vb6 application. On the main form is a picture
box with one or two images and several pieces of text
displayed in it. These are created on the fly using gdi32
routines that are all in a referenced, custom dll. I call
a PrintImage routine in the dll and pass it only the the
Picturebox.hdc from the main form. The dll's print routine
draws to the hdc and it shows up in the picturebox
perfectly.
I would like to do a similar thing...
| |
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...
|
by: Dave Keen |
last post by:
Hi all.
Hope you can help me. This should be easy but I can't make this work.
In brief I am building a page of thumbnails using images held in a
SQLServer 2000 database. I do this by creating imagebuttons which
point to a dummy page that takes the image and displays it via
response. All works fine if I use explicit paths to a file
(response.writefile(<filename>) or directly pass through the database
image...
|
by: Macias |
last post by:
Hi,
Please help me, how I can make a line drawing on PictureBox similar to
MS paint. I thinking about this: click and hold button, move mouse and
relase button.
I'm trying useing this g.DrawLine(..), but I have a lot of line.
In C++ is a parameter XORPUT, but in C# I can't find it.
|
by: Chris Dunaway |
last post by:
On May 8, 1:11 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
I'm afraid that I can't offer anything more than what you have learned
on your own. I only suggested that class because I have seen the
original poster's question many times in various forums and that is,
invariably, the answer that is given. I haven't delved too deeply
into the subject myself.
Chris
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |