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

editable image property ?

Hi,

I would like to have a property of image type.

i've seen on official .NET component that several controls have such
properties.

My component is built under VC++.NET and not under C#, but as codes are
similar and i did not get any help from relative forum, i'm asking here.

So, i do not have any problem with my component except 1 thing.
When an image is already allocated, i can not delete it or destroy the
bundling with the property by replacing "System.Drawing.Bitmap" with
"(none)".
the (none) appears when i directly edit and erase everything (all
characters) from the image property editor.

in my component it's impossible...
i was thinking to convert my type image to a string (to be able to edit
it in property editor) and after to convert it back, but i would be very
surprised if this is the solution.

please, could you advise me ?

thanks a lot,

Alain
Oct 23 '06 #1
3 2343
Hi Alain,

Assuming you're using VS 2005 add the following to your property (C#):

[DefaultValue(null)]
public Bitmap MyBitmap { get { return bitmap } set { bitmap = value; } }

In the property window you can select the text and press the delete key or you
can right-mouse click and select "Reset".

--
Dave Sexton

"--== Alain ==--" <no****@noemail.comwrote in message
news:uq**************@TK2MSFTNGP02.phx.gbl...
Hi,

I would like to have a property of image type.

i've seen on official .NET component that several controls have such
properties.

My component is built under VC++.NET and not under C#, but as codes are
similar and i did not get any help from relative forum, i'm asking here.

So, i do not have any problem with my component except 1 thing.
When an image is already allocated, i can not delete it or destroy the
bundling with the property by replacing "System.Drawing.Bitmap" with
"(none)".
the (none) appears when i directly edit and erase everything (all
characters) from the image property editor.

in my component it's impossible...
i was thinking to convert my type image to a string (to be able to edit it
in property editor) and after to convert it back, but i would be very
surprised if this is the solution.

please, could you advise me ?

thanks a lot,

Alain

Oct 24 '06 #2
here is my code :

#pragma region public Property : ImageSortAscendant
// Allow user to select the image which will be displayed for column
sorted ascendantly

[System::ComponentModel::DefaultPropertyAttribute (nullptr)]
property Bitmap^ ImageSortAscendant
{
Bitmap^ get()
{
return m_ImageSortA;
}
void set(System::Drawing::Bitmap^ value)
{
m_ImageSortA = value;
}
}
#pragma endregion

but when i try to compile, i have the following error :
...\RAF_ListView.h(177) : error C3115:
'System::ComponentModel::DefaultPropertyAttribute' : this attribute is
not allowed on 'RAF_ListView::AR_ListView::ImageSortAscendant'

how could it be possible ?
if i understood well, [DefaultValue(null)] was available on .net v1 only.

thanks,

Al.
Dave Sexton wrote:
Hi Alain,

Assuming you're using VS 2005 add the following to your property (C#):

[DefaultValue(null)]
public Bitmap MyBitmap { get { return bitmap } set { bitmap = value; } }

In the property window you can select the text and press the delete key or you
can right-mouse click and select "Reset".
Oct 25 '06 #3
Hi Alain,
but when i try to compile, i have the following error :
..\RAF_ListView.h(177) : error C3115:
'System::ComponentModel::DefaultPropertyAttribute' : this attribute is not
allowed on 'RAF_ListView::AR_ListView::ImageSortAscendant'
how could it be possible ?
I searched MSDN for C3115 - I think you are misusing the attribute.

Attribute Usage on MSDN:
http://windowssdk.msdn.microsoft.com.../0b34zz73.aspx

Apparently your example is not the correct way to declare public properties so
that they can use managed attributes. In the link I posted above there is no
reference to public properties at all so I'm not sure how you can accomplish
that (although there is mention of attributes on methods, which I believe is
the direction you'll probably need to go)

Your idea that C# is similar enough to C++ and asking your questions in this
newsgroup isn't going to help you solve your problems. You're probably much
better off finding some managed C++ resources and taking some time to read
them.
if i understood well, [DefaultValue(null)] was available on .net v1 only.
DefaultValueAttribute is still alive and well in the 2.0 framework. I use it
all the time.

--
Dave Sexton

"--== Alain ==--" <no****@noemail.comwrote in message
news:ey****************@TK2MSFTNGP03.phx.gbl...
here is my code :

#pragma region public Property : ImageSortAscendant
// Allow user to select the image which will be displayed for column sorted
ascendantly

[System::ComponentModel::DefaultPropertyAttribute (nullptr)]
property Bitmap^ ImageSortAscendant
{
Bitmap^ get()
{
return m_ImageSortA;
}
void set(System::Drawing::Bitmap^ value)
{
m_ImageSortA = value;
}
}
#pragma endregion

but when i try to compile, i have the following error :
..\RAF_ListView.h(177) : error C3115:
'System::ComponentModel::DefaultPropertyAttribute' : this attribute is not
allowed on 'RAF_ListView::AR_ListView::ImageSortAscendant'

how could it be possible ?
if i understood well, [DefaultValue(null)] was available on .net v1 only.

thanks,

Al.
Dave Sexton wrote:
>Hi Alain,

Assuming you're using VS 2005 add the following to your property (C#):

[DefaultValue(null)]
public Bitmap MyBitmap { get { return bitmap } set { bitmap = value; } }

In the property window you can select the text and press the delete key or
you can right-mouse click and select "Reset".

Oct 25 '06 #4

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

Similar topics

17
by: black tractor | last post by:
HI there.. l was just wondering, if l place a "table" in the "editable region" of my template, will the text, graphics placed inside the this "table" MOVE BY ITSELF?? l mean, recently l had a...
4
by: Stephan Bour | last post by:
Hi, I have a datagrid databound to a SQL query. I'd like to allow editing of some columns but not all. Is there a way to turn off the conversion of the datagrid cells to textboxes for some columns...
0
by: DaveR | last post by:
I have a webform with a two-column datagrid based on an Arraylist. The Arraylist draws the data for the two columns from two different tables in an SQL database. The data is displayed in datagrid...
2
by: dba56 | last post by:
In an ASP.Net 2.0 page using SQL Server 2K, I have a editable gridview that is bound to a SQLDataSource using stored procedures for its select and update queries. The grid works fine but is slow...
0
by: Christian Schlemmer | last post by:
hi, in a DetailsView i have a image display. images i want to store in a seperate directory, but it a path is added to Bind update and delete is not working. just Bind makes my...
2
by: rizwanahmed24 | last post by:
Hello i have a web browser AxSHDocVw.AxWebBrowser. i load html file in it. Currently the web browser is not editable. i want to make it editable so that i can to edit the file on runtime through...
2
by: taknev | last post by:
Hi, i am having primary address textbox and secondary address textbox and a check box .if we click check box it is copying the primary address to secondary address.so the secondary address should...
2
by: vinod allapu | last post by:
Hi all, i want to append an empty column to the grid view. Only the appended column should be editable and while displaying the grid the entire column should be in editable mode(not a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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,...

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.