473,395 Members | 1,442 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,395 software developers and data experts.

How to use ControlPaint to draw Grab Handles and a Grid

The ControlPaint class looks like the ideal way to draw grab handles, a
grid, and other designer-like stuff in a windows form, but I can't make it
work.

I realise I need to use SetStyle to set the UserPaint bit, but the method is
protected on a textbox, for example, so I can't call it.

If I call it for the form, and use DrawGrid, I get nothing. For example, in
the form Load event

<code>
Me.SetStyle(ControlStyles.UserPaint, True)
Me.UpdateStyles()

ControlPaint.DrawGrid(Drawing.Graphics.FromHwnd(Me .Handle), New
Rectangle(Me.Location, Me.Size), New Size(10, 10), Color.AliceBlue)
</code>

The MSDN implies that this is all I need do, but it doesn't work.

Can anyone suggest where I am going wrong?

TIA

Charles
Nov 20 '05 #1
0 1463

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

Similar topics

21
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
1
by: Tomasz Kulig | last post by:
Hello... I've some annoying problem when I use DrawGrid method. It seems that it ignores nOffsetX and nOffsetY (refer to example code). Bounding rectangle can be moved, but points of grid are...
4
by: Joe Kasta | last post by:
Here's a tricky question..:) I have a a function in a webform that will draw a checkbox in a given area (note, this is an override of a PaintForeground function, not a drop / drag of a checkbox...
0
by: Alejandro K. | last post by:
First of all i know that this might be for the Drawing newsgroup but i posted there and got no answers so.... let see if somebody here can help me. Hi , i got some problems using Paint...
1
by: Jeff Waskiewicz | last post by:
Hello All, I'm trying to solve a nagging problem. The goal is to draw a rectangle over the top of all the other controls on a form. Specifically, over a ChartFX control. The user would draw...
0
by: benfly08 | last post by:
Hi, guys. I have a program to draw bar/pie chart based on the data i hard coded in it. However, my image comes with "BLACK" background color. I don't know how to fix this. The code snippet is...
1
by: Tom | last post by:
Hey, I have tried drawing a grid onto my control using the following: Private Sub VGUI_Grid(...) Handles MyBase.Paint Dim new_bitmap As Bitmap ' Make a new bitmap that fits the...
0
by: kam45 | last post by:
I did one program that draws a line with two squares at the ends and I can just click and extend each ends. It works ok but I need to move the whole line. Would anyone knows how? Private Const...
8
by: Rainer Queck | last post by:
Hello NG, I had/have a bad flicker Problem with my Application. On starting some applications, while my app was running, the whole Display started to flicker. Even the desktop Icons! Looking...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.