Click here to Skip to main content
15,897,334 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

I load icon by this code:

C#
void Test::OnDrawSortArrow(CDC* pDC, CRect rectArrow)
{
    Metafile * emf = NULL;

    emf = LoadMetafile(IDR_ICON_EXPAND, NULL, true);
    Gdiplus::Bitmap* image = BitmapFromEmf(emf, 8, 8, Color(255,82,82,82), 0);

    HICON hIcon = NULL;

    if(IsAscending())
        image->RotateFlip(Rotate180FlipNone);

    image->GetHICON(&hIcon);

    pDC->DrawIcon(rectArrow.TopLeft().x - 20, rectArrow.TopLeft().y - 10, hIcon);

    delete emf;
}


The problem that icon that I loaded should be 8x8 but this icon stretching to more bigger size
How can I set size of arrows to 8?
Posted

I found solution!
Need to change margin of image
 
Share this answer
 
C#
void Test::OnDrawSortArrow(CDC* pDC, CRect rectArrow)
{
    Metafile * emf = NULL;

    emf = LoadMetafile(IDR_ICON_EXPAND, NULL, true);
    Gdiplus::Bitmap* image = BitmapFromEmf(emf, 8, 8, Color(255,82,82,82), 0);

    HICON hIcon = NULL;

    pDC->DrawIcon(rectArrow.TopLeft().x - 20, rectArrow.TopLeft().y - 10, hIcon);

    delete emf;
}
 
Share this answer
 
Comments
thomas_wingfield 31-Oct-13 12:45pm    
Sorry but this is bad solution:(
C#
#include <stdio.h>
#include<string.h>

char f[10000];
char factorial[1010][10000];

void multiply(int k)
{
int cin,sum,i;
int len = strlen(f);
cin=0;
i=0;
while(i<len)
{
sum=cin+(f[i] - '0') * k;
f[i] = (sum % 10) + '0';
i++;
cin = sum/10;
}
while(cin>0)
{
f[i++] = (cin%10) + '0';
cin/=10;
}
f[i]='\0';
for(int j=0;j<i;j++)
factorial[k][j]=f[j];

factorial[k][i]='\0';
}
void fac()
{
int k;
strcpy(f,"1");
for(k=2;k<=1000;k++)
multiply(k);
}
void print(int n)
{
int i;
int len = strlen(factorial[n]);
printf("%d!\n",n);
for(i=len-1;i>=0;i--)
printf("%c",factorial[n][i]);
printf("\n");
}
int main()
{
int n;
factorial[0][0]='1';
factorial[1][0]='1';
fac();
while(scanf("%d",&n)==1){
print(1);
}
return 0;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900