Hello to all
I need to merge my code with the PaintBox component.
the question is:
i have a form with edit box where you put the number (data) of the node you want to insert ant it comes to the paintbox in optical version it creates
a rectangle like this
PaintBox1->Canvas->Rectangle(node widthx1,nodehei gthy1,nodewidth x2,nodeheigthy2 );
and i want every time i press the insert button a rectangle to be created
i am to the point that i can create only the first node on 1st and 2nd level then nothing!!!!!
the code for inserting the node is: -
void tree::insert_node(PTR *pt,int x)
-
{
-
PTR t;
-
t=*pt;
-
int pclh,pclw;
-
int nodeheigthy1=0,nodeheigthy2=0,prevnodeheigthy1,prevnodeheigthy2;
-
int nodewidth,nodewidthx1,nodewidthx2;
-
bool type=0;
-
pclh=Form1->PaintBox1->ClientHeight;
-
pclw=Form1->PaintBox1->ClientWidth;
-
Form1->Edit4->Text=pclh;
-
Form1->Edit5->Text=pclw;
-
nodewidth=pclw/2;
-
nodeheigthy1=nodeheigthy1+10;
-
nodeheigthy2=nodeheigthy2+50;
-
nodewidthx1=nodewidth+20;
-
nodewidthx2=nodewidth-20;
-
if (t==NULL)
-
{
-
t=new treenode;
-
t->data=x;
-
t->left=NULL;
-
t->right=NULL;
-
Form1->PaintBox1->Canvas->Rectangle(nodewidthx1,nodeheigthy1,nodewidthx2,nodeheigthy2);
-
}
-
else
-
if (x<t->data)
-
{
-
nodewidthx1=nodewidthx1-40;
-
nodeheigthy1=nodeheigthy1+80;
-
nodewidthx2=nodewidthx2-40;
-
nodeheigthy2=nodeheigthy2+80;
-
insert_node(&(t->left),x);
-
Form1->PaintBox1->Canvas->Rectangle(nodewidthx1,nodeheigthy1,nodewidthx2,nodeheigthy2);
-
}
-
else
-
{
-
nodewidthx1=nodewidthx1+40;
-
nodeheigthy1=nodeheigthy1+80;
-
nodewidthx2=nodewidthx2+40;
-
nodeheigthy2=nodeheigthy2+80;
-
insert_node(&(t->right),x);
-
Form1->PaintBox1->Canvas->Rectangle(nodewidthx1,nodeheigthy1,nodewidthx2,nodeheigthy2);
-
}
-
*pt=t;
-
}
-
if anyone knows plaese help i have stuck for two weeks
it is for my exam.
the result i want to achive is to have a graphical aperriance of the tree in the
PaintBox. i anyone want me to sent the whole project pm me.
Sorry i don t know how to add tags and for my english.
thanks in advance.
1 1615
NO ONE???????????? ????
please help
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Joseph |
last post by:
hi
1) i plan on having an awt canvas component (to draw graphs) on a JFrame
with other swing components..will this be okay? i've read that swing and
awt aren't compatible..
2)Also, if i have a function which simply loops infinately that is part of a
form, what happens when a form event (eg button click) occurs? will the
event handler be executed simulatanesouly with the loop? or does the event
excecute first and then the loop is...
|
by: cody |
last post by:
Is there any built in functionality in the .NET framework to get the binary
represention in form of string from a given integer? I can do
1344.ToString("x2") to get hexadecimal output but I need binary.
I know this can be simply programmed with a few lines of code but I just
want to know.
--
cody
|
by: Leslaw Bieniasz |
last post by:
Cracow, 20.09.2004
Hello,
I need to implement a library containing a hierarchy of classes
together with some binary operations on objects. To fix attention,
let me assume that it is a hierarchy of algebraic matrices with the
addition operation. Thus, I want to have a virtual base class
class Matr;
|
by: Tarique Jawed |
last post by:
Alright I needed some help regarding a removal of a binary search
tree. Yes its for a class, and yes I have tried working on it on my
own, so no patronizing please. I have most of the code working, even
the removal, I just don't know how to keep track of the parent, so
that I can set its child to the child of the node to be removed.
IE - if I had
C
/ \
B D
|
by: Foodbank |
last post by:
Hi all,
I'm trying to do a binary search and collect some stats from a text
file in order to compare the processing times of this program (binary
searching) versus an old program using linked lists. I'm totally new
to binary searches by the way. Can anyone help me with the commented
sections below? Much of the code such as functions and printfs has
already been completed. Any help is greatly appreciated.
Thanks,
| |
by: satan |
last post by:
I need to write the definition of the method leavesCount that takes as a parameter a reference of the root node of a binary tree and returns the numbers of leaves in the binary tree. This what i get so far
public class BinaryTree
{
//Definition of the node
protected class BinaryTreeNode
{
DataElement info;
|
by: --== Alain ==-- |
last post by:
Hi,
Several months ago i've asked some information about the best way how to
have some particular columns (progress bar, checkbox, images, color
picker,...) in a ListView component.
It seems that ListView is a complex component and a lot of people advise
to build a custom component but not from ListVIew itself.
Some use a datagrid component as base component, some build a component
|
by: Michael |
last post by:
I have a solution for this, but it feels wrong. If anyone could offer
a better one, I'm all ears. (Or technically, eyes.)
Basically, I have a bunch of classes. For concreteness, one is a
Matrix class, but that's only one example, so please don't get too hung
up on it.
I need to output and input these classes. I'd like a nice, pretty,
human readable output, something like:
1 2 3
|
by: ranadhirnag |
last post by:
In the afterphase of the RESPONSE_RENDER of our phaselistener,we parse the component tree to collect some event-specific data.
This data needs to be rendered/dispatched along with the requested page .
A javascript parser on the client will ectract this data to perform certain actions on the components.
How can this data be sent back along with the document?
Can a phaselistener modify the component tree to add a hidden field?
Any...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |