473,948 Members | 11,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Base And protected method

Hi,
com add-in vs.net 2003 & outlook 2003 & c#
I need to access to protected method of AxHost, How can I do this?
I get nothing after the dot (base.), Why?
This is my code: I need to set icon on commandBarButto n:
I need to get this:
return(stdole.I PictureDisp)bas e.GetIPictureDi spFromPicture(i mage);
Thank you.
using System;
using System.Drawing;
using System.Windows. Forms;
using stdole;
namespace MatarotToolbar
{
internal class MatarotHost : AxHost
{
public MatarotHost() : base("02FD5840-C1A3-448E-8310-98611DF58281"){ }
public static stdole.IPicture Disp ImageToIPicture (Image image)
{
return(stdole.I PictureDisp)Mat arotHost.GetIPi ctureDispFromPi cture(image);
}
public static System.Drawing. Image IPictureToImage (stdole.IPictur eDisp
picture)
{
return MatarotHost.Get PictureFromIPic ture(picture);
}

// static public stdole.IPicture Disp ImageToPictureD isp(Image image)
// {
// return (stdole.IPictur eDisp)GetIPictu reDispFromPictu re(image);
// }
//
// static public stdole.IPicture Disp IconToPictureDi sp(Icon icon)
// {
// return ImageToPictureD isp(icon.ToBitm ap());
// }

// public new static IPictureDisp GetIPictureDisp FromPicture(Ima ge image)
// {
// return (IPictureDisp)A xHost.GetIPictu reDispFromPictu re(image);
// }
// public IPictureDisp GetIPictureDisp OfPicture(Image image)
//{
// return (IPictureDisp)M atarotHost.GetI PictureDispFrom Picture(image);
// }
// public static stdole.IPicture Disp ImageToIpicture (System.Drawing .Image
image)
// {
// return (stdole.IPictur eDisp)MatarotHo st.GetIPictureD ispFromPicture( image);
// }
//
// public static System.Drawing. Image IPictureToImage (stdole.StdPict ure
picture)
// {
// return GetPictureFromI Picture(picture );
// }
}
}

Jun 1 '07 #1
4 2156
On Jun 1, 9:40 am, Yael <Y...@discussio ns.microsoft.co mwrote:
com add-in vs.net 2003 & outlook 2003 & c#
I need to access to protected method of AxHost, How can I do this?
I get nothing after the dot (base.), Why?
This is my code: I need to set icon on commandBarButto n:
I need to get this:
return(stdole.I PictureDisp)bas e.GetIPictureDi spFromPicture(i mage);
It's a static method - you can't call it on an instance.

Use AxHost.GetIPict ureDispFromPict ure(image);

Jon

Jun 1 '07 #2

"Yael" <Ya**@discussio ns.microsoft.co mskrev i meddelandet
news:4A******** *************** ***********@mic rosoft.com...
Hi,
com add-in vs.net 2003 & outlook 2003 & c#
I need to access to protected method of AxHost, How can I do this?
As the method you refer to is "static", you should be able to do as you've
already done in one of the methods, extending the AxHost class and using the
classname as identifier.

public new static IPictureDisp GetIPictureDisp FromPicture(Ima ge image)
{
return (IPictureDisp)A xHost.GetIPictu reDispFromPictu re(image);
}
I get nothing after the dot (base.), Why?
Because GetIPictureDisp FromPicture isn't an "instance member" but a "class
member".
/// Bjorn A
Jun 1 '07 #3
Thank's for your replays:
I tried to write this, but it is still not good:
public new static IPictureDisp GetIPictureDisp FromPicture(Ima ge image)
{
return (IPictureDisp)A xHost.GetIPictu reDispFromPictu re(image);
}
And maybe it is becouse of I don't get this method after the dot? (it's a
protected method)
AxHost. --I don't have this GetIPictureDisp FromPicture(ima ge);
"Bjorn Abelli" wrote:
>
"Yael" <Ya**@discussio ns.microsoft.co mskrev i meddelandet
news:4A******** *************** ***********@mic rosoft.com...
Hi,
com add-in vs.net 2003 & outlook 2003 & c#
I need to access to protected method of AxHost, How can I do this?

