473,491 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

RightToLeft.Inherit

I wrote a component using class library wizard. In my component i want to in
order to RightToLeft property do some works.
I can find out if user set this property to Yes or No, But if He/She set it
to Inherit I must examine its parent RightToLeft property(if i`m wrong please
tell me) but in this component that inherits from
System.ComponentModel.Component, How can i find parent???
In UserControls we can simply use Parent property but in this kind of
components, how we can find parent.

Thanks in advance.
Nov 16 '05 #1
6 2893
Mohammad,
To the best of my knowledge, at run time, there is no 'Inherit' value, it
can only be Yes/No.
What I actually mean is that any control/component that has its RightToLeft
set to inherit at design time will inherit its parent direction somewhere in
its runtime lifecycle and before you can see it.

again, this is just based on my past experience and not facts.

Picho
"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
I wrote a component using class library wizard. In my component i want to
in
order to RightToLeft property do some works.
I can find out if user set this property to Yes or No, But if He/She set
it
to Inherit I must examine its parent RightToLeft property(if i`m wrong
please
tell me) but in this component that inherits from
System.ComponentModel.Component, How can i find parent???
In UserControls we can simply use Parent property but in this kind of
components, how we can find parent.

Thanks in advance.

Nov 16 '05 #2
Dear Picho
I wrote an if statement that checks if the my control RightToLeft property
is set to yes or no, but when ever i set main form(Parent of my control)
RightToLeft to Yes and my component to Inherit no one of if statements works.

"Picho" wrote:
Mohammad,
To the best of my knowledge, at run time, there is no 'Inherit' value, it
can only be Yes/No.
What I actually mean is that any control/component that has its RightToLeft
set to inherit at design time will inherit its parent direction somewhere in
its runtime lifecycle and before you can see it.

again, this is just based on my past experience and not facts.

Picho
"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
I wrote a component using class library wizard. In my component i want to
in
order to RightToLeft property do some works.
I can find out if user set this property to Yes or No, But if He/She set
it
to Inherit I must examine its parent RightToLeft property(if i`m wrong
please
tell me) but in this component that inherits from
System.ComponentModel.Component, How can i find parent???
In UserControls we can simply use Parent property but in this kind of
components, how we can find parent.

Thanks in advance.


Nov 16 '05 #3
I see.
I probably misunderstood you.

A Component has no Internal RightToLeft support. I thought you were talking
about a Control/UserControl.
If that is the case, you should implement a Parent property yourself that
implements direction control (any Control object), and then sign to its
RightToLeftChanged event.

Picho
"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:23**********************************@microsof t.com...
Dear Picho
I wrote an if statement that checks if the my control RightToLeft property
is set to yes or no, but when ever i set main form(Parent of my control)
RightToLeft to Yes and my component to Inherit no one of if statements
works.

"Picho" wrote:
Mohammad,
To the best of my knowledge, at run time, there is no 'Inherit' value, it
can only be Yes/No.
What I actually mean is that any control/component that has its
RightToLeft
set to inherit at design time will inherit its parent direction somewhere
in
its runtime lifecycle and before you can see it.

again, this is just based on my past experience and not facts.

Picho
"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
>I wrote a component using class library wizard. In my component i want
>to
>in
> order to RightToLeft property do some works.
> I can find out if user set this property to Yes or No, But if He/She
> set
> it
> to Inherit I must examine its parent RightToLeft property(if i`m wrong
> please
> tell me) but in this component that inherits from
> System.ComponentModel.Component, How can i find parent???
> In UserControls we can simply use Parent property but in this kind of
> components, how we can find parent.
>
> Thanks in advance.


Nov 16 '05 #4
Ok thanx, but how can I implement a parent property?

"Picho" wrote:
I see.
I probably misunderstood you.

A Component has no Internal RightToLeft support. I thought you were talking
about a Control/UserControl.
If that is the case, you should implement a Parent property yourself that
implements direction control (any Control object), and then sign to its
RightToLeftChanged event.

Picho
"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:23**********************************@microsof t.com...
Dear Picho
I wrote an if statement that checks if the my control RightToLeft property
is set to yes or no, but when ever i set main form(Parent of my control)
RightToLeft to Yes and my component to Inherit no one of if statements
works.

"Picho" wrote:
Mohammad,
To the best of my knowledge, at run time, there is no 'Inherit' value, it
can only be Yes/No.
What I actually mean is that any control/component that has its
RightToLeft
set to inherit at design time will inherit its parent direction somewhere
in
its runtime lifecycle and before you can see it.

again, this is just based on my past experience and not facts.

