Picture

U

Ulf Nilsson

Hi,
How do I add my own-made pictures to the buttons? How do I make them part of
the .dll?

/ Ulf
 
S

sk

For my case,
I create one dummy dialog with image control and put the customized image
there
and the rest is the same as you add normal button but you copy into the
clipboard
from image in the dummy dialog and paste into the button you just created.


'-----------------------------------------------
' Button
'-----------------------------------------------
Set m_cbcConnectButton = .Add(msoControlButton)

With m_cbcConnectButton
.Style = msoButtonIcon
.Caption = CONNECT_BT_NAME
Clipboard.Clear
Clipboard.SetData AddinsButtons.ConnectPic.Image
.PasteFace
.ToolTipText = CONNECT_BT_NAME
.Tag = CONNECT_BT_NAME
End With

Shinya
----- Original Message -----
From: "Ulf Nilsson" <[email protected]>
Newsgroups: microsoft.public.office.developer.com.add_ins
Sent: Monday, June 20, 2005 7:18 AM
Subject: Picture
 
U

Ulf Nilsson

Thanks Shinya,
I will try your method. But, does this mean there is no other way of
integrating my own custimized images in a .dll?

/ Ulf
 
S

sk

You can add the image(BMP) to resource editor in VB and
copy and paste it to the button just like i did for the last sample.
That's all I know.

Shinya
 
U

Ulf Nilsson

I have added a form (frmPictures) with four images (img1, img2, ing3, img4).
Or should it be for buttons with images?
When I try your suggestion with Clipboard... I get errors.
How can I copy the images (CopyFace) to the button? I can't get your code to
work.

/ Ulf
 
S

sk

I have added a form (frmPictures) with four images (img1, img2, ing3,
This is correct way.

It was for VB6, so you will need to work
for C# in similar way. I believe both live in
MS so should make much difference.

You might have to use different way to copy image into
the clipboard I've attached the link of how to copy and paste image in C#
so you can use as reference.
http://www.codeproject.com/csharp/clipboard01.asp

If you still have the problem, you post your code and specify
where error occurs I can help you.

Shinya
 
U

Ulf Nilsson

I'm using Word XP VBA with the MS Office XP Developer edition. In VBA, there
is such things as CopyFace and PasteFace, but how do I apply these commands
in frmPictures?

/ Ulf
 
S

sk

I thought you are developing com addin.

Probaly different in VBA. Here is the source for VBA in VB6 I found
in a news group. I didn't go through source so post your source
if you want to get more help from me.


Shinya
You can add the picture on one of the slides of your add-in and use code
like:


----------------------------------------
Sub CopyCustomizedFace()
Dim oSheet As Worksheet
'Replace name of the sheet with the name you've used
Set oSheet = ThisWorkbook.Worksheets("CopyF-ace")
oSheet.Shapes(1).Copy
Set oSheet = Nothing
End Sub


and add the buttons in the Add_Install event (if you're using the workbook
as addin of course ;-)


Private Sub Workbook_AddinInstall()
Dim oMenu As CommandBar
Dim oButton As CommandBarButton


On Error Resume Next
CopyCustomizedFace


Set oMenu = Application.CommandBars("Stand-ard")
Set oButton = oMenu.Controls.Add(Type:=msoCo-ntrolButton,
Before:=oMenu.Controls.Count + 1)


With oButton
.BeginGroup = True
.Style = msoButtonIcon
.PasteFace
.OnAction = "NameOfMacro"
.TooltipText = "Tooltip here"
End With


Set oMenu = Nothing
Set oButton = Nothing


End Sub
----------------------------------------


Hope this helps,
regards,
Astrid


So that all can benefit from the discussion, please post all follow-ups to
the newsgroup.
 
S

sk

I hope you are using exactly the same code

You will need msoButtonCaption => msoButtonIcon
See where i put the "PasteFace" function

So where do you have the problem? when copying or pasting?


With btnMyButton
.Style = msoButtonCaption
.BeginGroup = True
.Caption = "&Greetings"
.PasteFace << here
.TooltipText = "Display Hello World Message"
.Width = "24"
End With
 
U

Ulf Nilsson

Thank you for your patient!
I have changed the code to msoButtonIcon.
I have problem with CopyFace. How do I use CopyFace? The code does not work
with: frmPictures.img1.Copyface

/ Ulf
 
S

sk

Probabaly CopyFace doesn't work.
(So for C# CopyFace in image control is available?
I can't find anything similar in VB for image control )

Instead use the following API.

Clipboard.SetDataObject(frmPictures.img1.Image,true);
I could be wrong about what parameters to set.
Please check the msdn since i don't have it install on my pc

and PasteFace as i stated in earlier post

Shinya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top