473,785 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drawing an image

I'm drawing an image in a panel control with this sentence in the Paint
method:

e.Graphics.Draw ImageUnscaled(I mage, panelImage.Auto ScrollPosition) ;

The problem is that I only want to paint a region of the image specified by
a Rectangle object. I can do it with:

e.Graphics.Draw ImageUnscaled(I magen, myRectangle);

but, in this case, if the user moves the image with the scroll bars, it
isn't shown properly.

What can I do? Thank you in advance.
Nov 16 '05 #1
3 5808
Rather than drawing in the panel why don't you put a PictureBox in the panel
and load the image into that, then resize and position the PictureBox, the
autoscroll on the panel will then let you move around the image.

"Alberto" wrote:
I'm drawing an image in a panel control with this sentence in the Paint
method:

e.Graphics.Draw ImageUnscaled(I mage, panelImage.Auto ScrollPosition) ;

The problem is that I only want to paint a region of the image specified by
a Rectangle object. I can do it with:

e.Graphics.Draw ImageUnscaled(I magen, myRectangle);

but, in this case, if the user moves the image with the scroll bars, it
isn't shown properly.

What can I do? Thank you in advance.

Nov 16 '05 #2
I just inserted the image control and the panel but now I don't know how to
show the scrollbars when the image is bigger than the size of the image
control.

Thanks for your help.
"tony lock" <to******@discu ssions.microsof t.com> escribió en el mensaje
news:D2******** *************** ***********@mic rosoft.com...
Rather than drawing in the panel why don't you put a PictureBox in the panel and load the image into that, then resize and position the PictureBox, the
autoscroll on the panel will then let you move around the image.

"Alberto" wrote:
I'm drawing an image in a panel control with this sentence in the Paint
method:

e.Graphics.Draw ImageUnscaled(I mage, panelImage.Auto ScrollPosition) ;

The problem is that I only want to paint a region of the image specified by a Rectangle object. I can do it with:

e.Graphics.Draw ImageUnscaled(I magen, myRectangle);

but, in this case, if the user moves the image with the scroll bars, it
isn't shown properly.

What can I do? Thank you in advance.

Nov 16 '05 #3
Just set the panels autoscroll property to true and the scrollbars appear
when needed.

"Alberto" wrote:
I just inserted the image control and the panel but now I don't know how to
show the scrollbars when the image is bigger than the size of the image
control.

Thanks for your help.
"tony lock" <to******@discu ssions.microsof t.com> escribió en el mensaje
news:D2******** *************** ***********@mic rosoft.com...
Rather than drawing in the panel why don't you put a PictureBox in the

panel
and load the image into that, then resize and position the PictureBox, the
autoscroll on the panel will then let you move around the image.

"Alberto" wrote:
I'm drawing an image in a panel control with this sentence in the Paint
method:

e.Graphics.Draw ImageUnscaled(I mage, panelImage.Auto ScrollPosition) ;

The problem is that I only want to paint a region of the image specified by a Rectangle object. I can do it with:

e.Graphics.Draw ImageUnscaled(I magen, myRectangle);

but, in this case, if the user moves the image with the scroll bars, it
isn't shown properly.

What can I do? Thank you in advance.


Nov 16 '05 #4

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

Similar topics

1
2423
by: news.microsoft.com | last post by:
Hello group, My goal is to attach an image over another image. Top image should be transparent so the back image is visible through the top one. Bellow is a test code in VB.NET. You need to create a form, a button (Button1) and an Picture Box (picBox). "watermark.jpg" is any jpg image, "beispiel.tif" is a multipage TIFF image with the white background, which will turn to transparent. The most important thing here is that the TIFF image...
7
14256
by: Toby Mathews | last post by:
Hi, In an ASP.Net application I want to convert open create a FileStream object from a System.Drawing.Image - is this possible? I create an instance of an Image object using the FromFile method, then use the GetThumbnailImage method to create a second Image. This second one is the one I want to get a FileStream from, so that I can then use its Handle to use Response.WriteFile to output the thumbnail on my ASP.Net page. Any help would...
2
391
by: James Coburn's Grey Helmet Hair | last post by:
When I try to compile my GTK# app, the compiler says: jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -r -o buttons.exe error CS2001: Source file 'buttons.exe' could not be opened Compilation failed: 1 error(s), 0 warnings jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -o buttons.exe buttons.cs(8) error CS0246: The namespace `System.Drawing' can not be found (missing assembly reference?)
0
1856
by: John via .NET 247 | last post by:
Hi, I'm using the System.Drawing.Bitmap namespace to load an image,and the RotateNoneFlipY method to flip that image before saving.However I have noticed that the saved image appears cropped andhas a large blue area on a particular side, which gets largerevery time the image is flipped again. I'm assuming that this may be due to a lack of time assigned tothe procedure before saving the image, but I'm not sure how Ican recitify this. I...
4
3653
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:
3
8938
by: J | last post by:
I tried to inherit 'Shot' class from 'Image' class, only to fail. It gives me the CS0122 error, which says that it can't access 'System.Drawing.Image.Image()'. What am I missing? using System;
5
3375
by: Jerry J | last post by:
I want to use the System.Drawing.Image class. According to the help file, this is an abstract base class. Because it is supposedly abstract, I created another class that inherits from it. However, when I did this I got the following error: 'System.Drawing.Image.Image()' is inaccessible due to its protection level Looking at other online examples, I found that the proper way to use it is like this:
3
6443
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...
2
1889
by: luckyguy4ru | last post by:
Hello every body, I just joined today this forum hopping that i will get really good help here, My final project is to refashioned an artist work which is mostly pencil work, i have fake color pallet and fill color to fill and use different color while modifying and existing image, but when i import an image on stage and start drawing, it goes to stage instead of image, when i move image after drawing, my drawing does not move with the...
2
2329
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
9645
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
10155
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
10095
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
8979
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...
0
6741
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();...
0
5383
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...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
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
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.