Picho
"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
>I wrote a component using class library wizard. In my component i want
>to
>in
> order to RightToLeft property do some works.
> I can find out if user set this property to Yes or No, But if He/She
> set
> it
> to Inherit I must examine its parent RightToLeft property(if i`m wrong
> please
> tell me) but in this component that inherits from
> System.ComponentModel.Component, How can i find parent???
> In UserControls we can simply use Parent property but in this kind of
> components, how we can find parent.
>
> Thanks in advance.


Nov 16 '05 #5
this is a simple almost complete example:

// Code start:
using System;

namespace ParentPropertyExample
{
public class RTLComponent : System.ComponentModel.Component
{
private System.Windows.Forms.Control _parent;
private System.Windows.Forms.RightToLeft _rightToLeft;
private bool _inheritRightToLeft;

public RTLComponent()
{
}
public RTLComponent(System.Windows.Forms.Control parent)
{
this.Parent = parent;
}

public System.Windows.Forms.Control Parent
{
get
{
return _parent;
}
set
{
if (_parent==value)
return;

if (_parent!=null)
_parent.RightToLeftChanged-=new
EventHandler(this.ParentRightToLeftChanged);

_parent = value;
_parent.RightToLeftChanged+=new
EventHandler(this.ParentRightToLeftChanged);

if (this.DesignMode)
return;

if (!_inheritRightToLeft)
return;

if (this.Parent==null)
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
else
this.RightToLeft = this.Parent.RightToLeft;
}
}

public System.Windows.Forms.RightToLeft RightToLeft
{
get
{
return _rightToLeft;
}
set
{
if (this.DesignMode)
{
if (value==System.Windows.Forms.RightToLeft.Inherit)
_inheritRightToLeft = true;
else
_inheritRightToLeft = false;
}

_rightToLeft = value;
}
}

private void ParentRightToLeftChanged(object sender, EventArgs e)
{
if (this.DesignMode)
return;

if (!_inheritRightToLeft)
return;

if (this.Parent==null)
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
else
this.RightToLeft = this.Parent.RightToLeft;
}
}
}
// code end

talk to me again if it is not clear - have no time to explain right now -
sorry,

Picho

"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
Ok thanx, but how can I implement a parent property?

"Picho" wrote:
I see.
I probably misunderstood you.

A Component has no Internal RightToLeft support. I thought you were
talking
about a Control/UserControl.
If that is the case, you should implement a Parent property yourself that
implements direction control (any Control object), and then sign to its
RightToLeftChanged event.

Picho
"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:23**********************************@microsof t.com...
> Dear Picho
> I wrote an if statement that checks if the my control RightToLeft
> property
> is set to yes or no, but when ever i set main form(Parent of my
> control)
> RightToLeft to Yes and my component to Inherit no one of if statements
> works.
>
> "Picho" wrote:
>
>> Mohammad,
>> To the best of my knowledge, at run time, there is no 'Inherit' value,
>> it
>> can only be Yes/No.
>> What I actually mean is that any control/component that has its
>> RightToLeft
>> set to inherit at design time will inherit its parent direction
>> somewhere
>> in
>> its runtime lifecycle and before you can see it.
>>
>> again, this is just based on my past experience and not facts.
>>
>> Picho
>> "Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in
>> message
>> news:D5**********************************@microsof t.com...
>> >I wrote a component using class library wizard. In my component i
>> >want
>> >to
>> >in
>> > order to RightToLeft property do some works.
>> > I can find out if user set this property to Yes or No, But if He/She
>> > set
>> > it
>> > to Inherit I must examine its parent RightToLeft property(if i`m
>> > wrong
>> > please
>> > tell me) but in this component that inherits from
>> > System.ComponentModel.Component, How can i find parent???
>> > In UserControls we can simply use Parent property but in this kind
>> > of
>> > components, how we can find parent.
>> >
>> > Thanks in advance.
>>
>>
>>


Nov 16 '05 #6
Thank you very much Picho

"Picho" wrote:
this is a simple almost complete example:

// Code start:
using System;

namespace ParentPropertyExample
{
public class RTLComponent : System.ComponentModel.Component
{
private System.Windows.Forms.Control _parent;
private System.Windows.Forms.RightToLeft _rightToLeft;
private bool _inheritRightToLeft;

public RTLComponent()
{
}
public RTLComponent(System.Windows.Forms.Control parent)
{
this.Parent = parent;
}

public System.Windows.Forms.Control Parent
{
get
{
return _parent;
}
set
{
if (_parent==value)
return;

if (_parent!=null)
_parent.RightToLeftChanged-=new
EventHandler(this.ParentRightToLeftChanged);

_parent = value;
_parent.RightToLeftChanged+=new
EventHandler(this.ParentRightToLeftChanged);

if (this.DesignMode)
return;

if (!_inheritRightToLeft)
return;

if (this.Parent==null)
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
else
this.RightToLeft = this.Parent.RightToLeft;
}
}

public System.Windows.Forms.RightToLeft RightToLeft
{
get
{
return _rightToLeft;
}
set
{
if (this.DesignMode)
{
if (value==System.Windows.Forms.RightToLeft.Inherit)
_inheritRightToLeft = true;
else
_inheritRightToLeft = false;
}

_rightToLeft = value;
}
}

private void ParentRightToLeftChanged(object sender, EventArgs e)
{
if (this.DesignMode)
return;

if (!_inheritRightToLeft)
return;

if (this.Parent==null)
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
else
this.RightToLeft = this.Parent.RightToLeft;
}
}
}
// code end

