473,799 Members | 3,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

drawing a moveable line in MFC

57 New Member
Hello,

In an MFC application I want to draw a line which should move around after the drawing what can I do?

Thanks,
john
Jan 15 '09 #1
3 4181
lini
12 New Member
Hi,
Very wild guess is you keep invalidating the area where the line is and inside your WM_PAINT handler draw it again at another position. Alternatively you may switch your draw mode, so that when you draw the same line, it is actually erased, and then switch back to normal mode and draw it again at another position.

Once again, just a guess, correct me if I am wrong!
Cheers,
Lini
Jan 15 '09 #2
Studlyami
464 Recognized Expert Contributor
What do you want the line to do? What is the purpose of the line? You could manually redraw the line at a different location in the OnPaint function. You could also create a new window without a border and form it to the size of the line you want. This would allow you to move the "line" as you would a window. This would also give you the option to allow the user to move around the line.
Jan 16 '09 #3
george666
28 New Member
You can see professional win32 ng (news://comp.os.ms-windows.programmer.win32)
for a sample code doing _exactly_ that (MS)
(and more, as it's a drawing program to draw any shapes...)
Jan 16 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
13011
by: Remon Huijts | last post by:
Hi there, For a very specific service, I have created a PHP script that uses the GD library functions to create a PNG image from a few lines of XML data describing a simple diagram/drawing. It's cool and works, writing the XML data in a text editor is straightforward for me because I designed the format. I have no idea however how I can make a simple online drawing program that creates this XML code. The code is realy simple, just...
9
2413
by: Steve Long | last post by:
Hello, (total GDI newbie) I'm having trouble drawing just a simple line to display in a picturebox. I just want a straight, dotdash line. I have two methods, one works and one doesn't (it cause an exception to be thrown): This one works but it's not the results I want. private void CreateImage1() {
6
30680
by: Rene | last post by:
I tried searching the newsgroups to see how do you draw a dotted line but I was unable to find an answer, drawing a straight line is very easy but not a dotted one. So the question is, how do I draw a dotted line? Thank you.
2
12346
by: Champika Nirosh | last post by:
Hi, I want to create drawing board application that can draw Line, rectagle, circle and free hand drawing. Each drawing need to be transparent, moveable (draggable), have bring to front and send to back feature etc. How can I do this .. where should I start?
2
2644
by: Galaxia | last post by:
Hi, I'm using C# in VS .Net 2003. How can I build movable toolbars as that in VS IDE, dragging and arranging them? More, how can the moveable toolbar be put into the same line of Menu, as that in IE. Can anyone introduce some articles or source codes? Thanks. -- "Forward Galaxia"
9
3184
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I want to be able to draw lines in a picturebox based upon certain data points I have received. I dragged a picturebox from the toolbar onto my form, but after having gone through the help files, looking online and trying a variety of things, I...
6
1907
by: ll | last post by:
Hi, I'm currently working with a 'classic ASP' intranet site which uses a SQL server and am looking for possible ways to market it as an application for certain medical fields. Where would be a good place to start with this? Thanks for any help, Louis
4
6520
by: olseni | last post by:
Hi, i am trying to make a report which consists of many subreports, and I need to make the subreports moveable and not show when the subreport has no data. I use an event procedure in the 'On no data' property: Private Sub Report_NoData(Cancel As Integer) Cancel = True End Sub but when i try to set the 'moveable' property on the subreport, I can select 'yes' but it pops back to 'No' and i cannot change that.... Do you...
5
12878
by: Macias | last post by:
Hi, Please help me, how I can make a line drawing on PictureBox similar to MS paint. I thinking about this: click and hold button, move mouse and relase button. I'm trying useing this g.DrawLine(..), but I have a lot of line. In C++ is a parameter XORPUT, but in C# I can't find it.
0
9544
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10490
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10238
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.