As the method you refer to is "static", you should be able to do as you've
already done in one of the methods, extending the AxHost class and using the
classname as identifier.

public new static IPictureDisp GetIPictureDisp FromPicture(Ima ge image)
{
return (IPictureDisp)A xHost.GetIPictu reDispFromPictu re(image);
}
I get nothing after the dot (base.), Why?

Because GetIPictureDisp FromPicture isn't an "instance member" but a "class
member".
/// Bjorn A
Jun 1 '07 #4

"Yael" <Ya**@discussio ns.microsoft.co mwrote...
I tried to write this, but it is still not good:
public new static IPictureDisp GetIPictureDisp FromPicture(Ima ge image)
{
return (IPictureDisp)A xHost.GetIPictu reDispFromPictu re(image);
}
And maybe it is becouse of I don't get this method after the dot? (it's a
protected method)
AxHost. --I don't have this GetIPictureDisp FromPicture(ima ge);
Then you maybe haven't included system.windows. forms.dll in your project,
or you didn't reference the System.Windows. Forms namespace in the
declarations,
or your class didn't extend AxHost...

I did, and I got GetIPictureDisp FromPicture among the alternatives after the
dot when writing AxHost...

Or possibly you have another error in the code, above that point, that needs
to be resolved first...

/// Bjorn A
Jun 2 '07 #5

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

Similar topics

3
2366
by: Teis Draiby | last post by:
I want to write a base class that includes a member function that creates an instance of a derrived class and returns a pointer to it. Problem: The derived class definition has to follow the base class definition. Therefore I can't specify the return type of the function, that returns a pointer to the derived class, because the derived class is not yet known at that point. Hov can I solve this problem? In a nice manner :)
1
1859
by: Matthias Kaeppler | last post by:
Sorry if this has been discussed before (I'm almost certain it has), but I didn't know what to google for. My problem is, I have a class, a gtkmm widget, and I want it to serve as a base class now, but I'm not sure if I'm taking the proper steps in order to not break the whole class. Are there any guidelines what I have to watch out for? One question would e.g. be:
3
3512
by: J.J. Feminella | last post by:
(Please disregard the previous message; I accidentally sent it before it was completed.) I have source code similar to the following. public class Vehicle { protected string dataV; // ... more protected fields }
5
10567
by: Sebastiaan Olijerhoek | last post by:
How can I call the Root.Method() from B.Method() class Root { public Root() { } private virtual void Method() {
10
1554
by: Peter Oliphant | last post by:
Is there a way of defining a method in a base class such that derived classes will call their own version, EVEN if the derived instance is referred to by a pointer to the base class? Note that the base class method is not to be abstract, and will be called if the instance was created as a 'generic' base class instance. It's sort of like I want the method to be abstract to children, but concrete at the base level. That way I can refer to...
4
2875
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. '**************************************************************************** ' Issues '****************************************************************************
7
2267
by: relient | last post by:
Question: Why can't you access a private inherited field from a base class in a derived class? I have a *theory* of how this works, of which, I'm not completely sure of but makes logical sense to me. So, I'm here for an answer (more of a confirmation), hopefully. First let me say that I know people keep saying; it doesn't work because the member "is a private". I believe there's more to it than just simply that... Theory: You inherit,...
3
5351
by: Jordan | last post by:
Suppose I have a system that keeps track of 5 different types of "People". My intent is to have a base Person class, then 5 derived classes for each of the specific person types (e.g., Patient, Doctor, Employee, Contractor, etc). Now, at runtime I need to retrieve all the property values from a database and populate all of the fields of both the base and derived classes. Not all fields will need to be exposed via public properties as...
5
2630
by: Dennis Jones | last post by:
Hello, I have a couple of classes that look something like this: class RecordBase { }; class RecordDerived : public RecordBase {
7
2000
by: MarkJ | last post by:
him im kinda new to c-sharp... to reference up the class chain, how do i reference the super class (parent) example class mybase { protected int abc=0 } classs myclass:mybase {
0
10169
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, 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...
0
9989
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
11590
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...
0
11184
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 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...
1
11358
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
6122
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
6343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4952
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 we have to send another system
2
4545
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.