talk to me again if it is not clear - have no time to explain right now -
sorry,

Picho

"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
Ok thanx, but how can I implement a parent property?

"Picho" wrote:
I see.
I probably misunderstood you.

A Component has no Internal RightToLeft support. I thought you were
talking
about a Control/UserControl.
If that is the case, you should implement a Parent property yourself that
implements direction control (any Control object), and then sign to its
RightToLeftChanged event.

Picho
"Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in message
news:23**********************************@microsof t.com...
> Dear Picho
> I wrote an if statement that checks if the my control RightToLeft
> property
> is set to yes or no, but when ever i set main form(Parent of my
> control)
> RightToLeft to Yes and my component to Inherit no one of if statements
> works.
>
> "Picho" wrote:
>
>> Mohammad,
>> To the best of my knowledge, at run time, there is no 'Inherit' value,
>> it
>> can only be Yes/No.
>> What I actually mean is that any control/component that has its
>> RightToLeft
>> set to inherit at design time will inherit its parent direction
>> somewhere
>> in
>> its runtime lifecycle and before you can see it.
>>
>> again, this is just based on my past experience and not facts.
>>
>> Picho
>> "Mohammad-Reza" <Mo**********@discussions.microsoft.com> wrote in
>> message
>> news:D5**********************************@microsof t.com...
>> >I wrote a component using class library wizard. In my component i
>> >want
>> >to
>> >in
>> > order to RightToLeft property do some works.
>> > I can find out if user set this property to Yes or No, But if He/She
>> > set
>> > it
>> > to Inherit I must examine its parent RightToLeft property(if i`m
>> > wrong
>> > please
>> > tell me) but in this component that inherits from
>> > System.ComponentModel.Component, How can i find parent???
>> > In UserControls we can simply use Parent property but in this kind
>> > of
>> > components, how we can find parent.
>> >
>> > Thanks in advance.
>>
>>
>>


Nov 16 '05 #7

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

Similar topics

1
1448
by: Mohammad-Reza | last post by:
Hi Please tell me how can I find out that the parent of my control is right to left or not. Like MenuItem. MenuItem by itself doesn't any RightToLeft property but when you change the right to...
2
2265
by: Sharon | last post by:
is there any way i can move tabControl's tabs to the top right when RightToLeft set to true ? Thank you Sharon
0
1373
by: Islamegy® | last post by:
In my application i need to use a TreeView control.. I need it to be RighttoLeft enabled but this feature is not supported as expected.. My appl. is in Arabic and TreeView must be really...
2
3088
by: Ehsanal | last post by:
plz i have a question: when i put the properties in a textBox like this: TextAlign = System.Windows.Forms.HorizontalAlignment.Right; RightToLeft = RightToLeft.YES; then the writting will...
0
1083
by: Gidi | last post by:
Hi, I've dataGrid which is set to be RightToLeft. I want that in some cells it won't be RightToLeft (the reason is that when RightToLeft is enabled, negative numbers display backwards, i.e. -20...
0
978
by: Bruce | last post by:
I have an MDI form with several RichEdit controls. I have an application setting to set the controls to RightToLeft when the form opens. When the form opens in RightToLeft mode, the text is shifted...
0
1382
by: Fabio | last post by:
Hi all! I need to implement the RightToLeft feature in a Graphics.DrawString(). I set the StringFormatFlags.DirectionRightToLeft to the StringFormat but... I don't see any difference between the...
0
866
by: nagham | last post by:
I need to create an arabic report I mean RightToLeft,so if in LTR I have the columns Col1 Col2 I want in RTL that Col1 be at the top right and then Col2,how can I do this ,is there a RightToLeft...
3
1582
by: teo | last post by:
The RightToLeft option is very useful in the RegEx syntax. I'm using the RegExBuddy software to help myself. But I'm not able to set the RightToLeft option in this software. Any idea?
0
7190
jinu1996
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...
0
7360
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...
0
5451
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,...
1
4881
isladogs
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...
0
3086
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...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1392
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
280
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...

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.