Click here to Skip to main content
16,005,121 members
Home / Discussions / C#
   

C#

 
GeneralRe: Textfile and its schema Pin
MarcelErz14-Dec-05 0:31
MarcelErz14-Dec-05 0:31 
QuestionSend Message Pin
picasso213-Dec-05 17:55
picasso213-Dec-05 17:55 
AnswerRe: Send Message Pin
MarcelErz13-Dec-05 22:28
MarcelErz13-Dec-05 22:28 
QuestionDatagridTextBoxColumn with Combo Pin
Mahi.Ragava13-Dec-05 17:49
Mahi.Ragava13-Dec-05 17:49 
QuestionList of Funny Generics Pin
Clickok13-Dec-05 17:07
Clickok13-Dec-05 17:07 
AnswerRe: List of Funny Generics Pin
Christian Graus13-Dec-05 17:15
protectorChristian Graus13-Dec-05 17:15 
AnswerRe: List of Funny Generics Pin
leppie13-Dec-05 23:08
leppie13-Dec-05 23:08 
QuestionGraphics.PageScale Problem when scrolling Pin
-Rowan-13-Dec-05 15:26
-Rowan-13-Dec-05 15:26 
Hi folks,

I have just started trying to do some basic graphics using the Graphics Class. I found an excellent tutorial on CodeProject about making a scrolling window with graphics in it and implemented it with no problems within my code. I then wanted to add a Scaling Function using the PageScale feature, but now the scrolling stops working reliably and I get a jagged pictures with parts printed all over the screen.

I've written a short piece of code to show this problem - if you make the pagescale value 1.0F then everything works fine, any other values result in a mess...

Thanks for any advice...

<br />
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
<br />
namespace scrollfailure<br />
{<br />
	public class Form1 : System.Windows.Forms.Form<br />
	{<br />
		private System.ComponentModel.Container components = null;<br />
		public Form1()<br />
		{<br />
			InitializeComponent();<br />
		}<br />
		protected override void Dispose( bool disposing )<br />
		{<br />
		if( disposing )<br />
		{if (components != null) { components.Dispose(); }<br />
}base.Dispose( disposing );<br />
		}<br />
<br />
		#region Windows Form Designer generated code<br />
		private void InitializeComponent()<br />
		{<br />
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
			this.AutoScroll = true;<br />
			this.AutoScrollMinSize = new System.Drawing.Size(600, 600);<br />
			this.ClientSize = new System.Drawing.Size(275, 249);<br />
			this.Name = "Form1";<br />
			this.Text = "Form1";<br />
			this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);<br />
		}<br />
		#endregion<br />
		[STAThread]<br />
		static void Main() <br />
		{<br />
			Application.Run(new Form1());<br />
		}<br />
		private Point rectangleTopLeft = new Point(45, 45);<br />
		private Size rectangleSize = new Size(200,200);<br />
		private Point ellipseTopLeft = new Point(50, 200);<br />
		private Size ellipseSize = new Size(200, 150);<br />
		private Pen bluePen = new Pen(Color.Blue, 1);<br />
		private Pen redPen = new Pen(Color.Red, 1);<br />
		<br />
		private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
		{<br />
			<br />
			Graphics dc = e.Graphics;<br />
			dc.PageScale = 2.0F; // <-- Make this 1.0F and it works<br />
			Size ScrollOffset = new Size(this.AutoScrollPosition);<br />
			<br />
			Rectangle RectangleArea = new Rectangle<br />
					(rectangleTopLeft+ScrollOffset, rectangleSize);<br />
			Rectangle EllipseArea = new Rectangle<br />
					(ellipseTopLeft+ScrollOffset, ellipseSize);<br />
			dc.DrawRectangle(bluePen, RectangleArea);<br />
			dc.DrawEllipse(redPen, EllipseArea);<br />
			<br />
		}<br />
	}<br />
}<br />
<br />

QuestionOracle Querying in C# Pin
apoc50313-Dec-05 14:14
apoc50313-Dec-05 14:14 
AnswerRe: Oracle Querying in C# Pin
Christian Graus13-Dec-05 15:06
protectorChristian Graus13-Dec-05 15:06 
GeneralRe: Oracle Querying in C# Pin
apoc50314-Dec-05 9:05
apoc50314-Dec-05 9:05 
Questionnew to c# Pin
lino_i13-Dec-05 13:58
lino_i13-Dec-05 13:58 
AnswerRe: new to c# Pin
Christian Graus13-Dec-05 15:03
protectorChristian Graus13-Dec-05 15:03 
AnswerRe: new to c# Pin
Kevin McFarlane14-Dec-05 5:14
Kevin McFarlane14-Dec-05 5:14 
Questiondataset Pin
fmardani13-Dec-05 11:45
fmardani13-Dec-05 11:45 
AnswerRe: dataset Pin
bloo2k13-Dec-05 16:47
bloo2k13-Dec-05 16:47 
QuestionHow to filter datatable and send Pin
kotteeswaran13-Dec-05 11:21
kotteeswaran13-Dec-05 11:21 
QuestionVSTO and Excel Hyperlinks Pin
Drew McGhie13-Dec-05 10:38
Drew McGhie13-Dec-05 10:38 
Questiondifferences please !!! Pin
faviochilo13-Dec-05 9:50
faviochilo13-Dec-05 9:50 
QuestionHow to raise Mouse click event Pin
bloo2k13-Dec-05 9:49
bloo2k13-Dec-05 9:49 
AnswerRe: How to raise Mouse click event Pin
Polis Pilavas13-Dec-05 10:43
Polis Pilavas13-Dec-05 10:43 
AnswerRe: How to raise Mouse click event Pin
enjoycrack13-Dec-05 10:45
enjoycrack13-Dec-05 10:45 
AnswerRe: How to raise Mouse click event Pin
Curtis Schlak.13-Dec-05 10:51
Curtis Schlak.13-Dec-05 10:51 
AnswerRe: How to raise Mouse click event Pin
MarcelErz13-Dec-05 22:55
MarcelErz13-Dec-05 22:55 
AnswerRe: How to raise Mouse click event Pin
bloo2k13-Dec-05 22:56
bloo2k13-Dec-05 22:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.