onpaint

how to make a tmemo and Tedit with a transparent background?

混江龙づ霸主 提交于 2019-12-01 06:50:44
问题 how to make a tmemo and Tedit with a transparent background? or add image background on it's canvas. that workable in both Delphi7 up 回答1: I have no actual answer to the question, but I know that TJvMemo from JVCL allows you to set it to transparent. Maybe you could just use that component? If not, you could check how it works. 回答2: You can use a window-less Rich Edit control. There might be easier solutions, however. 来源: https://stackoverflow.com/questions/3714495/how-to-make-a-tmemo-and

What is the proper way to draw a line with mouse in C#

落爺英雄遲暮 提交于 2019-12-01 03:59:17
This is my drawing code to draw a custom line with mouse onto a Chart. Can you please help me to do it proper way ? namespace Grafi { public partial class Form1 : Form { bool isDrawing = false; Point prevPoint; public Form1() { InitializeComponent(); } private void chartTemperature_MouseDown(object sender, MouseEventArgs e) { isDrawing = true; prevPoint = e.Location; } private void chartTemperature_MouseMove(object sender, MouseEventArgs e) { Pen p = new Pen(Color.Red, 2); if (isDrawing) { Graphics g = chartTemperature.CreateGraphics(); g.DrawLine(p, prevPoint, e.Location); prevPoint = e

What is the right way to use OnPaint in .Net applications?

蓝咒 提交于 2019-11-30 23:13:27
Sometimes I need a custom appearence of a control. Or do alot of custom painting. I know I can do so with OnPaint (see: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onpaint.aspx ) What is the right way to custom paint stuff on your .net application using OnPaint ? Are there any rules I have to keep in mind to keep my application optimized, and keep render time to a minimum? Note: I have seen, and experienced, a lot of inefficient uses of OnPaint from time to time, therefore I created this Q&A. To use OnPaint efficiently you have to know a couple things: The OnPaint of a

C#: Overriding OnPaint on ProgressBar not working?

早过忘川 提交于 2019-11-27 23:13:31
Was thinking it should be pretty easy to create a ProgressBar that drew some text upon itself. However, I am not quite sure what is happening here... I added the following two overrides: protected override void OnPaintBackground(PaintEventArgs pevent) { base.OnPaintBackground(pevent); var flags = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter | TextFormatFlags.SingleLine | TextFormatFlags.WordEllipsis; TextRenderer.DrawText(pevent.Graphics, "Hello", Font, Bounds, Color.Black, flags); } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); var flags =

How to save drew Graphics of “Paint()” into image using c#?

让人想犯罪 __ 提交于 2019-11-27 08:38:34
问题 I actually wanted to Convert RTF into Image so after googling a lot I've got a code that does it by Paint() Event of Picturebox1 and it works perfectly : private void pictureBox1_Paint(object sender, PaintEventArgs e) { e.Graphics.Clear(richTextBox1.BackColor); e.Graphics.DrawRtfText(this.richTextBox1.Rtf, this.pictureBox1.ClientRectangle); base.OnPaint(e); // below code just create an empty image file Bitmap newBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height); e.Graphics.DrawImage

C#: Overriding OnPaint on ProgressBar not working?

烈酒焚心 提交于 2019-11-27 04:40:28
问题 Was thinking it should be pretty easy to create a ProgressBar that drew some text upon itself. However, I am not quite sure what is happening here... I added the following two overrides: protected override void OnPaintBackground(PaintEventArgs pevent) { base.OnPaintBackground(pevent); var flags = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter | TextFormatFlags.SingleLine | TextFormatFlags.WordEllipsis; TextRenderer.DrawText(pevent.Graphics, "Hello", Font, Bounds, Color

How to effectively draw on desktop in C#?

南笙酒味 提交于 2019-11-26 20:17:46
I want to draw directly on the desktop in C#. From searching a bit, I ended up using a Graphics object from the Desktop HDC (null). Then, I painted normally using this Graphics object. The problem is that my shapes get lost when any part of the screen is redrawn. I tried a While loop, but it actually ends up drawing as fast as the application can, which is not the update rate of the desktop. Normally, I would need to put my drawing code in a "OnPaint" event, but such thing does not exist for the desktop. How would I do it? Example code: https://stackoverflow.com/questions/1536141/how-to-draw