473,385 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Poblem with graphics.setclip method

The following code is in the Handlescroll event:

Graphics _canvasGraphics = pictureBox1.CreateGraphics();

RectangleF clipRegion = new RectangleF(hScrollBar1.Value,
vScrollBar1.Value, (pictureBox1.Right - vScrollBar1.Width),
(pictureBox1.Bottom - hScrollBar1.Height));

_canvasGraphics.SetClip(clipRegion,System.Drawing. Drawing2D.CombineMode.
Replace);

_canvasGraphics.DrawImage(pictureBox1.Image,canvas Graphics.ClipBounds);

If i change the code to this it works fine:

Graphics _canvasGraphics = pictureBox1.CreateGraphics();

RectangleF clipRegion = new RectangleF(hScrollBar1.Value,
vScrollBar1.Value, (pictureBox1.Right - vScrollBar1.Width),
(pictureBox1.Bottom - hScrollBar1.Height));

_canvasGraphics.DrawImage(ModifiedBmp,new RectangleF(0, 0,
clipRegion.Width, clipRegion.Height),
clipRegion, GraphicsUnit.Pixel);
pictureBox1.Update();

_canvasGraphics.Dispose();

The problem is i need to set the clipping region in the graphics
class.....as u can see above i don't use the setclip at all......if i
try to set the clipping region at all then i cannot display the image.
The visible clipping region gets set to zero for some reason when i was
debugging it...can anyone see a way to fix this?.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
0 1579

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

Similar topics

1
by: Yaron | last post by:
Hi, I made a procedure which receives a Graphics parameter, and with that Graphics parameter, performs various things. The area of confusion here is that when I pass the procedure a Graphics...
5
by: steve bull | last post by:
When adding a new user control to a panel I get the following call stack. Having put debugs everywhere I can think of I cannot get the program to break anywhere near where it is having this problem....
7
by: Peter Row | last post by:
Hi, I've started work on my own control some parts of which use standard controls, others I need to draw on my controls surface to get the display output I require, however.... I seem to be...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
0
by: Hasim AH | last post by:
Hi .. Just getting interested to learn C# and needs help. I want to write C# application so that the program will execute and draw graphics when the user select the drawing menu from the main...
2
by: Ringo | last post by:
Please excuse the long post, but I have an issue and don;t know how to describe it without describing the app. I have an app that reads data fro the serial port and draws it on the screen. I...
11
by: Slickuser | last post by:
I have this function that will fill the ellipse every 10 seconds with specific x,y,w,h. Now I want do the the reverse, to clear the ellipse with given x,y using Timer at every 30s. Or I have...
9
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has...
6
by: Rainer Queck | last post by:
Hello NG, I am trying to adjust the column width of a DataGridView to the Text in its column header. To do this I am using the Graphics.MeasureString method. Unfortunatly I alway get a too...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.