painting

How to fix an MFC Painting Glitch?

Hello. I'm trying to implement some drag and drop functionality for a material system being developed at my work. Part of this system includes a 'Material Library' which acts as a repository, divided into groups, of saved materials on the user's hard drive. As part of some UI polish, I was hoping to implement a 'highlight' type feature....

Tickmark algorithm for a graph axis

I'm looking for an algorithm that places tick marks on an axis, given a range to display, a width to display it in, and a function to measure a string width for a tick mark. For example, given that I need to display between 1e-6 and 5e-6 and a width to display in pixels, the algorithm would determine that I should put tickmarks (for exa...

How do I suspend painting for a control and its children?

I have a control which I have to make large modifications to. I'd like to completely prevent it from redrawing while I do that - SuspendLayout and ResumeLayout aren't enough. How do I suspend painting for a control and its children? ...

Java Paint Method Doesn't Paint?

I'm working on a simple little swing component, and I'm tearing out my hair trying to figure out why my paint method isn't working. The idea behind this component is that it's a small JPanel with a label. The background (behind the label) is supposed to be white, with a colored rectangle on the left-hand side indicating the ratio of two...

How do I paint a hosted NumericUpDown using the existing ToolStripRenderer?

I have a control which hosts a NumericUpDown in a ToolStripControlHost and exposes the NumericUpDown's properties. Functionally, that's fine, but when it's placed on a ToolStrip it doesn't fit visually with the other ToolStripItems. I'd like to use the ToolStrip's existing ToolStripRenderer to draw the control in a manner similar to th...

How can I tell if a Delphi control is currently visible?

I need a way to for a custom control (descended from TCustomControl) to tell if it is currently visible. I'm not talking about the .Visible property; I mean whether or not it's actually being displayed on-screen at the moment. Does anyone know how to do this? ...

C++/QT: drawing a caret

I'm learning QT. I just started to write a text editor from scratch by inheriting QAbstractScrollArea. I'm doing this just for practice. But now I'm faced with the problem of displaying a caret. What comes to my mind is painter.drawLine and QTimer. Can you give some advices on this. I would also be glad hear some strategies to implement ...

How to draw signature with lines on iPhone screen?

I want to let user draw a signature on iPhone screen, so I add a subclass of UIView and add some code to its 'touchesMoved' method. -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; firstTouch = [touch locationInView:self]; CGSize mySize = CGSizeMake(5, 5); UIGraph...

What am I doing wrong with my custom "HorizontalRule" control?

I've written the following (very simple) control for use in an application (comments removed for brevity): public partial class HorizontalRule : Control { public HorizontalRule() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); var g = e.Graphic...

Dashed rectangles appear solid when expanding Winform window.

I'm experiencing an issue with GDI+ while custom painting dashed rectangles. The vertical portion of dashed rectangles appear as solid, continuous lines when the window size is increased or when scrolling up/down. Moving the mouse faster results in fewer and fewer solid sections. Curiously the horizontal lines do not exhibit this be...

Antialiased SmoothingMode distorts Dashed Pen

Why does switching on anti-aliasing interfere with my dashed pen? ...

How to paint transparent areas for child controls?

I have a CTabCtrl subclass which I'm trying overriding WM_PAINT to perform custom drawing. The only problem is, when I change the selected tab, I get artifacts left on the dialog where the old paint code hasn't been erased before the new code is painted on top. (The standard tab controls have the selected tab appear 2 pixels bigger than ...

What is the fastest way to paint an image in Windows.Forms?

I've used a number of techniques in the past to paint images in Windows.Forms and I'm now revisiting some core libraries that handle rendering skin images for our product. I'm interested in particular in rendering the same image multiple times (tiled) to represent the field of a background control. Assuming the image is exactly the right...

Freeform drawing canvas (with shapes) in Java

Hello! I'm working on an GMF (RCP/EMF/GEF) application that allows users to create design diagrams. As part of that application, we have to allow the user to create their own custom shapes to add in diagrams. We are thinking of using SVG as the storage format for shapes. I'm looking for a Java library that creates such canvases and all...

Anyone know of simple paint/annotation control for .net?

I want a simple reusable control that I can use in a form to view and annotate images. Example usage: I load an image, or paste from clipboard to the control. Annotate image, e.g. draw red ring around a feature. Perhaps add some text. Save image, or copy to clipboard, in chosen format (i.e. so we can compress). ...

Using Java's Graphics or Graphics2D classes, how do I paint a String?

I have a String and I want to paint it onto an image. I am able to paint points and draw lines, however, even after reading the Text part of the 2D Graphics tutorial, I can't figure out how I can take a String and paint it onto my drawing. Unless I'm looking at the wrong tutorial (but it's the one I get whenever I search for anything ab...

Windows Form Paints Repeatedly In XP, But Not In Vista

I am trying to solve an issue in my application. I am developing the application in Vista and it works fine there, but when I take it to XP, the form becomes sluggish and unresponsive. When I watch the windows messages using breakpoints, I find that in XP the form is repeatedly painted about once every second (even though it does not r...

java to c# how to do custom painting in a panel

hello, in java when you want to do custom painting in a panel, you usually override the paint() function. now i am looking for the corresponding function to override in a C# panel. also i would be thankful for a short samplecode to do some painting. like draw a circle or something. thanks a lot! edit: ok thanks for your answers! i h...

Strange Window Painting

If you resize Google Chrome 3.0.195.21 to a very small width on Windows 7 (I haven't tried other versions), the window buttons hang off the window, like this: The window size is not extended, and the overhang does not respond to the mouse. The window's thumbnail preview shows only the part of the buttons that is inside the window; th...

Delphi/GDI+: When is a Device Context created/destroyed?

Normally using GDI+ in Delphi you can use a TPaintBox, and paint during the OnPaint event: procedure TForm1.PaintBox1Paint(Sender: TObject); var g: TGPGraphics; begin g := TGPGraphics.Create(PaintBox1.Canvas.Handle); try g.DrawImage(FSomeImage, 0, 0); finally g.Free; end; end; The problem with this paradigm ...