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

UserControl - Paint in Design Mode

I have a usercontrol that requires I draw some lines on it which depend on
the size of the control. In the Design Mode I add the control to a form in
my application and change the size of the control. How do I show the new
lines which will be drawn while in the design mode. I tried overriding paint
but this doesn't show up until runtime.
--
Dennis in Houston
Nov 21 '05 #1
2 2985
Hi,

Try setting the resize redraw style in the control. Add
this to the new procedure of the control

me.setstyle(controlstyles.resizeredraw,true)

http://msdn.microsoft.com/library/de...classtopic.asp

http://msdn.microsoft.com/library/de...styletopic.asp

Ken
-------------------------
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
I have a usercontrol that requires I draw some lines on it which depend on
the size of the control. In the Design Mode I add the control to a form
in
my application and change the size of the control. How do I show the new
lines which will be drawn while in the design mode. I tried overriding
paint
but this doesn't show up until runtime.
--
Dennis in Houston

Nov 21 '05 #2
Then which event do I put my line drawing routines in? I tried adding the
line to the new sub of the control and drawing the lines in the paint event
but there were no lines in the control until I ran the application.
--
Dennis in Houston
"Ken Tucker [MVP]" wrote:
Hi,

Try setting the resize redraw style in the control. Add
this to the new procedure of the control

me.setstyle(controlstyles.resizeredraw,true)

http://msdn.microsoft.com/library/de...classtopic.asp

http://msdn.microsoft.com/library/de...styletopic.asp

Ken
-------------------------
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
I have a usercontrol that requires I draw some lines on it which depend on
the size of the control. In the Design Mode I add the control to a form
in
my application and change the size of the control. How do I show the new
lines which will be drawn while in the design mode. I tried overriding
paint
but this doesn't show up until runtime.
--
Dennis in Houston


Nov 21 '05 #3

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

Similar topics

1
by: Brett | last post by:
In VB, a UserControl could determine its run-time vs. design-time status by evaluating the UserControl.Ambient.UserMode. For the life of me I can't figure out how to do the same basic thing in...
1
by: Tiago Barbutti | last post by:
I have a UserControl that execute methods in Load event, but it hapens in designMode and generate an error and the control disappear from the form. I read that i can use the DesignMode to kwnow...
10
by: Jeff | last post by:
I'm just starting to work with UserControls and have a question on the behavoir of exceptions within UserControls and VS.Net 2003. I have noticed that when a UserControl throws an exception from...
5
by: Michael Chapman | last post by:
I have a UserControl-derived class that behaves somewhat strangely in the form designer. Some properties (BorderStyle and Font) cause the control to be updated in the designer, but others...
1
by: aspirit | last post by:
Hello I'm writing a control based on UserControl class. My control will paint itself using only graphics methods like DrawRectangle, DrawString, etc. The problem is that in design time I can't...
11
by: Crirus | last post by:
I need to derive the Windows.Forms.Control 2 times so I design a class like this Public Class BMControl Inherits System.Windows.Forms.UserControl Public Class MapControl Inherits BMControl
1
by: astroboy | last post by:
How do UserControl know it is in design mode or runtime mode?
2
by: Just Me | last post by:
I have a usercontrol I created on a form. Every once in a while it will disappear from the form but the statement Friend WithEvents ControlText1... is still there but the rest of the windows...
5
by: Dennis | last post by:
I have a UserControl with several Browsable properties. In some of the properties "Set", I execute code that calls other procedures in my control. In the Design Mode when the properties are set in...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.