Always want to make a Sogou input method, QQ input method such as can customize the skin software. Looking for a long time finally found, but found the solution some problems, after modification can be the original size of the picture to show ~
In my two nights of research, study several methods, finally found a good way on the internet, but some problems, I modified the next, finally realize the new version of Bo speed read the skin function.
Software official website: http://leaful.com/weibopopup
Public classNinegridsborder:border//Nine lattice Border { PublicBitmapImage backgroundimage {Get{return(BitmapImage) GetValue (backgroundimageproperty);} Set{SetValue (backgroundimageproperty, value);} } Public Static ReadOnlyDependencyProperty Backgroundimageproperty =Dependencyproperty.register ("backgroundimage",typeof(BitmapImage),typeof(Ninegridsborder),NewFrameworkpropertymetadata (NULL, Frameworkpropertymetadataoptions.affectsrender)); PublicThickness Sizingmargins {Get{return(Thickness) GetValue (sizingmarginsproperty);} Set{SetValue (sizingmarginsproperty, value);} } Public Static ReadOnlyDependencyProperty Sizingmarginsproperty =Dependencyproperty.register ("Sizingmargins",typeof(Thickness),typeof(Ninegridsborder),NewFrameworkpropertymetadata (NewThickness (), Frameworkpropertymetadataoptions.affectsrender)); protected Override voidOnRender (drawingcontext DC) {varIMG =backgroundimage; if(img = =NULL)return; varRenderrect =NewRect (0,0, Rendersize.width, rendersize.height); if(Sizingmargins = =NewThickness ()) {DC. DrawRectangle (NewImageBrush (IMG),NULL, Renderrect); return; } varSMS =Sizingmargins; Double[] Verticalgl = {0d, SMS. Left, Renderrect.width-SMS. Right, renderrect.width}; Double[] Horizontalgl = {0d, SMS. Top, Renderrect.height-SMS. Bottom, renderrect.height}; varGLS =NewGuidelineSet (VERTICALGL, HORIZONTALGL); Gls. Freeze (); dc. Pushguidelineset (GLS); Double[] vx = {0d, SMS. Left/img. Pixelwidth, (IMG. Pixelwidth-sms. right)/img. Pixelwidth, 1d}; Double[] Vy = {0d, SMS. Top/img. Pixelheight, (IMG. Pixelheight-sms. Bottom)/img. Pixelheight, 1d}; Double[] x = {renderrect.left, Renderrect.left + SMS. Left, Renderrect.right-SMS. Right, renderrect.right}; Double[] y = {renderrect.top, renderrect.top + SMS. Top, Renderrect.bottom-SMS. Bottom, Renderrect.bottom}; for(vari =0; I <3; ++i) { for(varj =0; J <3; ++j) {varBrush =NewImageBrush (img) {Viewbox=NewRect (Vx[j], vy[i], Math.max (0D, (Vx[j +1] -Vx[j]), Math.max (0D, (Vy[i+1] -Vy[i]))) }; dc. DrawRectangle (Brush,NULL,NewRect (X[j], y[i], Math.max (0D, (X[j +1]-x[j]), Math.max (0D, (Y[i +1] -y[i])); }} DC. Pop (); } }
The XML configuration file can be customized with only two parameters: S Izingmargin and Contentmargin
Sizingmargin= "332,67,40,172″
Contentmargin= "145,25,10,65″
Done!
Plus some animations, feel silky smooth, super cool. Mom never have to worry about my software is not good enough!
WPF Nine Gongge Pictures custom skin (new blogger Speed Reading 2.0)